日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 >

postgresql 高可用 repmgr 的使用之十 1 Primary + 2 Standby 的 auto failover 之后失败节点 rejoin

發布時間:2023/12/13 45 生活家
生活随笔 收集整理的這篇文章主要介紹了 postgresql 高可用 repmgr 的使用之十 1 Primary + 2 Standby 的 auto failover 之后失败节点 rejoin 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

os:ubunbu 16.04
postgresql:9.6.8
repmgr:4.1.1

192.168.56.101 node1
192.168.56.102 node2
192.168.56.103 node3

手動 rejoin

$ sudo pg_ctlcluster 9.6 main stop

$ repmgr -f /etc/repmgr.conf node rejoin -d 'host=192.168.56.103 user=repmgr dbname=repmgr connect_timeout=2' --force-rewind --dry-run --verbose
$ repmgr -f /etc/repmgr.conf node rejoin -d 'host=192.168.56.103 user=repmgr dbname=repmgr connect_timeout=2' --force-rewind --verbose

中間出錯或者搞不定的話,就重新做一次 standby clone。
數據庫大、網絡帶寬、IO不行的話,時間比較長。

$ cd /var/lib/postgresql/9.6/main
$ rm -rf ./*

$ repmgr -h 192.168.56.103 -U repmgr -d repmgr -f /etc/repmgr.conf standby clone --dry-run --verbose
$ repmgr -h 192.168.56.103 -U repmgr -d repmgr -f /etc/repmgr.conf standby clone --verbose

$ sudo pg_ctlcluster 9.6 main start

$ repmgr -f /etc/repmgr.conf standby register --upstream-node-id=3 --force --verbose

最后一步 standby register 時的 --upstream-node-id,設置為當前真實的master。

查看cluster

$ repmgr -f /etc/repmgr.conf cluster show

自動 rejoin

還不知道怎么自動rejoin,有路過哥們知道的話,指點下。

參考:
https://repmgr.org
https://repmgr.org/docs/4.1

總結

以上是生活随笔為你收集整理的postgresql 高可用 repmgr 的使用之十 1 Primary + 2 Standby 的 auto failover 之后失败节点 rejoin的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。