2015-04-02 35 views
0

我已經成功設置了兩個節點(主設備& Satndby)。 我的版本是repmgr 2.0(9.3.6的PostgreSQL)自動故障切換器不能在repmgr中工作

待機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 

萬事達待機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' 

當我停止備用節點( Postgressql服務),我得到了以下repmgrd日誌文件:

[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! 

不執行腳本......請幫我...

+0

我需要包括shared_preload_libraries =在自動故障轉移postgressql.conf文件「repmgr_funcs」。 – Rajiv 2015-04-02 16:21:03

回答

0

爲了執行腳本,你需要爲故障轉移纔會發生停止主節點,而不是備用節點,如果主節點下跌降落。

同樣在您的postgresql配置文件/etc/postgresql/9.3/main/postgresql.conf中添加shared_preload_libraries = 'repmgr_funcs'

而在你/etc/repmgr/repmgr.conf文件中添加這些行,以及:

promote_command='repmgr standby promote -f /etc/repmgr/repmgr.conf' 
follow_command='repmgr standby follow -f /etc/repmgr/repmgr.conf' 

要格外肯定的是,檢查是否repmgrd實際上是由exectuing ps aux | grep -i rep運行。

希望它能幫助,
最好的問候