datadir_source = /data/kingbase/r6ha/datasys_rewind: fetched file "global/sys_control", length 8192sys_rewind: fetched file "sys_wal/0000001C.history", length 1174
2) 读取目标和源库的文件寻找分叉点()
文章插图
sys_rewind: Source timeline history:sys_rewind: Target timeline history:sys_rewind: 1: 0/0 - 0/690000A0sys_rewind: 2: 0/690000A0 - 0/6A0000A0.......sys_rewind: 23: 3/320000A0 - 4/4B0000A0sys_rewind: 24: 4/4B0000A0 - 4/4D0000A0sys_rewind: 25: 4/4D0000A0 - 4/51001D00sys_rewind: 26: 4/51001D00 - 4/520000A0sys_rewind: 27: 4/520000A0 - 4/630000A0sys_rewind: 29: 4/630000A0 - 0/0sys_rewind: servers diverged at WAL location 4/540000A0 on timeline 27sys_rewind: for record '27/4/54000028', remote hash is '0'sys_rewind: for record '27/4/53000C20', local hash is '3038469505' and remote hash is '3038469505'sys_rewind: rewinding from last common checkpoint at 4/53000C20 on timeline 27sys_rewind: find last common checkpoint start time from 2022-09-13 14:18:54.005053 CST to 2022-09-13 14:18:54.123611 CST, in "0.118558" seconds.
3)拷贝源库数据文件和变化的页块到目标库
sys_rewind: backup_label.old (COPY)sys_rewind: base/1/1247_fsm (COPY)sys_rewind: base/1/1247_vm (COPY).......sys_rewind: received chunk for file "base/32955/189163", offset 4325376, size 32768sys_rewind: received chunk for file "base/32955/189163", offset 4358144, size 32768sys_rewind: received chunk for file "base/32955/189163", offset 4390912, size 32768sys_rewind: received chunk for file "base/32955/2619", offset 262144, size 32768
4)应用后wal日志并更新目标库
sys_rewind: update the control file: minRecoveryPoint is '4/56E13200', minRecoveryPointTLI is '28', and database state is 'in archive recovery'sys_rewind: we will remove the dir '/data/kingbase/r6ha/data/sys_replslot/repmgr_slot_2.rewind' and all the file/dir in it.sys_rewind: rewind start wal location 4/53000BF0 (file 0000001B0000000400000053), end wal location 4/56E13200 (file 0000001C0000000400000056). time from 2022-09-13 14:18:54.005053 CST to 2022-09-13 14:19:05.426387 CST, in "11.421334" seconds.sys_rewind: Done!
三、将新备库(目标库)加入到集群
1、在目标库创建.文件[@ bin]$ touch /data//r6ha/data/.
2、启动目标库数据库服务[@ bin]$ ./ start -D /data//r6ha/data/
3、注册备库节点
[kingbase@node101 bin]$ ./repmgr standby register --forceINFO: connecting to local node "node101" (ID: 1)DEBUG: connecting to: "user=system connect_timeout=10 dbname=esrep host=192.168.1.101 port=54321 keepalives=1 keepalives_idle=10 keepalives_interval=1 keepalives_count=3 fallback_application_name=repmgr"INFO: connecting to primary databaseDEBUG: connecting to: "user=system connect_timeout=10 dbname=esrep host=192.168.1.102 port=54321 keepalives=1 keepalives_idle=10 keepalives_interval=1 keepalives_count=3 fallback_application_name=repmgr"DEBUG: remote_command():ssh -o Batchmode=yes -q -o ConnectTimeout=10 -o StrictHostKeyChecking=no -o ServerAliveInterval=2 -o ServerAliveCountMax=5 -p 22 192.168.1.102 /home/kingbase/cluster/R6HA/kha/kingbase/bin/kbha -A updateinfoINFO: standby registration completeNOTICE: standby node "node101" (ID: 1) successfully registered
4、查看集群节点状态信息
[kingbase@node101 bin]$ ./repmgr cluster showID | Name| Role| Status| Upstream | Location | Priority | Timeline | Connection string----+---------+---------+-----------+----------+----------+----------+----------+----------------------------------------------------------------------------------------------------------------------------------------------------1| node101 | standby |running | node102| default| 100| 28| host=192.168.1.101 user=system dbname=esrep port=54321 connect_timeout=10 keepalives=1 keepalives_idle=10 keepalives_interval=1 keepalives_count=32| node102 | primary | * running || default| 100| 28| host=192.168.1.102 user=system dbname=esrep port=54321 connect_timeout=10 keepalives=1 keepalives_idle=10 keepalives_interval=1 keepalives_count=3---如上所示,集群节点恢复完成 。