欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 新闻 > 国际 > 磐维数据库PanWeiDB2.0集群部署安装

磐维数据库PanWeiDB2.0集群部署安装

2025/1/30 10:08:02 来源:https://blog.csdn.net/hf191850699/article/details/145353731  浏览:    关键词:磐维数据库PanWeiDB2.0集群部署安装

1. 部署环境准备

主机名

IP

VIP

数据库角色

数据库端口

CMSever端口

db01

192.168.50.46

192.168.50.49

Primary

17700

18800

db02

192.168.50.47

Standby

17700

18800

db03

192.168.50.48

Standby

17700

18800

2. 文件规划存放

序号

文件系统

用途

1

/database/panweidb/data

存放数据文件

2

/database/panweidb/data/pg_xlog

存放WAL文件

3

/database/panweidb/log

存放数据库日志

4

/database/panweidb/pg_audit

存放审计日志

5

/database/panweidb/app

数据库安装目录

6

/database/panweidb/cm

cm目录

7

/database/panweidb/soft

软件介质目录

8

/backup

备份目录

9

/archive

存放归档日志

3. 系统环境优化(所有节点)

3.1. 检查 kernel 版本

cat /etc/redhat-release
uname -r

3.2. 关闭SELINUX

# 修改配置文件
cat /etc/selinux/config | grep -i SELINUX
SELINUX=disabled# 关闭SELINUX
setenforce 0

3.3. 关闭防火墙

# 查看防火墙状态
systemctl status firewalld# 关闭防火墙
systemctl disable firewalld.service
systemctl stop firewalld.servic

3.4. 设置字符集

# 查看字符集
echo $LANG
# 设置字符集
export LANG=en_US.UTF-8

3.5. 设置时区和时间

# 检查时间和时区,时间应该同步一致;时区应该一样。
date# 如果不一样,则执行如下操作
## 拷贝时区文件
cp ../usr/share/zoneinfo/Asia/Shanghai /etc/localtime
## 设置三节点统一时间
date -s "2025-01-24 10:20:30"

3.6. 内核参数优化

vi /etc/sysctl.conf# panweidb
net.ipv4.tcp_max_tw_buckets = 10000
net.ipv4.tcp_tw_reuse = 1 
net.ipv4.tcp_keepalive_time = 30
net.ipv4.tcp_keepalive_probes = 9
net.ipv4.tcp_keepalive_intvl = 30
net.ipv4.tcp_retries1 = 5
net.ipv4.tcp_syn_retries = 5
net.ipv4.tcp_synack_retries = 5
net.ipv4.tcp_retries2 = 12
vm.overcommit_memory = 0
net.ipv4.tcp_rmem = 8192 250000 16777216
net.ipv4.tcp_wmem = 8192 250000 16777216
net.core.wmem_max = 21299200
net.core.rmem_max = 21299200
net.core.wmem_default = 21299200
net.core.rmem_default = 21299200
net.ipv4.ip_local_port_range = 26000 65535
kernel.sem = 250 6400000 1000 25600
net.core.somaxconn = 65535
net.ipv4.tcp_syncookies = 1
net.core.netdev_max_backlog = 65535
net.ipv4.tcp_max_syn_backlog = 65535
net.ipv4.tcp_fin_timeout = 60
kernel.shmall = 1073741824    
kernel.shmmax = 751619276800          
net.ipv4.tcp_sack = 1
net.ipv4.tcp_timestamps = 1
vm.extfrag_threshold = 500
vm.overcommit_ratio = 90
vm.swappiness = 0
kernel.core_pattern=/database/panweidb/corefile/%e.%p.%u.%t.core

# 执行以下命令生效

sysctl -p

3.7. 配置资源限制

vi /etc/security/limits.conf# panweidb
* soft nofile 1000000
* hard nofile 1000000
* soft nproc 655360
* hard nproc 655360
* soft memlock unlimited
* hard memlock unlimited
* soft core unlimited
* hard core unlimited
* soft stack unlimited
* hard stack unlimited

3.8. 配置 yum

mount /dev/cdrom /mnt
cd /etc/yum.repos.d
mkdir bk
mv *.repo bk/ 
echo "[EL]" >> /etc/yum.repos.d/hefei.repo 
echo "name =Linux 7.x DVD" >> /etc/yum.repos.d/hefei.repo 
echo "baseurl=file:///mnt" >> /etc/yum.repos.d/hefei.repo 
echo "gpgcheck=0" >> /etc/yum.repos.d/hefei.repo 
echo "enabled=1" >> /etc/yum.repos.d/hefei.repo 
cat /etc/yum.repos.d/hefei.repo 

