Reputation: 602
I had successfully setup the two nodes (Master & Satndby). My version is repmgr 2.0 (PostgreSQL 9.3.6)
standby repmgr.conf
cluster=test
node=2
node_name=node2
conninfo='host=192.168.1.218 user=repmgr_usr dbname=repmgr_db'
pg_bindir='/usr/lib/postgresql/9.3/bin'
master_response_timeout=30
reconnect_attempts=2
reconnect_interval=10
failover=automatic
Master standby repmgr.conf
cluster=test
node=1
node_name=master
conninfo='host=192.168.1.205 user=repmgr_usr dbname=repmgr_db'
pg_bindir=/usr/lib/postgresql/9.3/bin
master_response_timeout=30
reconnect_attempts=2
reconnect_interval=10
failover=automatic
promote_command='/etc/repmgr/auto_failover.sh'
When i stop the Standby node (Postgressql service), I got the following repmgrd log file:
[WARNING] repmgrd: Connection to standby has been lost, trying to recover... 20 seconds before failover decision
[2015-04-02 20:47:43] [WARNING] repmgrd: Connection to standby has been lost, trying to recover... 10 seconds before failover decision
[2015-04-02 20:47:53] [ERROR] repmgrd: We couldn't reconnect for long enough, exiting...
[2015-04-02 20:47:53] [ERROR] Failed to connect to local node, exiting!
Not executing the scripts...Please help me...
Upvotes: 1
Views: 3090
Reputation:
In order to execute the scripts, you need to stop the master node and not the standby node as the failover will only occur if the master node goes down.
Also in your postgresql configuration file /etc/postgresql/9.3/main/postgresql.conf
add shared_preload_libraries = 'repmgr_funcs'
.
And in your /etc/repmgr/repmgr.conf
file add these lines as well:
promote_command='repmgr standby promote -f /etc/repmgr/repmgr.conf'
follow_command='repmgr standby follow -f /etc/repmgr/repmgr.conf'
To be extra sure, check if repmgrd
is actually running by exectuing ps aux | grep -i rep
.
Hope it help,
Best regards
Upvotes: 1