记录一次Postgresql的repmgr高可用集群切换故障
16lz
2021-02-23
故障代码如下
postgres@allsql02->repmgr standby switchover -f ~/repmgr.conf --siblings-follow DEBUG: connecting to: "user=repmgr password=QAZwsx123_ connect_timeout=2 dbname=repmgr host=10.10.10.12 port=5432 fallback_application_name=repmgr"NOTICE: executing switchover on node "allSql02" (ID: 238)DEBUG: connecting to: "user=repmgr password=QAZwsx123_ connect_timeout=2 dbname=repmgr host=10.10.10.11 port=5432 fallback_application_name=repmgr"DEBUG: remote_command(): ssh -o Batchmode=yes -q -o ConnectTimeout=10 10.10.10.11 /usr/pgsql/bin/repmgr -f /home/postgres/repmgr.conf --version >/dev/null 2>&1 && echo "1" || echo "0"DEBUG: remote_command(): ssh -o Batchmode=yes -q -o ConnectTimeout=10 10.10.10.11 /usr/pgsql/bin/repmgr -f /home/postgres/repmgr.conf --version 2>/dev/nullDEBUG: "repmgr" version on "10.10.10.11" is 50100DEBUG: remote_command(): ssh -o Batchmode=yes -q -o ConnectTimeout=10 10.10.10.11 test -f /home/postgres/repmgr.conf && echo 1 || echo 0DEBUG: remote_command(): ssh -o Batchmode=yes -q -o ConnectTimeout=10 10.10.10.11 /usr/pgsql/bin/repmgr -f /home/postgres/repmgr.conf node check --data-directory-config --optformat -LINFO 2>/dev/nullWARNING: option "--sibling-nodes" specified, but no sibling nodes existDEBUG: remote_command(): ssh -o Batchmode=yes -q -o ConnectTimeout=10 10.10.10.11 /usr/pgsql/bin/repmgr -f /home/postgres/repmgr.conf node check --remote-node-id=238 --replication-connectionDEBUG: connecting to: "user=repmgr password=QAZwsx123_ connect_timeout=2 dbname=repmgr host=10.10.10.11 port=5432 fallback_application_name=repmgr"DEBUG: remote_command(): ssh -o Batchmode=yes -q -o ConnectTimeout=10 10.10.10.11 /usr/pgsql/bin/repmgr -f /home/postgres/repmgr.conf node check --terse -LERROR --archive-ready --optformatDEBUG: lag is 0 DEBUG: connecting to: "user=repmgr password=QAZwsx123_ connect_timeout=2 dbname=repmgr host=10.10.10.11 port=5432 fallback_application_name=repmgr"DEBUG: connecting to: "user=repmgr password=QAZwsx123_ connect_timeout=2 dbname=repmgr host=10.10.10.12 port=5432 fallback_application_name=repmgr"NOTICE: local node "allSql02" (ID: 238) will be promoted to primary; current primary "allSql01" (ID: 237) will be demoted to standbyNOTICE: stopping current primary node "allSql01" (ID: 237)DEBUG: remote_command(): ssh -o Batchmode=yes -q -o ConnectTimeout=10 10.10.10.11 /usr/pgsql/bin/repmgr -f /home/postgres/repmgr.conf node service --action=stop --checkpointDEBUG: connecting to: "user=repmgr password=QAZwsx123_ connect_timeout=2 dbname=repmgr host=10.10.10.11 port=5432 fallback_application_name=repmgr"NOTICE: issuing CHECKPOINT on node "allSql01" (ID: 237) DETAIL: executing server command "/usr/pgsql/bin/pg_ctl -D '/data/pgdata/11/data' -W -m fast stop"INFO: checking for primary shutdown; 1 of 60 attempts ("shutdown_check_timeout")DEBUG: ping status is: PQPING_REJECTDEBUG: sleeping 1 second until next checkINFO: checking for primary shutdown; 2 of 60 attempts ("shutdown_check_timeout")DEBUG: ping status is: PQPING_NO_RESPONSEDEBUG: remote_command(): ssh -o Batchmode=yes -q -o ConnectTimeout=10 10.10.10.11 /usr/pgsql/bin/repmgr -f /home/postgres/repmgr.conf node status --is-shutdown-cleanlyNOTICE: current primary has been cleanly shut down at location 0/F000028NOTICE: waiting up to 30 seconds (parameter "wal_receive_check_timeout") for received WAL to flush to diskINFO: sleeping 1 of maximum 30 seconds waiting for standby to flush received WAL to diskINFO: sleeping 2 of maximum 30 seconds waiting for standby to flush received WAL to diskINFO: sleeping 3 of maximum 30 seconds waiting for standby to flush received WAL to diskINFO: sleeping 4 of maximum 30 seconds waiting for standby to flush received WAL to diskINFO: sleeping 5 of maximum 30 seconds waiting for standby to flush received WAL to diskINFO: sleeping 6 of maximum 30 seconds waiting for standby to flush received WAL to diskINFO: sleeping 7 of maximum 30 seconds waiting for standby to flush received WAL to diskINFO: sleeping 8 of maximum 30 seconds waiting for standby to flush received WAL to diskINFO: sleeping 9 of maximum 30 seconds waiting for standby to flush received WAL to diskINFO: sleeping 10 of maximum 30 seconds waiting for standby to flush received WAL to diskINFO: sleeping 11 of maximum 30 seconds waiting for standby to flush received WAL to diskINFO: sleeping 12 of maximum 30 seconds waiting for standby to flush received WAL to diskINFO: sleeping 13 of maximum 30 seconds waiting for standby to flush received WAL to diskINFO: sleeping 14 of maximum 30 seconds waiting for standby to flush received WAL to diskINFO: sleeping 15 of maximum 30 seconds waiting for standby to flush received WAL to diskINFO: sleeping 16 of maximum 30 seconds waiting for standby to flush received WAL to diskINFO: sleeping 17 of maximum 30 seconds waiting for standby to flush received WAL to diskINFO: sleeping 18 of maximum 30 seconds waiting for standby to flush received WAL to diskINFO: sleeping 19 of maximum 30 seconds waiting for standby to flush received WAL to diskINFO: sleeping 20 of maximum 30 seconds waiting for standby to flush received WAL to diskINFO: sleeping 21 of maximum 30 seconds waiting for standby to flush received WAL to diskINFO: sleeping 22 of maximum 30 seconds waiting for standby to flush received WAL to diskINFO: sleeping 23 of maximum 30 seconds waiting for standby to flush received WAL to diskINFO: sleeping 24 of maximum 30 seconds waiting for standby to flush received WAL to diskINFO: sleeping 25 of maximum 30 seconds waiting for standby to flush received WAL to diskINFO: sleeping 26 of maximum 30 seconds waiting for standby to flush received WAL to diskINFO: sleeping 27 of maximum 30 seconds waiting for standby to flush received WAL to diskINFO: sleeping 28 of maximum 30 seconds waiting for standby to flush received WAL to diskINFO: sleeping 29 of maximum 30 seconds waiting for standby to flush received WAL to diskINFO: sleeping 30 of maximum 30 seconds waiting for standby to flush received WAL to diskWARNING: local node "allSql02" is behind shutdown primary "allSql01"DETAIL: local node last receive LSN is 0/E086000, primary shutdown checkpoint LSN is 0/F000028NOTICE: aborting switchoverHINT: use --always-promote to force promotion of standby
发现并没有切换成功:同时1节点发生宕机,二节点没切换回来
一节点:
postgres@allsql01->repmgr -f ~/repmgr.conf cluster showDEBUG: connecting to: "user=repmgr password=QAZwsx123_ connect_timeout=2 dbname=repmgr host=10.10.10.11 port=5432 fallback_application_name=repmgr"ERROR: connection to database failedDETAIL: could not connect to server: Connection refused Is the server running on host "10.10.10.11" and accepting TCP/IP connections on port 5432?DETAIL: attempted to connect using: user=repmgr password=QAZwsx123_ connect_timeout=2 dbname=repmgr host=10.10.10.11 port=5432 fallback_application_name=repmgrpostgres@allsql01->pg_ctl -D /data/pgdata/11/data -l logfile startwaiting for server to start.... doneserver started
并没有发生切换。
修改参数:
主从节点修改
shutdown_check_timeout =100 然后postgresql重启
HINT: use --always-promote to force promotion of standby报错解决
参考:https://github.com/2ndQuadrant/repmgr/issues/518
©著作权归作者所有:来自51CTO博客作者李石岩的原创作品,如需转载,请注明出处,否则将追究法律责任更多相关文章
- K8S 之 通过kubeadmin安装K8S集群
- Windows 遍历查找文件夹文件
- 几种Linux系统切换内核启动顺序方法
- 二进制部署K8s集群第25节之k8s技术点整理
- Centos7安装GreenPlum6.14 集群
- Centos7安装GreenPlum6.14 集群实战
- GreenPlum集群给主节点安装备节点
- 2021-2-16:请问你知道分布式设计模式中的Quorum思想么?
- 【我的Linux,我做主!】kubernetes基础概念