3.9. 关闭THP

#检查THP开启情况
cat /sys/kernel/mm/transparent_hugepage/enabled
[always] madvise never##关闭THP
echo never > /sys/kernel/mm/transparent_hugepage/enabled
## 设置重启后自动关闭
chmod +x /etc/rc.d/rc.local
systemctl enable rc-local.servicecat >> /etc/rc.d/rc.local <<EOF
swapoff -a
if test -f /sys/kernel/mm/transparent_hugepage/enabled;
thenecho never > /sys/kernel/mm/transparent_hugepage/enabled
fi
if test -f /sys/kernel/mm/transparent_hugepage/defrag;
thenecho never > /sys/kernel/mm/transparent_hugepage/defrag
fi
EOFsystemctl restart rc-local.service

3.10. 关闭RemoveIPC

 (1) 修改/etc/systemd/logind.conf文件中的“RemoveIPC”值为“no”
vim  /etc/systemd/logind.conf
RemoveIPC=no(2) 修改/usr/lib/systemd/system/systemd-logind.service文件中的“RemoveIPC”值为“no”
vim /usr/lib/systemd/system/systemd-logind.service
RemoveIPC=no       #没有参数,添加到末尾(3) 重启服务
systemctl daemon-reload
systemctl restart systemd-logind.service(4) 结果验证确认
loginctl show-session | grep RemoveIPC
systemctl show systemd-logind | grep RemoveIPC

4. 安装 PanWeiDB

4.1. 安装数据库依赖(所有节点)

注意事项:

1)libnsl 包在 openEuler x86系统中需要安装。

yum -y install libaio-devel flex bison ncurses-devel glibc-devel patch readline-devel python3 expect* bzip2 ncurses-devel zlib-devel numactl libnsl* gcc-c++ gcc redhat-lsb-core

2)麒麟系统readline-devel和libnsl包需单独下载

https://update.cs2c.com.cn/NS/V10/V10SP1.1/os/adv/lic/base/aarch64/Packages/

yum -y install libaio-devel flex bison ncurses-devel glibc-devel patch readline-devel python3 expect* bzip2 libnsl gcc gcc-c++ zlib-devel ncurses-devel expect

4.2. 检查python3(所有节点)

# 检查 python3 版本,如果为 Python 3.6或3.7则满足要求,如果不满足则需重新yum安装
python3 --version

4.3. root用户配置/etc/hosts文件(所有节点)

cat >> /etc/hosts <<-ROF
192.168.50.46 db01
192.168.50.47 db02
192.168.50.48 db03
ROF

4.4. 修改服务器hostname(所有节点)

#检查服务器当前的hostname
hostname#根据/etc/hosts的规划,分别重置hostname
hostnamectl set-hostname xxxx

4.5. 检查omm用户及用户组(所有节点)

groupadd -g 1101 dbgrp
useradd -g dbgrp -u 1101 -m omm
passwd omm
(omm密码:omm@2025)# 若已存在omm用户,修改omm用户组为dbgrp
groupadd -g 1101 dbgrp
usermod -g dbgrp omm

4.6. 创建目录(所有节点)

mkdir -p /database/panweidb
mkdir -p /database/panweidb/archive
mkdir -p /database/panweidb/pg_audit

4.7. 创建安装包目录(主节点)

mkdir -p /database/panweidb/soft

4.8. 上传并解压安装包(主节点)

# 将安装包存放在/database/panweidb/soft 目录下
cd /database/panweidb/soft[root@db01 soft]#  tar -zxvf 'PanWeiDB_V2.0-S3.0.0_B01-install-bclinux_euler21.10-x86_64-no_mot.tar.gz' -C /database/panweidb/soft/
[root@db01 soft]# tar -zxvf PanWeiDB_V2.0-S3.0.0_B01-bclinux-64bit-om.tar.gz -C /database/panweidb/soft/

4.9. 编写XML文件(主节点)

一主两备两节点的配置文件如下:

