HGDB HAC集群导致时间线变化的操作演示

(1)停止所有节点的HAC
[root@db data]# systemctl stop hghac-vip
[root@db data]# /opt/HighGo/tools/hghac/hghactl -c /opt/HighGo/tools/hghac/hghac.yaml list
+ Cluster: ha (7072987311974756506) -----+---------+----+-----------+
| Member | Host                | Role    | State   | TL | Lag in MB |
+--------+---------------------+---------+---------+----+-----------+
| hghaca | 192.168.80.111:5866 | Replica | stopped |    |   unknown |
| hghacb | 192.168.80.112:5866 | Replica | stopped |    |   unknown |
| hghacc | 192.168.80.113:5866 | Replica | stopped |    |   unknown |
+--------+---------------------+---------+---------+----+-----------+
(2)启动节点1的HAC,此时时间线为26
[root@db data]# systemctl start hghac-vip
[root@db data]# /opt/HighGo/tools/hghac/hghactl -c /opt/HighGo/tools/hghac/hghac.yaml list
+ Cluster: ha (7072987311974756506) -----+---------+----+-----------+
| Member | Host                | Role    | State   | TL | Lag in MB |
+--------+---------------------+---------+---------+----+-----------+
| hghaca | 192.168.80.111:5866 | Leader  | running | 26 |           |
| hghacb | 192.168.80.112:5866 | Replica | stopped |    |   unknown |
| hghacc | 192.168.80.113:5866 | Replica | stopped |    |   unknown |
+--------+---------------------+---------+---------+----+-----------+
(3)启动节点2的HAC,此时节点1时间线发生变化为27,备节点时间线同步主节点的
[root@db data]# --此时启动节点2的HAC
bash: --此时启动节点2的HAC: command not found...
[root@db data]# /opt/HighGo/tools/hghac/hghactl -c /opt/HighGo/tools/hghac/hghac.yaml list
+ Cluster: ha (7072987311974756506) -----+---------+----+-----------+
| Member | Host                | Role    | State   | TL | Lag in MB |
+--------+---------------------+---------+---------+----+-----------+
| hghaca | 192.168.80.111:5866 | Leader  | running | 27 |           |
| hghacb | 192.168.80.112:5866 | Replica | running | 26 |        16 |
+--------+---------------------+---------+---------+----+-----------+
节点1数据库日志如下:
2022-03-18 10:42:31.837 CST,,,25636,"127.0.0.1:16450",6233f197.6424,1,"",2022-03-18 10:42:31 CST,,0,LOG,00000,"connection received: host=127.0.0.1 port=16450",,,,,,,,,""
2022-03-18 10:42:31.837 CST,,,25635,,6233f197.6423,2,,2022-03-18 10:42:31 CST,,0,WARNING,01000,"specified neither primary_conninfo nor restore_command",,"The database server will regularly poll the pg_wal subdirectory to check for files placed there.",,,,,,,""
2022-03-18 10:42:31.838 CST,,,25635,,6233f197.6423,3,,2022-03-18 10:42:31 CST,,0,LOG,00000,"entering standby mode",,,,,,,,,""
2022-03-18 10:42:31.847 CST,,,25635,,6233f197.6423,4,,2022-03-18 10:42:31 CST,1/0,0,LOG,00000,"consistent recovery state reached at 0/2F0000A0",,,,,,,,,""
2022-03-18 10:42:31.847 CST,,,25635,,6233f197.6423,5,,2022-03-18 10:42:31 CST,1/0,0,LOG,00000,"invalid record length at 0/2F0000A0: wanted 24, got 0",,,,,,,,,""
2022-03-18 10:42:31.851 CST,,,25631,,6233f197.641f,2,,2022-03-18 10:42:31 CST,,0,LOG,00000,"database system is ready to accept read only connections",,,,,,,,,""
2022-03-18 10:42:31.869 CST,"sysdba","highgo",25636,"127.0.0.1:16450",6233f197.6424,2,"",2022-03-18 10:42:31 CST,,0,FATAL,57P03,"the database system is starting up",,,,,,,,,""
2022-03-18 10:42:31.876 CST,,,25641,"127.0.0.1:16452",6233f197.6429,1,"",2022-03-18 10:42:31 CST,,0,LOG,00000,"connection received: host=127.0.0.1 port=16452",,,,,,,,,""
2022-03-18 10:42:31.892 CST,,,25643,"127.0.0.1:16456",6233f197.642b,1,"",2022-03-18 10:42:31 CST,,0,LOG,00000,"connection received: host=127.0.0.1 port=16456",,,,,,,,,""
2022-03-18 10:42:31.952 CST,,,25651,"127.0.0.1:16460",6233f197.6433,1,"",2022-03-18 10:42:31 CST,,0,LOG,00000,"connection received: host=127.0.0.1 port=16460",,,,,,,,,""
2022-03-18 10:42:31.969 CST,"sysdba","highgo",25651,"127.0.0.1:16460",6233f197.6433,2,"authentication",2022-03-18 10:42:31 CST,2/3,0,LOG,00000,"connection authorized: user=sysdba database=highgo application_name=Patroni SSL enabled (protocol=TLSv1.2, cipher=ECDHE-RSA-AES256-GCM-SHA384, bits=256, compression=off)",,,,,,,,,""
2022-03-18 10:42:32.061 CST,,,25666,"127.0.0.1:16468",6233f198.6442,1,"",2022-03-18 10:42:32 CST,,0,LOG,00000,"connection received: host=127.0.0.1 port=16468",,,,,,,,,""
2022-03-18 10:42:32.075 CST,"sysdba","",25666,"127.0.0.1:16468",6233f198.6442,2,"authentication",2022-03-18 10:42:32 CST,3/1,0,LOG,00000,"replication connection authorized: user=sysdba SSL enabled (protocol=TLSv1.2, cipher=ECDHE-RSA-AES256-GCM-SHA384, bits=256, compression=off)",,,,,,,,,""
2022-03-18 10:42:32.087 CST,"sysdba","",25666,"127.0.0.1:16468",6233f198.6442,3,"idle",2022-03-18 10:42:32 CST,,0,LOG,00000,"disconnection: session time: 0:00:00.027 user=sysdba database= host=127.0.0.1 port=16468",,,,,,,,,""
2022-03-18 10:42:32.112 CST,,,25635,,6233f197.6423,6,,2022-03-18 10:42:31 CST,1/0,0,LOG,00000,"received promote request",,,,,,,,,""
2022-03-18 10:42:32.112 CST,,,25635,,6233f197.6423,7,,2022-03-18 10:42:31 CST,1/0,0,LOG,00000,"redo is not required",,,,,,,,,""
2022-03-18 10:42:32.116 CST,,,25635,,6233f197.6423,8,,2022-03-18 10:42:31 CST,1/0,0,LOG,00000,"selected new timeline ID: 27",,,,,,,,,""
2022-03-18 10:42:32.352 CST,,,25635,,6233f197.6423,9,,2022-03-18 10:42:31 CST,1/0,0,LOG,00000,"archive recovery complete",,,,,,,,,""
2022-03-18 10:42:32.363 CST,,,25635,,6233f197.6423,10,,2022-03-18 10:42:31 CST,1/0,0,LOG,00000,"Switchover the SSHA Role. Current is NONE",,,,,,,,,""
2022-03-18 10:42:32.365 CST,,,25637,,6233f197.6425,1,,2022-03-18 10:42:31 CST,,0,LOG,00000,"checkpoint starting: force",,,,,,,,,""
2022-03-18 10:42:32.369 CST,,,25631,,6233f197.641f,3,,2022-03-18 10:42:31 CST,,0,LOG,00000,"database system is ready to accept connections",,,,,,,,,""
2022-03-18 10:42:32.402 CST,,,25637,,6233f197.6425,2,,2022-03-18 10:42:31 CST,,0,LOG,00000,"checkpoint complete: wrote 0 buffers (0.0%); 0 WAL file(s) added, 0 removed, 0 recycled; write=0.015 s, sync=0.001 s, total=0.038 s; sync files=0, longest=0.000 s, average=0.000 s; distance=0 kB, estimate=0 kB",,,,,,,,,"

