working virtual IP for pgpool
authorDobrica Pavlinusic <dpavlin@rot13.org>
Tue, 29 Aug 2017 14:14:27 +0000 (16:14 +0200)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Tue, 29 Aug 2017 14:14:27 +0000 (16:14 +0200)
Makefile
README.md
pgpool.conf
t/2-init-pgpool.sh

index 7423358..6c62104 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -2,7 +2,7 @@ PRIMARY=$(shell ./t/99-primary-ip.sh)
 
 all:
        @echo "make push"
-       PAGER= psql -h 10.200.1.60 -c 'show pool_nodes' postgres postgres
+       PAGER= psql -h 10.200.1.60 -p 9999 -c 'show pool_nodes' postgres postgres
        PAGER= psql -h $(PRIMARY) -c 'SELECT * from pg_stat_replication' postgres postgres
 
 init:
@@ -50,9 +50,7 @@ push-pg:
 restart:
        #ssh root@10.200.1.61 systemctl restart postgresql-9.6
        #ssh root@10.200.1.62 systemctl restart postgresql-9.6
-       ssh root@10.200.1.61 rm /var/log/pgpool/pgpool_status
        ssh root@10.200.1.61 systemctl restart pgpool
-       ssh root@10.200.1.62 rm /var/log/pgpool/pgpool_status
        ssh root@10.200.1.62 systemctl restart pgpool
 
 status:
@@ -63,3 +61,12 @@ status:
 
 fix:
        ssh root@10.200.1.60 /etc/pgpool-II/online-recovery.sh
+
+clean:
+       ssh root@10.200.1.61 rm -Rfv /etc/pgpool-II/
+       ssh root@10.200.1.61 'yes | yum reinstall http://www.pgpool.net/yum/rpms/3.6/redhat/rhel-7-x86_64/pgpool-II-pg96-3.6.5-1pgdg.rhel7.x86_64.rpm'
+       ssh root@10.200.1.61 'systemctl enable pgpool'
+
+       ssh root@10.200.1.62 rm -Rfv /etc/pgpool-II/
+       ssh root@10.200.1.62 'yes | yum reinstall http://www.pgpool.net/yum/rpms/3.6/redhat/rhel-7-x86_64/pgpool-II-pg96-3.6.5-1pgdg.rhel7.x86_64.rpm'
+       ssh root@10.200.1.62 'systemctl enable pgpool'
index a5d4f23..7ad7512 100644 (file)
--- a/README.md
+++ b/README.md
@@ -5,7 +5,9 @@ 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 2 nodes:
+Hardware configuration is 2 nodes with 3 IP addresses:
+
+10.200.1.60 edozvola-db-pgpool <- virtual IP with pgpool listening on port 9999
 
 10.200.1.61 edozvola-db-01
 10.200.1.62 edozvola-db-02
index 2df4aa5..0edc7dc 100644 (file)
@@ -181,7 +181,6 @@ syslog_ident = 'pgpool'
 # - Debug -
 
 #log_error_verbosity = default          # terse, default, or verbose messages
-log_error_verbosity = verbose
 
 #client_min_messages = notice           # values in order of decreasing detail:
                                         #   debug5
@@ -470,7 +469,7 @@ use_watchdog = on
 
 # -Connection to up stream servers -
 
-trusted_servers = 'edozvola-db-01,edozvola-db-02'
+trusted_servers = ''
                                     # trusted server list which are used
                                     # to confirm network connection
                                     # (hostA,hostB,hostC,...)
@@ -504,7 +503,7 @@ wd_ipc_socket_dir = '/var/run/postgresql'
 
 # - Virtual IP control Setting -
 
-delegate_IP = '10.210.1.60'
+delegate_IP = '10.200.1.60'
                                     # delegate IP address
                                     # If this is empty, virtual IP never bring up.
                                     # (change requires restart)
@@ -520,7 +519,8 @@ if_down_cmd = 'ifconfig eth0:0 down'
 arping_path = '/etc/pgpool-II/sbin'
                                     # arping command path
                                     # (change requires restart)
-arping_cmd = 'arping -U $_IP_$ -w 1'
+arping_cmd = 'arping -U $_IP_$ -w 1 -I eth0'
+# XXX arping doesn't work without explicit interface!
                                     # arping command
                                     # (change requires restart)
 
@@ -544,7 +544,7 @@ wd_de_escalation_command = ''
 
 # -- common --
 
-wd_monitoring_interfaces_list = ''  # Comma separated list of interfaces names to monitor.
+wd_monitoring_interfaces_list = 'any'  # Comma separated list of interfaces names to monitor.
                                                                        # if any interface from the list is active the watchdog will
                                                                        # consider the network is fine
                                                                        # 'any' to enable monitoring on all interfaces except loopback
index 20c5e44..4d689ab 100755 (executable)
@@ -17,7 +17,7 @@ __SHELL__
 
        # must be at end
        ssh root@$1 rpm -q pgpool-II-pg96 && return
-       yes | ssh root@$1 yum install $2 http://www.pgpool.net/yum/rpms/3.6/redhat/rhel-7-x86_64/pgpool-II-pg96-3.6.5-1pgdg.rhel7.x86_64.rpm
+       yes | ssh root@$1 yum install http://www.pgpool.net/yum/rpms/3.6/redhat/rhel-7-x86_64/pgpool-II-pg96-3.6.5-1pgdg.rhel7.x86_64.rpm
 }
 
 install 10.200.1.61
@@ -35,5 +35,3 @@ make push-pgpool
 ssh root@10.200.1.61 systemctl restart pgpool
 ssh root@10.200.1.62 systemctl restart pgpool
 
-psql -h 10.200.1.61 -p 9999 -c 'show pool_nodes' postgres postgres
-