repmgr-参数说明

举报
snowofsummer 发表于 2021/12/29 10:58:25 2021/12/29
【摘要】  本文中主要介绍了repmgr相关配置参数的解析。failover='automatic'failover的参数有两个,manual代表手动,automatic代表自动promote_command='/usr/pgsql-12/bin/repmgr standby promote -f /etc/repmgr/12/repmgr.conf --log-to-file'此参数告诉repmgr...

 本文中主要介绍了repmgr相关配置参数的解析。

failover='automatic'
failover的参数有两个,manual代表手动,automatic代表自动

promote_command='/usr/pgsql-12/bin/repmgr standby promote -f /etc/repmgr/12/repmgr.conf --log-to-file'
此参数告诉repmgr守护程序应该运行什么命令来提升备用数据库
follow_command ='/ usr / pgsql-12 / bin / repmgr Standby Follow -f /etc/repmgr/12/repmgr.conf --log-to-file --upstream-node-id =%n'
这是repmgr守护程序的第三个必需参数。此参数告诉备用节点遵循新的主节点。repmgr守护程序在运行时将%n占位符替换为新主节点的节点ID
priority=60
权重,在选举主机过程中,权重高的备机具有升主的更高优先级,如果权重为0,则该备机永远不会升级为主机
monitor_interval_secs = 2
此参数告诉repmgr守护程序应该多久(以秒为单位)检查上游节点的可用性。默认2s检查一次。
connection_check_type ='ping'
用什么方式联系上游节点。此参数可以采用三个值:默认为ping
  • ping: repmgr uses the PQPing() method
  • connection: repmgr tries to create a new connection to the upstream node
  • query: repmgr tries to run a SQL query on the upstream node using the existing connection
reconnect_attempts = 4
reconnect_interval = 8
当主节点不可用时,备用节点中的repmgr守护程序将尝试重新连接到主节点达reconnect_attempts次。此参数的默认值为6。在每次重新连接尝试之间,它将等待reconnect_interval秒,默认值为10。
primary_visibility_consensus = true
当主节点在多节点群集中不可用时,备用节点可以相互协商以建立有关故障转移的仲裁。这是通过询问每个备用数据库上次看到主数据库的时间来完成的。如果节点的最后一次通信是最近的,并且晚于本地节点看到主节点的时间,则本地节点会假定主节点仍然可用,并且不会继续执行故障转移决定。 
standby_disconnect_on_failover = true
在备用节点中将standby_disconnect_on_failover参数设置为“ true”时,repmgr守护程序将确保其WAL接收者与主节点断开连接并且不接收任何WAL段。在做出故障转移决定之前,它还将等待其他备用节点的WAL接收器停止。在每个节点中,此参数应设置为相同的值。
将此参数设置为true意味着在发生故障转移时,每个备用节点都已停止从主节点接收数据。该过程将有5秒钟的延迟加上WAL接收器在做出故障转移决定之前停止所花费的时间。默认情况下,repmgr守护程序将等待30秒以确认所有同级节点在故障转移发生之前已停止接收WAL段。
 
repmgrd_service_start_command ='sudo / usr / bin / systemctl start repmgr12.service'
repmgrd_service_stop_command ='sudo / usr / bin / systemctl stop repmgr12.service'
###############
#启动repmgrd(repmgr daemon start)
repmgrd_service_start_command=’> /data/repmgr/repmgrd.pid && /opt/pgsql/pg133/bin/repmgrd -f /etc/repmgr/repmgr.conf -d -p /data/repmgr/repmgrd.pid’
#停止repmfrd(repmgr daemon stop)
repmgrd_service_stop_command=’kill -9 cat /data/repmgr/repmgrd.pid
这两个参数指定如何使用“ repmgr守护程序启动”和“ repmgr守护程序停止”命令启动和停止repmgr守护程序。

 

【版权声明】本文为华为云社区用户原创内容,转载时必须标注文章的来源(华为云社区)、文章链接、文章作者等基本信息, 否则作者和本社区有权追究责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@huaweicloud.com
  • 点赞
  • 收藏
  • 关注作者

评论(0

0/1000
抱歉,系统识别当前为高风险访问,暂不支持该操作

全部回复

上滑加载中

设置昵称

在此一键设置昵称,即可参与社区互动!

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。