[root@db data]# --此时启动节点3的HAC
bash: --此时启动节点3的HAC: command not found...
[root@db data]# /opt/HighGo/tools/hghac/hghactl -c /opt/HighGo/tools/hghac/hghac.yaml list
+ Cluster: ha (7072987311974756506) -----+---------+----+-----------+
| Member | Host                | Role    | State   | TL | Lag in MB |
+--------+---------------------+---------+---------+----+-----------+
| hghaca | 192.168.80.111:5866 | Leader  | running | 27 |           |
| hghacb | 192.168.80.112:5866 | Replica | running | 27 |         0 |
| hghacc | 192.168.80.113:5866 | Replica | running | 26 |        16 |
+--------+---------------------+---------+---------+----+-----------+
[root@db data]# /opt/HighGo/tools/hghac/hghactl -c /opt/HighGo/tools/hghac/hghac.yaml list
+ Cluster: ha (7072987311974756506) -----+---------+----+-----------+
| Member | Host                | Role    | State   | TL | Lag in MB |
+--------+---------------------+---------+---------+----+-----------+
| hghaca | 192.168.80.111:5866 | Leader  | running | 27 |           |
| hghacb | 192.168.80.112:5866 | Replica | running | 27 |         0 |
| hghacc | 192.168.80.113:5866 | Replica | running | 27 |         0 |
+--------+---------------------+---------+---------+----+-----------+