<?xml version="1.0" encoding="utf-8"?>
<ROOT><CLUSTER><PARAM name="clusterName" value="panweidb" /><PARAM name="nodeNames" value="db01,db02,db03"/><PARAM name="gaussdbAppPath" value="/data/panweidb/app" /><PARAM name="gaussdbLogPath" value="/data/panweidb/log" /><PARAM name="tmpMppdbPath" value="/data/panweidb/tmp"/><PARAM name="gaussdbToolPath" value="/data/panweidb/tool" /><PARAM name="corePath" value="/data/panweidb/corefile"/><PARAM name="backIp1s" value="192.168.50.46,192.168.50.47,192.168.50.48"/></CLUSTER><DEVICELIST><DEVICE sn="db01"><PARAM name="name" value="db01"/><PARAM name="azName" value="AZ1"/><PARAM name="azPriority" value="1"/><PARAM name="backIp1" value="192.168.50.46"/><PARAM name="sshIp1" value="192.168.50.46"/><PARAM name="cmsNum" value="1"/><PARAM name="cmServerPortBase" value="18800"/><PARAM name="cmServerListenIp1" value="192.168.50.46,192.168.50.47,192.168.50.48"/><PARAM name="cmServerHaIp1" value="192.168.50.46,192.168.50.47,192.168.50.48"/><PARAM name="cmServerlevel" value="1"/><PARAM name="cmServerRelation" value="db01,db02,db03"/><PARAM name="cmDir" value="/data/panweidb/cm"/><PARAM name="dataNum" value="1"/><PARAM name="dataPortBase" value="17700"/><PARAM name="dataNode1" value="/data/panweidb/data,db02,/data/panweidb/data,db03,/data/panweidb/data"/><PARAM name="dataNode1_syncNum" value="1"/></DEVICE><DEVICE sn="db02"><PARAM name="name" value="db02"/><PARAM name="azName" value="AZ1"/><PARAM name="azPriority" value="1"/><PARAM name="backIp1" value="192.168.50.47"/><PARAM name="sshIp1" value="192.168.50.47"/><PARAM name="cmServerPortStandby" value="18800"/><PARAM name="cmDir" value="/data/panweidb/cm"/></DEVICE><DEVICE sn="db03"><PARAM name="name" value="db03"/><PARAM name="azName" value="AZ1"/><PARAM name="azPriority" value="1"/><PARAM name="backIp1" value="192.168.50.48"/><PARAM name="sshIp1" value="192.168.50.48"/><PARAM name="cmServerPortStandby" value="18800"/><PARAM name="cmDir" value="/data/panweidb/cm"/></DEVICE></DEVICELIST>
</ROOT>

4.10. 安装目录授权(所有节点)

chown -R omm:dbgrp /data/panweidb
chmod -R 755 /data/panweidb

4.11. root用户预安装(主节点)

cd /database/panweidb/soft/script
-- ./gs_preinstall -U omm -G dbgrp -X /database/panweidb/soft/panweidb1m2s.xml --sep-env-file=/home/omm/.bash_profile
./gs_preinstall -U omm -G dbgrp -X /database/panweidb/soft/panweidb1m2s.xml[root@db01 script]# ./gs_preinstall -U omm -G dbgrp -X /database/panweidb/soft/panweidb1m2s.xml
[GAUSS-51405] : You need to install software:expect
[root@db01 script]#  yum install expectError: Failed to register other ssh-agent,output is [Failed to ssh-add perform.Error: /root/.ssh/./ssh-agent.sh:行18: expect:未找到命令]
[root@db02 script]#  yum install expect
[root@db03 script]#  yum install expect[GAUSS-50612] : Failed to obtain network card RX value. Error: Cannot get device ring settings: Operation not supported. 
解决方法:修改 gs_checkos 文件第 98行把CHECK_ITEMNUMLIST变量的 A11 删除,重新运行 gs_preinstall 程序[GAUSS-52200] : Unable to import module: libpython3.6m.so.1.0: cannot open shared object file: No such file or directory. 
已知CentOS7.6会报该错,可查找 libpython3.6m.so.1.0 路径,链接到/usr/lib64 下。

4.12. 安装目录授权(主节点)

chown -R omm:dbgrp /data/panweidb
chmod -R 755 /data/panweidb

4.13. omm用户安装(主节点)

su - omm
#三节点:一主两备
gs_install -X /database/panweidb/soft/panweidb1m2s.xml \
--gsinit-parameter="--encoding=UTF8" \
--gsinit-parameter="--lc-collate=C" \
--gsinit-parameter="--lc-ctype=C" \
--gsinit-parameter="--dbcompatibility=A"gs_install -X /data/panweidb2/soft/panweidb1m2s.xml --gsinit-parameter="--encoding=UTF8" --gsinit-parameter="--lc-collate=C" --gsinit-parameter="--lc-ctype=C" --gsinit-parameter="--dbcompatibility=A"

注意事项:

Aoracle Bmysql PGPG

