scp root@10.200.1.61:/var/lib/pgsql/9.6/data/recovery.conf .
push:
- scp pgpool.conf failover.sh online-recovery.sh root@10.200.1.60:/etc/pgpool-II/
+ #scp pgpool.conf failover.sh online-recovery.sh root@10.200.1.60:/etc/pgpool-II/
scp streaming-replication.sh root@10.200.1.61:/var/lib/pgsql/
This version is work-in-progress using Centos7 and upstream packages. It doesn't require psmisc package, making Centos7 minimal installation sufficient for scripts to run, since it uses systemd to manage postgresql-9.6 installed in /var/lib/pgsql/9.6/data/
-Hardware configuration is 3 nodes:
+Hardware configuration is 2 nodes:
-10.200.1.60 edozvola-pgpool
10.200.1.61 edozvola-db-01
10.200.1.62 edozvola-db-02
ssh root@$1 'cat /var/lib/pgsql/.ssh/id_rsa.pub' >> /tmp/authorized_keys
}
-ssh_config 10.200.1.60
ssh_config 10.200.1.61
ssh_config 10.200.1.62
-for host in 10.200.1.60 10.200.1.61 10.200.1.62
+for host in 10.200.1.61 10.200.1.62
do
ssh root@$host 'cat > /var/lib/pgsql/.ssh/authorized_keys' < /tmp/authorized_keys
done
ssh root@10.200.1.62 ln -sf /var/lib/pgsql/9.6/data/postgresql.conf.slave /var/lib/pgsql/9.6/data/postgresql.conf
ssh root@10.200.1.62 sudo -u postgres /var/lib/pgsql/streaming-replication.sh 10.200.1.61
-export PAGER=''
-
-# init pgpool
-ssh root@10.200.1.60 rm -f /var/log/pgpool/pgpool_status
-echo 0 | ssh root@10.200.1.60 'cat > /tmp/postgres_master'
-ssh root@10.200.1.60 systemctl restart pgpool
-psql -h 10.200.1.60 -c 'show pool_nodes' postgres postgres
-
-# test database
-psql -h 10.200.1.60 -c 'create database test' --user postgres
-
-psql -h 10.200.1.60 --user postgres -l
-
-psql -h 10.200.1.60 -f t/1-create-test.sql test postgres
-
-psql -c 'SELECT * from pg_stat_replication' -h 10.200.1.61 postgres postgres
-
-psql -h 10.200.1.60 -c 'select * from t' test postgres
-psql -h 10.200.1.61 -c 'select * from t' test postgres
-psql -h 10.200.1.62 -c 'select * from t' test postgres
-
--- /dev/null
+#!/bin/sh -xe
+
+export PAGER=''
+
+# init pgpool
+ssh root@10.200.1.60 rm -f /var/log/pgpool/pgpool_status
+echo 0 | ssh root@10.200.1.60 'cat > /tmp/postgres_master'
+ssh root@10.200.1.60 systemctl restart pgpool
+psql -h 10.200.1.60 -c 'show pool_nodes' postgres postgres
+
--- /dev/null
+#!/bin/sh -xe
+
+export PAGER=''
+
+# test database
+psql -h 10.200.1.60 -c 'create database test' --user postgres
+
+psql -h 10.200.1.60 --user postgres -l
+
+psql -h 10.200.1.60 -f t/1-create-test.sql test postgres
+
+psql -c 'SELECT * from pg_stat_replication' -h 10.200.1.61 postgres postgres
+
+psql -h 10.200.1.60 -c 'select * from t' test postgres
+psql -h 10.200.1.61 -c 'select * from t' test postgres
+psql -h 10.200.1.62 -c 'select * from t' test postgres
+