本文介绍: 具体原因目前没有明确解释,估计是repmgr或pg对这个参数有个超时或者时间检查之类的机制。刚搭建好的repmgr主从使用命令手动进行切换失败,日志如下。postgresql.conf中有这样一个内容。,导致repmgr切换失败。再次手动执行主从切换成功。
repmgr:5.4.0
pgsql: 14.2
OS:centos7.8
刚搭建好的repmgr主从使用命令手动进行切换失败,日志如下
postgres@db02:~$ repmgr standby switchover
NOTICE: executing switchover on node "db02" (ID: 2)
NOTICE: local node "db02" (ID: 2) will be promoted to primary; current primary "db01" (ID: 1) will be demoted to standby
NOTICE: stopping current primary node "db01" (ID: 1)
NOTICE: issuing CHECKPOINT on node "db01" (ID: 1)
DETAIL: executing server command "/usr/lib/postgresql/14/bin/pg_ctl -D /var/lib/postgresql/14/main -W -m fast stop"
INFO: checking for primary shutdown; 1 of 60 attempts ("shutdown_check_timeout")
INFO: checking for primary shutdown; 2 of 60 attempts ("shutdown_check_timeout")
NOTICE: current primary has been cleanly shut down at location 0/4000016
NOTICE: waiting up to 30 seconds (parameter "wal_receive_check_timeout") for received WAL to flush to disk
INFO: sleeping 1 of maximum 30 seconds waiting for standby to flush received WAL to disk
INFO: sleeping 2 of maximum 30 seconds waiting for standby to flush received WAL to disk
INFO: sleeping 3 of maximum 30 seconds waiting for standby to flush received WAL to disk
[...]
INFO: sleeping 29 of maximum 30 seconds waiting for standby to flush received WAL to disk
INFO: sleeping 30 of maximum 30 seconds waiting for standby to flush received WAL to disk
WARNING: local node "db02" is behind shutdown primary "db01"
DETAIL: local node last receive LSN is 0/3D02000, primary shutdown checkpoint LSN is 0/4000016
NOTICE: aborting switchover
HINT: use --always-promote to force promotion of standby
postgresql.conf中有这样一个内容
archive_mode = on
#因为使用了repmgr,所以不需要归档,这里设置为true,禁用归档
archive_command = '/bin/true'
通过查询发现,正是archive_command
这里使用了'/bin/true'
,导致repmgr切换失败
将命令改为
archive_command = '{ sleep 5; true; }'
具体原因目前没有明确解释,估计是repmgr或pg对这个参数有个超时或者时间检查之类的机制
原文地址:https://blog.csdn.net/mayifan0/article/details/134783155
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如若转载,请注明出处:http://www.7code.cn/show_39638.html
如若内容造成侵权/违法违规/事实不符,请联系代码007邮箱:suwngjj01@126.com进行投诉反馈,一经查实,立即删除!
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。