repmgr无法自动故障转移

news/2024/7/9 20:44:57 标签: 数据库, repmgr, postgresql

 停掉主节点,让备节点自动接管

[postgres@db223 ~]$ repmgr -f ~/repmgr/repmgr.conf  cluster show
 ID | Name  | Role    | Status    | Upstream | Location | Priority | Timeline | Connection string
----+-------+---------+-----------+----------+----------+----------+----------+------------------------------------------------------------------------
 1  | db223 | primary | * running |          | default  | 100      | 15       | host=db223 dbname=repmgr user=repmgr password=repmgr connect_timeout=2
 2  | db206 | primary | - failed  | ?        | default  | 100      |          | host=db206 dbname=repmgr user=repmgr password=repmgr connect_timeout=2

WARNING: following issues were detected
  - unable to connect to node "db206" (ID: 2)

HINT: execute with --verbose option to see connection error messages

 

 旧主重新加入集群

[postgres@db206 data]$ repmgr -f ~/repmgr/repmgr.conf node rejoin -d 'host=db223 port=5432 user=repmgr dbname=repmgr password=repmgr' --force-rewind
NOTICE: rejoin target is node "db223" (ID: 1)
NOTICE: pg_rewind execution required for this node to attach to rejoin target node 1
DETAIL: rejoin target server's timeline 15 forked off current database system timeline 14 before current recovery point 120/9B171E00
NOTICE: executing pg_rewind
DETAIL: pg_rewind command is "/home/postgres/pg14/bin/pg_rewind -D '/home/postgres/pg14/data' --source-server='host=db223 dbname=repmgr user=repmgr password=repmgr connect_timeout=2'"
NOTICE: 0 files copied to /home/postgres/pg14/data
NOTICE: setting node 2's upstream to node 1
WARNING: unable to ping "host=db206 dbname=repmgr user=repmgr password=repmgr connect_timeout=2"
DETAIL: PQping() returned "PQPING_NO_RESPONSE"
NOTICE: starting server using "/home/postgres/pg14/bin/pg_ctl  -w -D '/home/postgres/pg14/data' start"
NOTICE: NODE REJOIN successful
DETAIL: node 2 is now attached to node 1

 

 怎么着都无法自动故障转移,没有别的办法,做了个重做备机好了,好了(????)

[postgres@db206 data]$ repmgr -h db223  -U repmgr -d repmgr -f /home/postgres/repmgr/repmgr.conf standby clone
NOTICE: destination directory "/home/postgres/pg14/data" provided
INFO: connecting to source node
DETAIL: connection string is: host=db223 user=repmgr dbname=repmgr
DETAIL: current installation size is 1752 MB
INFO: replication slot usage not requested;  no replication slot will be set up for this standby
NOTICE: checking for available walsenders on the source node (2 required)
NOTICE: checking replication connections can be made to the source server (2 required)
INFO: checking and correcting permissions on existing directory "/home/postgres/pg14/data"
NOTICE: starting backup (using pg_basebackup)...
HINT: this may take some time; consider using the -c/--fast-checkpoint option
INFO: executing:
  /home/postgres/pg14/bin/pg_basebackup -l "repmgr base backup"  -D /home/postgres/pg14/data -h db223 -p 5432 -U repmgr -X stream
NOTICE: standby clone (using pg_basebackup) complete
NOTICE: you can now start your PostgreSQL server
HINT: for example: pg_ctl -D /home/postgres/pg14/data start
HINT: after starting the server, you need to re-register this standby with "repmgr standby register --force" to update the existing node record


[postgres@db206 data]$ pg_ctl start
waiting for server to start....2023-08-18 21:25:12.514 CST [11178] LOG:  redirecting log output to logging collector process
2023-08-18 21:25:12.514 CST [11178] HINT:  Future log output will appear in directory "log".
 done
server started


[postgres@db206 data]$ repmgr -f ~/repmgr/repmgr.conf standby register -F
INFO: connecting to local node "db206" (ID: 2)
INFO: connecting to primary database
INFO: standby registration complete
NOTICE: standby node "db206" (ID: 2) successfully registered
[postgres@db206 data]$ repmgr -f ~/repmgr/repmgr.conf cluster show
 


http://www.niftyadmin.cn/n/4950621.html

相关文章

线性代数3,什么是向量 向量空间(草稿,建设ing)

列向量 行向量 4 什么是向量空间,向量的张成空间 域,组等概念 空间 向量空间 张成空间 6 线性代数 普通代数,是以单个的数为研究对象的数学 线性代数本质是以数组(数组/向量:多个数为整体)为基本对象的…

webpack 和 ts 简单配置及使用

如何使用webpack 与 ts结合使用 新建项目 ,执行项目初始化 npm init -y会生成 {"name": "tsdemo01","version": "1.0.0","description": "","main": "index.js","scripts&…

Jmeter对websocket进行测试

JMeterWebSocketSampler-1.0.2-SNAPSHOT.jar下载 公司使用websocket比较奇怪,需要带认证信息进行长连接,通过websocket插件是请求失败,如下图,后面通过代码实现随再打包jar包完成websocket测试 本地实现代码如下: pa…

SENet网络分析

文章目录 注意力机制:AttentionBiased Competition Theorybottom-up和top-down注意力 SE BlockSqueeze操作Excitation操作scale操作与原结构合并计算复杂度评估 实验与其他网络对比数据集实验内部参数对比实验进一步评估Squeezeexcitation Squuze-and-Excitation网络…

区块链中slot、epoch、以及在slot和epoch中的出块机制,分叉原理(自己备用)

以太坊2.0中有两个时间概念:时隙槽slot 和 时段(周期)epoch。其中一个slot为12秒,而每个 epoch 由 32 个 slots 组成,所以每个epoch共384秒,也就是 6.4 分钟。 对于每个epoch,使用RANDAO伪随机…

【LeetCode75】第三十三题 二叉树的最大深度

目录 题目: 示例: 分析: 代码: 题目: 示例: 分析: 从这一题开始,LeetCode75进入到了二叉树章节。 这边建议不熟悉二叉树的小伙伴可以先去做做力扣的前序遍历,中序遍…

GNN学习笔记

GNN b站课程跳转------->>>>> 【不愧是公认最好的【图神经网络GNN/GCN教程】,从基础到进阶再到实战,一个合集全部到位!-人工智能/神经网络/图神经网络/深度学习。】 https://www.bilibili.com/video/BV1184y1x71H/?share_so…

前端面试:【JavaScript】深入解析数据类型

嗨,亲爱的代码探险家!今天,我们将一起踏上JavaScript的奇幻旅程,探索它那五彩斑斓的数据类型。就像一本神秘的魔法书,数据类型是编程世界中的基石,让我们来揭开其中的秘密吧! 1. 数字&#xff0…