暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

[postgresql] repmgr集群 状态显示 - node "node*" (ID: %n) is not attached to its upstream node

原创 手机用户0512 2023-05-28
730

postgrsql数据库repmgr集群的搭建部署后,查看发现集群状态有告警:

[pg12@node2 ~]$ repmgr cluster show -f /home/pg12/conf/repmgr.conf ID | Name | Role | Status | Upstream | Location | Priority | Timeline | Connection string ----+-------+---------+-----------+----------+----------+----------+----------+---------------------------------------------------------------- 1 | node1 | primary | * running | | default | 100 | 1 | host=192.168.5.101 user=repmgr dbname=repmgr connect_timeout=2 2 | node2 | standby | running | ! node1 | default | 100 | 1 | host=192.168.5.102 user=repmgr dbname=repmgr connect_timeout=2 WARNING: following issues were detected - node "node2" (ID: 2) is not attached to its upstream node "node1" (ID: 1)
复制

根据集群信息可知主备节点都正在运行(running), 现在状态是未跟随(not attached to its upstream node)主节点.

这种情况,可尝试手动执行repmgr standby follow 实现跟随。

[pg12@node2 ~]$ repmgr standby follow -f /home/pg12/conf/repmgr.conf NOTICE: attempting to find and follow current primary INFO: timelines are same, this server is not ahead DETAIL: local node lsn is 0/B0007F0, follow target lsn is 0/B0007F0 NOTICE: setting node 2's upstream to node 1 NOTICE: stopping server using "/home/pg12/soft/bin/pg_ctl -D '/home/pg12/data' -w -m fast stop" NOTICE: starting server using "/home/pg12/soft/bin/pg_ctl -w -D '/home/pg12/data' start" NOTICE: STANDBY FOLLOW successful DETAIL: standby attached to upstream node "node1" (ID: 1)
复制

再次查看集群信息, 可知已经正常:

[pg12@node2 ~]$ repmgr cluster show -f /home/pg12/conf/repmgr.conf ID | Name | Role | Status | Upstream | Location | Priority | Timeline | Connection string ----+-------+---------+-----------+----------+----------+----------+----------+---------------------------------------------------------------- 1 | node1 | primary | * running | | default | 100 | 1 | host=192.168.5.101 user=repmgr dbname=repmgr connect_timeout=2 2 | node2 | standby | running | node1 | default | 100 | 1 | host=192.168.5.102 user=repmgr dbname=repmgr connect_timeout=2
复制
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论