ITPub博客

首页 > 数据库 > 国内数据库 > db_ha集群所有节点重新开机的操作步骤

db_ha集群所有节点重新开机的操作步骤

原创 国内数据库 作者:瀚高PG实验室 时间:2022-10-21 14:23:14 0 删除 编辑

 瀚高数据库

目录
环境
文档用途
详细信息
 
环境
系统平台:Linux x86-64 Red Hat Enterprise Linux 7
版本:4.5.7
 
文档用途

本文档用于db_ha集群所有节点重新开机操作步骤。

 
详细信息

1、查看集群状态streamingType=NONE为主库,ASYNC为异步流复制,SYNC为同步流复制,healthy=t节点状态正常。

/usr/local/db_ha/bin/db_ha select -f /usr/local/db_ha/conf/db_ha.conf
connect monitor success
cluster num = 3         secondary monitor is normal
nodeip=192.168.80.228,nodetype=PRIMARY,replicationName=ha228 streamingType=NONE streamingState=none healthy=t agentState=NORMAL
nodeip=192.168.80.229,nodetype=STANDBY,replicationName=ha229 streamingType=ASYNC streamingState=streaming healthy=t agentState=NORMAL
nodeip=192.168.80.230,nodetype=STANDBY,replicationName=ha230 streamingType=ASYNC streamingState=streaming healthy=t agentState=NORMAL

2、查看主监控节点

ps -ef | grep -v grep|grep primary_monitor
root     16238     1  5 17:42 ?        00:00:26 /usr/local/db_ha/bin/primary_monitor /usr/local/db_ha/conf/primary_monitor.conf Come_from_secondary
root     16239 16238  0 17:42 ?        00:00:00 /usr/local/db_ha/bin/primary_monitor /usr/local/db_ha/conf/primary_monitor.conf Come_from_secondary

3、关机步骤,先关闭备节点,最后关闭主节点;关闭系统前先关闭本节点agent服务。

ha_ctl -a -f /usr/local/db_ha/conf/agent.conf stop

4、开机步骤,先开机主节点,再开机备节点和主监控节点。(主备监控不会开机自启,所以顺序不受影响)

5、主节点检查流复制状态

ps -ef | grep -v grep |grep walsend
root     18264 17608  0 17:42 ?        00:00:00 postgres: walsender sysdba 192.168.80.229(44074) streaming 0/1D001158
root     18267 17608  0 17:42 ?        00:00:00 postgres: walsender sysdba 192.168.80.230(33520) streaming 0/1D001158

6、备节点检查流复制状态

ps -ef | grep -v grep |grep receiver
root      3718  3711  0 5月24 ?       00:08:50 postgres: walreceiver   streaming 0/1D0016C8

7、流复制状态正常之后,启动主监控。

/usr/local/db_ha/bin/primary_monitor  /usr/local/db_ha/conf/primary_monitor.conf

8、检查集群状态

/usr/local/db_ha/bin/db_ha select -f /usr/local/db_ha/conf/db_ha.conf
connect monitor success
cluster num = 3         WARNING : secondary monitor is lost
nodeip=192.168.80.228,nodetype=PRIMARY,replicationName=ha228 streamingType=NONE streamingState=none healthy=t agentState=NORMAL
nodeip=192.168.80.229,nodetype=STANDBY,replicationName=ha229 streamingType=ASYNC streamingState=streaming healthy=t agentState=NORMAL
nodeip=192.168.80.230,nodetype=STANDBY,replicationName=ha230 streamingType=ASYNC streamingState=streaming healthy=t agentState=NORMAL

注意:

主监控配置文件设置了备监控自启动,备监控无需手动启动

auto_start_new_secondary = on



来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/69994931/viewspace-2919634/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
瀚高PG实验室(Highgo PG Lab)依托于瀚高DBA运维团队及瀚高数据库PG内核研发团队,旨在深入研究PostgreSQL技术、使用技巧、内核探秘、PG教学等,并进行分享。欢迎大家关注、交流。

注册时间:2021-02-18

  • 博文量
    184
  • 访问量
    126033