removed pgpool node, split scripts
authorDobrica Pavlinusic <dpavlin@rot13.org>
Tue, 29 Aug 2017 10:52:56 +0000 (12:52 +0200)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Tue, 29 Aug 2017 10:53:20 +0000 (12:53 +0200)
Makefile
README.md
t/0-ssh-deploy.sh
t/1-init-cluster.sh
t/2-init-pgpool.sh [new file with mode: 0755]
t/3-test.sh [new file with mode: 0755]

index b512247..c746248 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -22,7 +22,7 @@ pull:
        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/
index 2f8df14..a5d4f23 100644 (file)
--- a/README.md
+++ b/README.md
@@ -5,9 +5,8 @@ This simple project aims to automate and make easy the online recovery process o
 
 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
 
index bf71f46..6eed3fa 100755 (executable)
@@ -7,11 +7,10 @@ echo StrictHostKeyChecking=no | ssh root@$1 'sudo -u postgres cat > /var/lib/pgs
 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
index 18fa820..ae71391 100755 (executable)
@@ -27,24 +27,3 @@ ssh root@10.200.1.61 sh -xe /tmp/2.sh
 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
-
diff --git a/t/2-init-pgpool.sh b/t/2-init-pgpool.sh
new file mode 100755 (executable)
index 0000000..e8a1431
--- /dev/null
@@ -0,0 +1,10 @@
+#!/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
+
diff --git a/t/3-test.sh b/t/3-test.sh
new file mode 100755 (executable)
index 0000000..fb45fb8
--- /dev/null
@@ -0,0 +1,17 @@
+#!/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
+