1. 数据库兼容性只能全局设置,后续不可更改,此处用例为兼容B,必须确认好项目使用的数据库兼容性。

2. 如果安装失败请根/database/panweidb/log/omm/om目录中的日志排查错误。

3. 数据库初始密码设置与操作系统omm密码一致。

[omm@db01 ~]$ gs_install -X /database/panweidb/soft/panweidb1m2s.xml \
> --gsinit-parameter="--encoding=UTF8" \
> --gsinit-parameter="--lc-collate=C" \
> --gsinit-parameter="--lc-ctype=C" \
> --gsinit-parameter="--dbcompatibility=A"
Parsing the configuration file.
Successfully checked gs_uninstall on every node.
Check preinstall on every node.
Successfully checked preinstall on every node.
Creating the backup directory.
Successfully created the backup directory.
begin deploy..
Installing the cluster.
begin prepare Install Cluster..
Checking the installation environment on all nodes.
begin install Cluster..
Installing applications on all nodes.
Successfully installed APP.
begin init Instance..
encrypt cipher and rand files for database.
Please enter password for database:
Please repeat for database:
begin to create CA cert files
The sslcert will be generated in /data/panweidb/app/share/sslcert/om
Create CA files for cm beginning.
Create CA files on directory [/data/panweidb/app_ba25a44/share/sslcert/cm]. file list: ['server.key.cipher', 'server.key', 'cacert.pem', 'server.crt', 'client.key', 'client.crt', 'client.key.cipher', 'client.key.rand', 'server.key.rand']
Non-dss_ssl_enable, no need to create CA for DSS
Cluster installation is completed.
Configuring.
Deleting instances from all nodes.
Successfully deleted instances from all nodes.
Checking node configuration on all nodes.
Initializing instances on all nodes.
Updating instance configuration on all nodes.
Check consistence of memCheck and coresCheck on database nodes.
Successful check consistence of memCheck and coresCheck on all nodes.
Warning: The license file does not exist, so there is no need to copy it to the home directory.
Configuring pg_hba on all nodes.
Configuration is completed.
Starting cluster.
======================================================================
[GAUSS-51607] : Failed to start cluster. Error:
cm_ctl: checking cluster status.
cm_ctl: checking cluster status.
cm_ctl: checking finished in 744 ms.
cm_ctl: start cluster.
cm_ctl: start nodeid: 1
cm_ctl: start nodeid: 2
cm_ctl: start nodeid: 3
...........................................................................................................................................................................................................................................................................................................
cm_ctl: start cluster failed in (300)s!HINT: Maybe the cluster is continually being started in the background.
You can wait for a while and check whether the cluster starts, or increase the value of parameter "-t", e.g -t 600.
The cluster may continue to start in the background.
If you want to see the cluster status, please try command gs_om -t status.
If you want to stop the cluster, please try command gs_om -t stop.
[GAUSS-51607] : Failed to start cluster. Error:
cm_ctl: checking cluster status.
cm_ctl: checking cluster status.
cm_ctl: checking finished in 744 ms.
cm_ctl: start cluster.
cm_ctl: start nodeid: 1
cm_ctl: start nodeid: 2
cm_ctl: start nodeid: 3
...........................................................................................................................................................................................................................................................................................................
cm_ctl: start cluster failed in (300)s!HINT: Maybe the cluster is continually being started in the background.
You can wait for a while and check whether the cluster starts, or increase the value of parameter "-t", e.g -t 600.
[omm@db01 ~]$--解决:
chown -R omm:dbgrp /data/panweidb
chmod -R 755 /data/panweidbSuccessfully deleted instances from all nodes.
Checking node configuration on all nodes.
Initializing instances on all nodes.
Updating instance configuration on all nodes.
Check consistence of memCheck and coresCheck on database nodes.
Successful check consistence of memCheck and coresCheck on all nodes.
Warning: The license file does not exist, so there is no need to copy it to the home directory.
Configuring pg_hba on all nodes.
Configuration is completed.
Starting cluster.
======================================================================
Successfully started primary instance. Wait for standby instance.
======================================================================
.
Successfully started cluster.
======================================================================
cluster_state      : Normal
redistributing     : No
node_count         : 3
Datanode Stateprimary           : 1standby           : 2secondary         : 0cascade_standby   : 0building          : 0abnormal          : 0down              : 0Successfully installed application.
end deploy..---报错
Installing the cluster.
begin prepare Install Cluster..
Checking the installation environment on all nodes.
[FAILURE] db01:
Checking old installation.
[GAUSS-51806] : The cluster has been installed.
[FAILURE] db02:
Checking old installation.
[GAUSS-51806] : The cluster has been installed.
[FAILURE] db03:
Checking old installation.
[GAUSS-51806] : The cluster has been installed.--解决
检查omm用户下的.bashrc文件中$GAUSS_ENV环境变量的值是否为2,如果是2就改成1
GAUSS_ENV = 1 indicates successful pre-installation  表示预安装成功
GAUSS_ENV = 2 indicates successful installation 表示数据库已经安装成功

