pkill -9 postgres
rm -rf data data1 data2
./initdb -D data
./initdb -D data1
echo "wal_level = logical">> data/postgresql.conf
echo "port=5433" >> data1/postgresql.conf
#cp postgresql.conf data/
#cp postgresql.conf_sub data1/postgresql.conf
./pg_ctl -D data -c start
./pg_ctl -D data1 -c start
./psql -p 5432 -d postgres -c "create table pgbench_accounts(a int primary key, b int)"
./psql -p 5433 -d postgres -c "create table pgbench_accounts(a int primary key, b int)"
./psql -p 5432 -d postgres -c "ALTER TABLE pgbench_accounts REPLICA IDENTITY FULL;"
./psql -p 5433 -d postgres -c "ALTER TABLE pgbench_accounts REPLICA IDENTITY FULL;"
./psql -p 5432 -d postgres -c "CREATE PUBLICATION mypub FOR TABLE pgbench_accounts"
./psql -p 5433 -d postgres -c "CREATE PUBLICATION mypub1 FOR TABLE pgbench_accounts"
./psql -d postgres -p 5433 -c "CREATE SUBSCRIPTION mysub CONNECTION 'host=127.0.0.1 port=5432 dbname=postgres' PUBLICATION mypub"

