【发布时间】:2018-07-13 13:56:32
【问题描述】:
我有用于 HA 的 pgpool-II 和用于自动故障转移的 repmgr。 Pgpool-II 也可以运行故障转移 我只是想知道使用 pgpool 或 repmgr 进行自动故障转移?如果 pgpool 可以进行故障转移,我是否需要使用 repmgr?并使用shell脚本来推广新主?
【问题讨论】:
标签: postgresql pgpool repmgr automatic-failover
我有用于 HA 的 pgpool-II 和用于自动故障转移的 repmgr。 Pgpool-II 也可以运行故障转移 我只是想知道使用 pgpool 或 repmgr 进行自动故障转移?如果 pgpool 可以进行故障转移,我是否需要使用 repmgr?并使用shell脚本来推广新主?
【问题讨论】:
标签: postgresql pgpool repmgr automatic-failover
pgpool-II:连接池、负载平衡、自动故障转移、限制超出连接数
在 pgpool 中,虚拟 IP 是他们的应用程序连接到 VIP(pgpool. conf 文件上的一个 delegated_ip 参数)主服务器出现故障,然后发生故障转移,备用升级到主服务器(自动故障转移),然后应用程序端没有变化。failover_command 编写脚本然后在pgpool.conf 文件failover_command="" 参数上配置failover.sh 脚本位置
repmgr:复制和故障转移
在 Repmgr 中,如果主节点停止,它将在 xx 秒后进行故障转移(取决于 /etc/repmgr.conf 上的重新连接间隔 connect_timeout 参数
【讨论】:
我想通过 repmgrd 进行自动故障转移,并仅使用 pgpool 作为应用程序的入口点。它几乎可以工作:我已将 pgpool 配置文件中的 failover_command 设置为空字符串 ('')。当主数据库失败时,pgpool 执行 failover_command(因为 failover_command 为空,它什么也不做),然后它会反复尝试寻找新的 master。当 repmgrd 完成故障转移后,pgpool 看到新的 master 就可以了。
如果主服务器停止,remgrd 将在 x 秒后进行故障转移(取决于重新连接间隔和尝试参数)。您必须确保 pgpool 中指定的健康检查间隔大于该间隔,否则 pgpool 将过早分离停止的数据库:参数是 health_chek_max_retries 和 health_check_retry_delay(还有 health_check_period 不清楚)。您还必须将 failover_on_backend_error 设置为 no。
虽然我对这个设置不是很有信心,但我仍然需要更深入地测试它。
【讨论】: