我已经成功地设置了两个节点(Master & Satndby)。我的版本是repmgr2.0 (PostgreSQL 9.3.6)
备用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! 不执行scripts...Please帮助我..。
发布于 2015-08-27 21:10:00
为了执行脚本,您需要停止主节点,而不是备用节点,因为只有当主节点关闭时,故障转移才会发生。
同样在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是否真的是通过执行ps aux | grep -i rep运行的。
希望能帮上忙
诚挚的问候
https://stackoverflow.com/questions/29416779
复制相似问题