(4)如果仅重启被节点2和备节点3的HAC服务,此时数据库时间线不变
[root@db data]# /opt/HighGo/tools/hghac/hghactl -c /opt/HighGo/tools/hghac/hghac.yaml list
+ Cluster: ha (7072987311974756506) -----+---------+----+-----------+
| Member | Host                | Role    | State   | TL | Lag in MB |
+--------+---------------------+---------+---------+----+-----------+
| hghaca | 192.168.80.111:5866 | Leader  | running | 27 |           |
| hghacb | 192.168.80.112:5866 | Replica | stopped |    |   unknown |
| hghacc | 192.168.80.113:5866 | Replica | stopped |    |   unknown |
+--------+---------------------+---------+---------+----+-----------+
[root@db data]# --启动节点2 HAC
bash: --启动节点2: command not found...
[root@db data]# --启动节点3 HAC
bash: --启动节点3: command not found...
[root@db data]# /opt/HighGo/tools/hghac/hghactl -c /opt/HighGo/tools/hghac/hghac.yaml list
+ Cluster: ha (7072987311974756506) -----+---------+---()-+-----------+
| Member | Host                | Role    | State   | TL | Lag in MB |
+--------+---------------------+---------+---------+----+-----------+
| hghaca | 192.168.80.111:5866 | Leader  | running | 27 |           |
| hghacb | 192.168.80.112:5866 | Replica | running | 27 |         0 |
| hghacc | 192.168.80.113:5866 | Replica | running | 27 |         0 |
+--------+---------------------+---------+---------+----+-----------+

(5)HAC集群发生切换的时候,也会导致时间线的变化
[root@db data]# systemctl stop hghac-vip
[root@db data]# /opt/HighGo/tools/hghac/hghactl -c /opt/HighGo/tools/hghac/hghac.yaml list
+ Cluster: ha (7072987311974756506) -----+---------+----+-----------+
| Member | Host                | Role    | State   | TL | Lag in MB |
+--------+---------------------+---------+---------+----+-----------+
| hghaca | 192.168.80.111:5866 | Replica | stopped |    |   unknown |
| hghacb | 192.168.80.112:5866 | Leader  | running | 28 |           |
| hghacc | 192.168.80.113:5866 | Replica | running |    |   unknown |
+--------+---------------------+---------+---------+----+-----------+
[root@db data]# /opt/HighGo/tools/hghac/hghactl -c /opt/HighGo/tools/hghac/hghac.yaml list
+ Cluster: ha (7072987311974756506) -----+---------+----+-----------+
| Member | Host                | Role    | State   | TL | Lag in MB |
+--------+---------------------+---------+---------+----+-----------+
| hghaca | 192.168.80.111:5866 | Replica | stopped |    |   unknown |
| hghacb | 192.168.80.112:5866 | Leader  | running | 28 |           |
| hghacc | 192.168.80.113:5866 | Replica | running | 28 |         0 |
+--------+---------------------+---------+---------+----+-----------+
[root@db data]# systemctl start hghac-vip
[root@db data]# /opt/HighGo/tools/hghac/hghactl -c /opt/HighGo/tools/hghac/hghac.yaml list
+ Cluster: ha (7072987311974756506) -----+---------+----+-----------+
| Member | Host                | Role    | State   | TL | Lag in MB |
+--------+---------------------+---------+---------+----+-----------+
| hghaca | 192.168.80.111:5866 | Replica | running | 28 |         0 |
| hghacb | 192.168.80.112:5866 | Leader  | running | 28 |           |
| hghacc | 192.168.80.113:5866 | Replica | running | 28 |         0 |
+--------+---------------------+---------+---------+----+-----------+

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值