4.14. 查看集群状态

[omm@db01 ~]$ gs_om -t status --detail
[  CMServer State   ]node    node_ip         instance                         state
----------------------------------------------------------------
1  db01 192.168.50.46   1    /data/panweidb/cm/cm_server Standby
2  db02 192.168.50.47   2    /data/panweidb/cm/cm_server Standby
3  db03 192.168.50.48   3    /data/panweidb/cm/cm_server Primary[   Cluster State   ]cluster_state   : Normal
redistributing  : No
balanced        : Yes
current_az      : AZ_ALL[  Datanode State   ]node    node_ip         instance                 state
------------------------------------------------------------------
1  db01 192.168.50.46   6001 /data/panweidb/data P Primary Normal
2  db02 192.168.50.47   6002 /data/panweidb/data S Standby Normal
3  db03 192.168.50.48   6003 /data/panweidb/data S Standby Normal

--到此,PanWeiDB 一主两备三节点集群已经按照完毕,后面的操作选做。

4.15. 还原root禁止登录(根据情况选择)

注意事项:因安全基线要求,临时修改的 root 禁止登陆配置需要进行还原。检查所有主机的 sshd_config 文件内 PermitRootLogin 是否为 no,如果不是,需要修改为 no,并重启 sshd 服务

vi /etc/ssh/sshd_config
PermitRootLogin nosystemctl restart sshdcat  /etc/ssh/sshd_config | grep PermitRootLogin 
# the setting of "PermitRootLogin without-password".
PermitRootLogin no

4.16. 配置数据库基线参数(gs_guc_v2.11_20231212)

先执行如下脚本文件

sh gs_guc_v2.11_20231212.sh 

再根据部署节点执行如下

#集群为三节点部署,执行如下设置
gs_guc set -N hostname1 -D /database/panweidb/data -c "synchronous_standby_names = 'dn_6002'" 
gs_guc set -N hostname2 -D /database/panweidb/data -c "synchronous_standby_names = 'dn_6001'" 
gs_guc set -N hostname3 -D /database/panweidb/data -c "synchronous_standby_names = 'ANY 1(dn_6001,dn_6002)'"

设置磁盘告警阈值:

gs_guc reload -Z cmserver -N all -I all -c "datastorage_threshold_value_check=85"
gs_guc reload -Z cmserver -N all -I all -c " enable_transaction_read_only=on"

注意:当数据目录所在磁盘占用超过datastorage_threshold_value_check设置的阈值,自动将数据库设置为只读模式。参考现场主机磁盘目录告警修改此参数或磁盘告警值。

重启数据库集群:

gs_om -t stop && gs_om -t start

4.17. omm用户卸载(如需卸载)

cd /database/panweidb/soft/script \rgs_uninstall --delete-data

5. VIP配置(可选)

2.0支持通过回调脚本方式在主备切换场景下自动切换VIP。cm_agent在本地数据库角色发生切换为主库时,通过回调脚本或配置参数的形式,绑定VIP地址;当本节点数据库角色切换为备机时,主动解除VIP地址绑定。

5.1. 配置omm用户的sudo权限

echo 'omm ALL=(ALL:ALL) NOPASSWD:/sbin/ip,/sbin/arping,/sbin/iptables,/sbin/ifconfig'>>/etc/sudoers

注意:ip和arping命令需要结合实际操作系统路径进行修改

5.2. omm用户测试sudo权限

su - ommsudo ip addr add 10.x.x.x/24 brd 10.x.x.255 dev bond1 label bond1:1sudo arping -q -A -c 1 -I bond1 10.x.x.xsudo ip addr del 10.x.x.x/24 dev bond1 label bond1:1

5.3. 修改回调脚本

