双中心容灾
更新时间:2024-07-01 14:39:43
双中心容灾
这里默认双中心的组网如下:
备中心的主节点实际是主中心主节点的异步备机。
停止主中心
停止主中心 adbhamgr(在所有节点上执行):
sudo systemctl stop adbhamgr
升级备中心
以下操作在任意一个节点执行即可。
- 查看升级前备中心状态,此时备中心的主机为 Standby Leader:
[antdb@localhost ~]$ adbhamgrctl -c /etc/adbhamgr/adbhamgr_antdbcluster.yaml list
+ Cluster: antdbcluster (7240007647780694395) ----+---------+----+-----------+
| Member | Host | Role | State | TL | Lag in MB |
+-----------+--------------------+----------------+---------+----+-----------+
| adbhamgr-1 | 10.1.206.202:55551 | Replica | running | 8 | 0 |
| adbhamgr-2 | 10.1.206.213:55551 | Standby Leader | running | 8 | |
| adbhamgr-3 | 10.1.206.226:55551 | Replica | running | 8 | 0 |
+-----------+--------------------+----------------+---------+----+-----------+
- 修改备中心的相关配置
使用 edit-config 命令删掉关于备中心(standby_cluster)的相关配置:
adbhamgrctl -c /etc/adbhamgr/adbhamgr_antdbcluster.yaml edit-config
loop_wait: 5
master_start_timeout: 300
maximum_lag_on_failover: 1048576
postgresql:
parameters:
hot_standby: 'on'
log_destination: csvlog
log_directory: pg_log
max_connections: 1600
max_locks_per_transaction: 256
max_prepared_transactions: 1600
max_wal_senders: 10
max_worker_processes: 32
wal_keep_size: 1024
wal_level: logical
use_pg_rewind: true
standby_cluster: # 删掉这一小节
create_replica_methods: # 删掉
- basebackup # 删掉
host: 10.21.10.211 # 删掉
port: 55551 # 删掉
primart_slot_name: adbhamgr # 删掉
retry_timeout: 5
synchronous_mode: true
synchronous_node_count: 1
ttl: 15
- 查看备中心,已经升级为新主中心,此时新主中心的主机为 Leader:
[antdb@localhost ~]$ adbhamgrctl -c /etc/adbhamgr/adbhamgr_antdbcluster.yaml list
+ Cluster: antdbcluster (7240007647780694395) --+---------+----+-----------+
| Member | Host | Role | State | TL | Lag in MB |
+-----------+--------------------+--------------+---------+----+-----------+
| adbhamgr-1 | 10.1.206.202:55551 | Sync Standby | running | 9 | 0 |
| adbhamgr-2 | 10.1.206.213:55551 | Leader | running | 9 | |
| adbhamgr-3 | 10.1.206.226:55551 | Replica | running | 9 | 0 |
+-----------+--------------------+--------------+---------+----+-----------+
问题反馈