ITPub博客

首页 > 数据库 > 国内数据库 > HAC集群更改IP(单节点更改、全部节点更改)

HAC集群更改IP(单节点更改、全部节点更改)

原创 国内数据库 作者:瀚高PG实验室 时间:2022-05-27 16:28:32 0 删除 编辑

瀚高数据库

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

本文档用于指导 HAC 集群更改 IP(单节点更改、全部节点更改)。

 
详细信息

一、停掉 hghac 服务

1、按照先停备库,最后停主库原则停服务

2、各个节点查询进程,有 sender 节点的是主库,有 receiver 节点的是备库

ps -ef | grep senderroot     26418  3233  0 6月11 ?    00:00:22 postgres: c: walsender sysdba 192.168.80.228(45186) streaming 0/16000000ps -ef | grep receiverroot      3372  3348  0 6月11 ?     00:13:54 postgres: c: walreceiver   streaming 0/16000000

3、停服务命令

systemctl stop hghac-vip.service

二、各个节点停掉 etcd 服务

systemctl stop etcd.service

三、修改服务器 ip

1、根据实际情况修改各个服务器 ip

2、查找虚拟 ip 配置文件

find / -iname vip.env -print

3、修改虚拟 ip 和网卡等信息

vim /opt/HighGo4.5.7-see/tools/hghac/vip.env
VIP=192.168.1.67
GATEWAY=192.168.234.2
DEV=ens33

四、修改 etcd

1、find 命令找到 etcd.yaml 文件

find / -iname etcd.yaml -print

2、修改 etcd.yaml 配置文件( 各个服务器都需要进行修改)

vim /opt/HighGo4.5.7-see/tools/hghac/etcd/etcd.yamldebug: falsename: hghac54data-dir: /opt/HighGo/tools/hghac/etcd/hghac54.etcdinitial-advertise-peer-urls: http://192.168.1.54:2380    #修改为本机iplisten-peer-urls: http://192.168.1.54:2380           #修改为本机ipadvertise-client-urls: http://192.168.1.54:2379        #修改为本机iplisten-client-urls: http://192.168.1.54:2379          #修改为本机ipinitial-cluster-token: etcd-clusterinitial-cluster: hghac54=http://192.168.1.54:2380,hghac55=http://192.168.1.55:2380,hghac61=http://192.168.1.61:2380 #不同节点修改ip,此处各个节点也需要修改对应的ip。initial-cluster-state: newenable-v2: true

五、修改 hghac

1、find 命令找到 hghac.yaml 文件

find / -iname hghac.yaml -print

2、修改 hghac.yaml 文件( 各个服务器都需要进行修改)

vim /opt/HighGo4.5.7-see/tools/hghac/hghac.yamlrestapi:  connect_address: 192.168.1.55:8008  #修改本机ip  listen: 192.168.1.55:8008        #修改本机ipetcd/zookeeper:     #etcd和zookeeper只会用一个,根据实际情况,修改hosts各个节点实际ip                         hosts: 192.168.1.54:2379,192.168.1.55:2379,192.168.1.61:2379 connect_address:  192.168.1.55:5866   #修改本机ip

六、启动 etcd 集群

1、各个节点同时启动 etcd

systemctl start etcd.service

2、查看单个节点状态

systemctl status etcd.service

3、查看 etcd 集群状态

配置环境变量如下命令:

etcdctl endpoint status --write-out=table

未配置环境变量如下命令:

/opt/HighGo4.5.7-see/tools/hghac/etcd/etcdctl  --endpoints=http://192.168.1.55:2379,http://192.168.1.56:2379,http://192.168.1.61:2379 endpoint status --write-out=table

七、启动 hghac

1、和之前停服务顺序相反,先启动主库服务,再启动备库服务

systemctl start hghac-vip.service

2、单个节点状态查看

systemctl status hghac-vip.service

3、集群状态查看

配置环境变量如下命令:

hghactl list

未配置环境变量如下命令:

/opt/HighGo4.5.7-see/tools/hghac/hghactl -c /opt/HighGo4.5.7-see/tools/hghac/hghac.yaml list

八、其他

1、监控集群使用 etcd 或者 zookeeper,如果使用 zookeeper 作为监控集群,使用如下方法。

2、find 命令查找  zoo.cfg 文件

find / -iname zoo.cfg -print

3、修改 zoo.cfg 文件(各个服务器节点都需要修改)

vi  /opt/Highgo/tools/zookeeper/conf/zoo.cfg
server.1=192.168.1.55:2888:3888server.2=192.168.1.56:2888:3888server.3=192.168.1.61:2888:3888

4、启停 zookeeper 服务

systemctl  start  zookeeper.servicesystemctl  stop   zookeeper.service

5、查看 zookeeper 状态

systemctl  status zookeeper.service

 


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

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

注册时间:2021-02-18

  • 博文量
    184
  • 访问量
    126055