echo '
#!/bin/bash
# -------------------------------------------------------------------------------
# Filename:    cm_callback.sh
# Revision:    1.0
# Date:        2019/10/09
# Description: 
# Notes:       
#      callback 仅实现vip 的 添加和移除        
#              
# -------------------------------------------------------------------------------
# 
# -------------------------------------------------------------------------------readonly cb_name=$1
readonly role=$2
readonly scope=$3VIP=10.10.10.10  # vip 地址
VIPBRD=10.10.10.255 # 广播地址
VIPNETMASKBIT=24   # 掩码
VIPDEV=bondname     # 网络接口名称,vip会绑定到该接口
VIPLABEL=1   # 接口标签,默认为1PING_TIMEOUT=2 # 设置为不高于panweidb.yml配置文件里loop_wait的40%,如果loop_wait设置为10,PING_TIMEOUT建议设置为3,如果loop_wait设置为5,建议设置为2function usage() {echo "Usage: $0 <on_start|on_stop|on_role_change> <role> <scope>";exit 1;
}function addvip(){echo "`date +%Y-%m-%d\ %H:%M:%S,%3N` INFO: /sbin/ip addr add ${VIP}/${VIPNETMASKBIT} brd ${VIPBRD} dev ${VIPDEV} label ${VIPDEV}:${VIPLABEL}"sudo /sbin/ip addr add ${VIP}/${VIPNETMASKBIT} brd ${VIPBRD} dev ${VIPDEV} label ${VIPDEV}:${VIPLABEL}sudo /usr/sbin/arping -q -A -c 1 -I ${VIPDEV} ${VIP}#sudo /sbin/iptables -F}function delvip(){echo "`date +%Y-%m-%d\ %H:%M:%S,%3N` INFO: sudo /sbin/ip addr del ${VIP}/${VIPNETMASKBIT} dev ${VIPDEV} label ${VIPDEV}:${VIPLABEL}"sudo /sbin/ip addr del ${VIP}/${VIPNETMASKBIT} dev ${VIPDEV} label ${VIPDEV}:${VIPLABEL}#sudo /usr/sbin/arping -q -A -c 1 -I ${VIPDEV} ${VIP}#sudo /sbin/iptables -F}#if [[ $cb_name != "on_master_check"  ]]; then
#    echo "`date +%Y-%m-%d\ %H:%M:%S,%3N` WARNING: has callback $cb_name $role $scope"
#ficase $cb_name inon_stop)delvip;;on_start)if [[ $role == "master" ]]; thenaddvipfi;;on_role_change)if [[ $role == "master" ]]; thenaddvipelif [[ $role == "slave" ]]||[[ $role == "replica" ]]||[[ $role == "logical" ]]; thendelvipfi;;on_master_check)if [[ $role == "master" ]]; thenvip_status=`/sbin/ip addr|grep ${VIP}`if [[ ${vip_status} == "" ]]; thenecho "`date +%Y-%m-%d\ %H:%M:%S,%3N` WARNING: has callback $cb_name $role $scope"echo "`date +%Y-%m-%d\ %H:%M:%S,%3N` WARNING: The vip was lost,bind vip because i am leader"/usr/bin/ping -I ${VIPDEV} -q -c 3 -W ${PING_TIMEOUT} ${VIP}is_vip_used=$?if [[ $is_vip_used -eq 0 ]]; thenecho "`date +%Y-%m-%d\ %H:%M:%S,%3N` WARNING: The vip bind failed, ${VIP} is in use"elseaddvipfififi;; on_slave_check)if [[ $role == "slave" ]]; thenvip_status=`/sbin/ip addr|grep ${VIP}`if [[ ${vip_status} != "" ]]; thendelvipfifi;;  *)usage;;
esac
'>/database/panweidb/cm/cm_agent/cm_callback.sh

给脚本文件赋执行权限,用于在本节点数据库主备角色发生变化时,自动由集群管理服务执行绑定和释放VIP的操作。

chmod u+x /database/panweidb/cm/cm_agent/cm_callback.sh

5.4. 修改cm_agent.conf脚本

需要将原来的单引号去掉

echo 'callback_bin_path=/database/panweidb/cm/cm_agent/cm_callback.sh' >> /database/panweidb/cm/cm_agent/cm_agent.conf

5.5. 修改alarmConfig.conf脚本

需要将原来的单引号去掉

echo 'callback_bin_path=/database/panweidb/cm/cm_agent/cm_callback.sh' >> /database/panweidb/app/bin/alarmConfig.conf# 脚本授权
chown omm:  /database/panweidb/cm/cm_agent/cm_callback.sh
chmod 755  /database/panweidb/cm/cm_agent/cm_callback.sh

5.6. 重启集群

cm_ctl stop && cm_ctl start

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com