HAC集群添加新节点
生活随笔
收集整理的這篇文章主要介紹了
HAC集群添加新节点
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
瀚高數據庫
目錄
環境
文檔用途
詳細信息
環境
系統平臺:Linux x86-64 Red Hat Enterprise Linux 7
版本:4.5.7,4.5.6
文檔用途
本文檔用于指導HAC集群添加新節點
詳細信息
1、查看集群狀態,使用A、B兩種方法進行判斷
方法A:使用集群命令,確保TL時間線一致,Lag in MB數據同步延遲不能過高,最好延遲為0。
[root@localhost ~]# hghactl list+ Cluster: ha (7072256965608815760) -------+---------+----+-----------+| Member | Host | Role | State | TL | Lag in MB |+----------+---------------------+---------+---------+----+-----------+| hghac228 | 192.168.80.228:5866 | Leader | running | 6 | || hghac230 | 192.168.80.230:5866 | Replica | running | 6 | 0 |+----------+---------------------+---------+---------+----+-----------+方法B:各個節點查詢進程,有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/160000002、新增節點安裝數據庫,hghac軟件
rpm -ivh hgdb4.5.7-see-centos7-x86-64-20220307.rpmrpm -ivh hghac4.0.1-centos7-x86-64-20210604.rpm3、將主節點環境變量復制到新增節點,并使環境變量生效
vim ~/.bash_profilesource ~/.bash_profile4、新增節點執行如下命令將主庫hghac-see.yaml復制到本機
scp /opt/HighGo/tools/hghac root@192.168.80.228:/opt/HighGo/tools/hghac/hghac-see.yaml5、新增節點修改hghac-see.yaml文件
vim /opt/HighGo/tools/hghac/hghac-see.yamlconnect_address: 192.168.80.228:8008 #將ip修改為本機ip,例:192.168.80.230:8008 name: hghac228 #修改為hghac+本機ip最后一位,例:hghac230connect_address: 192.168.80.228:5866 #將ip修改為本機ip,例:192.168.80.230:5866 data_dir: /hgdata/highgo/data #查看/hgdata/highgo目錄是否存在,#不存在mkdir -p /hgdata/highgo創建,/hgdata目錄應該是掛載的磁盤目錄dir: /hgdata/hghalog #查看該目錄是否存在,不存在mkdir -p /hgdata/hghalog 創建6、新增節點設置集群服務開機自啟動,并啟動集群服務器和禁用數據庫服務
[root@hgdw231 hgupload]# systemctl enable hghac.service Created symlink from /etc/systemd/system/multi-user.target.wants/hghac.service to /etc/systemd/system/hghac.service.[root@hgdw231 hgupload]# systemctl start hghac.service[root@hgdw231 hgupload]# systemctl disable hgdb-see-4.5.7.serviceRemoved symlink /etc/systemd/system/multi-user.target.wants/hgdb-see-4.5.7.service.Removed symlink /etc/systemd/system/graphical.target.wants/hgdb-see-4.5.7.service.注意:也有可能不是hghac.service,可能是hghac-vip.service 請使用systemctl status hghac.service/hghac-vip.service確定運行的服務7、檢查集群狀態
[root@localhost ~]# hghactl list8、其他
執行hghactl等集群命令提示“未找到命令”,請配置環境變量,參考如下:
vim ~/.bash_profileexport PGPORT=5866export PGUSER=sysdbaexport PGDATABASE=highgoexport PGHOME=/opt/HighGo4.5.7-seeexport PGDATA=/opt/HighGo4.5.7-see/dataexport PATH=$PGHOME/bin:$PATH:$HOME/bin:/opt/HighGo/tools/hghac:/opt/HighGo/tools/hghac/etcdexport LD_LIBRARY_PATH=$PGHOME/lib:/usr/lib64:$LD_LIBRARY_PATHexport ETCDCTL_ENDPOINTS=http://10.1.194.182:2379,http://10.1.194.191:2379,http://10.1.194.192:2379export PATRONICTL_CONFIG_FILE=/opt/HighGo/tools/hghac/hghac-see.yamlsource ~/.bash_profile注意:1、需要根據實際情況修改環境變量實際路徑,可以使用find命令查找文件路徑例:查找hghac find / -iname hghac -print2、ETCDCTL_ENDPOINTS三個ip需要修改為配置etcd三節點的ip,可以參考/opt/HighGo/tools/hghac/hghac-see.yaml文件中的etcd:hosts總結
以上是生活随笔為你收集整理的HAC集群添加新节点的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 百度搜索资源平台链接提交通道
- 下一篇: 开源流媒体服务器SRS环境搭建