高可用集群的启停
启动集群
分别以 AntDB 用户,例如 adb01 登录三台机器(一主二备)。
使用以下命令分别启动 adbhamgr。
sudo systemctl start adbhamgr
说明
默认前提是集群搭建完毕:adbdcs 启动成功,主备搭建成功。具体搭建步骤请参考集中式安装部署手册。
停止集群
分别以 AntDB 用户,例如 adb01 登录三台机器(一主二备)。
使用以下命令分别停止 adbhamgr。
sudo systemctl stop adbhamgr
说明
adbhamgr 停止后,集群即停止成功。
重启集群
adbhamgrctl 的 restart 后直接跟集群名称,可以重启集群。--force 能强制重启集群。
[antdb@host-10-19-28-129 ~]$ adbhamgrctl -c /etc/adbhamgr.yml restart antdb-cluster
+ Cluster: antdb-cluster (7348278630800196973) ---+---------+-----+-----------+
| Member | Host | Role | State | TL | Lag in MB |
+-------------+--------------------+--------------+---------+-----+-----------+
| adbhamgr-01 | 10.19.28.129:55551 | Replica | running | 467 | 0 |
| adbhamgr-02 | 10.19.36.206:55551 | Sync Standby | running | 467 | 0 |
| adbhamgr-03 | 10.19.36.207:55551 | Leader | running | 467 | |
+-------------+--------------------+--------------+---------+-----+-----------+
When should the restart take place (e.g. 2022-12-27T16:11) [now]:
Are you sure you want to restart members adbhamgr-03, adbhamgr-01, adbhamgr-02? [y/N]: y
Restart if the PostgreSQL version is less than provided (e.g. 9.5.2) []:
Success: restart on member adbhamgr-03
Success: restart on member adbhamgr-01
Success: restart on member adbhamgr-02
#--force强制重启
[antdb@host-10-19-28-129 ~]$ adbhamgrctl -c /etc/adbhamgr.yml restart antdb-cluster --force
+ Cluster: antdb-cluster (7348278630800196973) ---+---------+----+-----------+
| Member | Host | Role | State | TL | Lag in MB |
+-------------+--------------------+--------------+---------+-----+-----------+
| adbhamgr-01 | 10.19.28.129:55551 | Sync Standby | running | 467 | 0 |
| adbhamgr-02 | 10.19.36.206:55551 | Replica | running | 467 | 0 |
| adbhamgr-03 | 10.19.36.207:55551 | Leader | running | 467 | |
+-------------+--------------------+--------------+---------+-----+-----------+
Success: restart on member adbhamgr-03
Success: restart on member adbhamgr-01
Success: restart on member adbhamgr-02
重启节点
adbhamgrctl 的 restart 后跟集群名称和节点名称,可以重启集群的节点。--force 能强制重启集群。
[antdb@host-10-19-28-129 ~]$ adbhamgrctl -c /etc/adbhamgr.yml restart antdb-cluster adbhamgr-01
+ Cluster: antdb-cluster (7348278630800196973) ---+---------+-----+-----------+
| Member | Host | Role | State | TL | Lag in MB |
+-------------+--------------------+--------------+---------+-----+-----------+
| adbhamgr-01 | 10.19.28.129:55551 | Sync Standby | running | 467 | 0 |
| adbhamgr-02 | 10.19.36.206:55551 | Replica | running | 467 | 0 |
| adbhamgr-03 | 10.19.36.207:55551 | Leader | running | 467 | |
+-------------+--------------------+--------------+---------+-----+-----------+
When should the restart take place (e.g. 2022-12-27T16:19) [now]:
Are you sure you want to restart members adbhamgr-01? [y/N]: y
Restart if the PostgreSQL version is less than provided (e.g. 9.5.2) []:
Success: restart on member adbhamgr-01
#--force强制重启
[antdb@host-10-19-28-129 ~]$ adbhamgrctl -c /etc/adbhamgr.yml restart antdb-cluster adbhamgr-01 --force
+ Cluster: antdb-cluster (7348278630800196973) ---+---------+-----+-----------+
| Member | Host | Role | State | TL | Lag in MB |
+-------------+--------------------+--------------+---------+-----+-----------+
| adbhamgr-01 | 10.19.28.129:55551 | Replica | running | 467 | 0 |
| adbhamgr-02 | 10.19.36.206:55551 | Sync Standby | running | 467 | 0 |
| adbhamgr-03 | 10.19.36.207:55551 | Leader | running | 467 | |
+-------------+--------------------+--------------+---------+-----+-----------+
Success: restart on member adbhamgr-01
错误排查
如果启动 adbhamgr 或者停止 adbhamgr 服务失败,请根据日志文件中的日志信息排查错误。
# adbhamgr的日志在系统日志中,如果有问题,可以通过日志报错去调查
tail -f /var/log/messages
# 查adbhamgr日志的命令:
sudo systemctl status adbhamgr -l
sudo journalctl -f -u adbhamgr
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。




