【问题标题】:Auto FailOver not working in repmgr自动故障转移在 repmgr 中不起作用
【发布时间】:2015-04-02 15:30:05
【问题描述】:

我已经成功设置了两个节点(Master 和 Satndby)。 我的版本是repmgr 2.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! 

不执行脚本...请帮助我...

【问题讨论】:

  • 我是否需要在 postgressql.conf 文件中包含 shared_preload_libraries = 'repmgr_funcs' 以进行自动故障转移。

标签: postgresql ubuntu repmgr


【解决方案1】:

为了执行脚本,您需要停止主节点而不是备用节点,因为只有在主节点出现故障时才会发生故障转移。

也在你的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'

为了更加确定,通过执行ps aux | grep -i rep 检查repmgrd 是否真的在运行。

希望对你有帮助,
最好的问候

【讨论】:

    猜你喜欢
    • 2018-07-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-01-29
    • 2020-03-09
    • 2014-01-21
    • 2011-12-09
    • 2018-07-12
    相关资源
    最近更新 更多