主:10.37.129.11
备:10.37.129.12
新增备:10.37.129.14
关闭防火墙
setenforce 0
getenforce
systemctl stop firewalld
systemctl disable firewalld
systemctl status firewalld
service iptable stop
chkconfig iptables off
iptables -L
iptables -F
关闭内置安全模块
sed -i ‘s/enforcing/disabled/g’ /etc/sysconfig/selinux
cat /etc/sysconfig/selinux
修改ipc (os7以上版本)
sed -i ‘s/RemoveIPC=yes/RemoveIPC=no/g’ /etc/systemd/logind.conf
systemctl restart systemd-logind
systemctl status systemd-logind
修改limit
cat /etc/security/limits.conf |grep -v ^#
sed -i ‘
a
∗
s
o
f
t
n
o
f
i
l
e
65536
0
′
/
e
t
c
/
s
e
c
u
r
i
t
y
/
l
i
m
i
t
s
.
c
o
n
f
s
e
d
−
i
′
a * soft nofile 655360' /etc/security/limits.conf sed -i '
a∗softnofile655360′/etc/security/limits.confsed−i′a * hard nofile 655360’ /etc/security/limits.conf
sed -i ‘
a
∗
s
o
f
t
n
p
r
o
c
u
n
l
i
m
i
t
e
d
′
/
e
t
c
/
s
e
c
u
r
i
t
y
/
l
i
m
i
t
s
.
c
o
n
f
s
e
d
−
i
′
a * soft nproc unlimited' /etc/security/limits.conf sed -i '
a∗softnproc unlimited′/etc/security/limits.confsed−i′a * hard nproc unlimited’ /etc/security/limits.conf
sed -i ‘
a
∗
s
o
f
t
c
o
r
e
u
n
l
i
m
i
t
e
d
′
/
e
t
c
/
s
e
c
u
r
i
t
y
/
l
i
m
i
t
s
.
c
o
n
f
s
e
d
−
i
′
a * soft core unlimited' /etc/security/limits.conf sed -i '
a∗softcore unlimited′/etc/security/limits.confsed−i′a * hard core unlimited’ /etc/security/limits.conf
创建用户
useradd kingbase
echo kingbase| passwd --stdin kingbase
从已有节点拷贝集群相关目录和文件 --(除了data目录下的数据)
scp -r /home/kingbase/cluster/kingbase/* 10.37.129.14:/home/kingbase/cluster/kingbase
配置ip和arping可执行文件的权限
chmod 4755 /sbin/ip
chmod 4755 /sbin/arping
配置互信
ssh-keygen -t rsa
ssh-copy-id 10.37.129.11
ssh-copy-id 10.37.129.12
ssh-copy-id 10.37.129.14
ssh 10.37.129.11
ssh 10.37.129.12
ssh 10.37.129.14
#初始化,主要初始化sys_securecmdd/sys_securecmd需要的配置文件和秘钥协商
cd /home/kingbase/cluster/securecmdd/bin
sh sys_HAscmdd.sh init
successfully initialized the sys_securecmdd, please use “./sys_HAscmdd.sh start” to start the sys_securecmdd
./sys_HAscmdd.sh start
ln -s ‘/etc/systemd/system/securecmdd.service’ ‘/etc/systemd/system/multi-user.target.wants/securecmdd.service’
启动服务
sh sys_HAscmdd.sh start
ps -ef |grep secure
netstat -antlp |grep 8890
systemctl status securecmdd
cd ~
ls -la .encpwd
scp .encpwd 10.37.129.14:/home/kingbase
查看集群节点状态
repmgr cluster show
查看主备流复制状态
select * from sys_stat_replication;
主库上建立新备库的replication slot
select sys_create_physical_replication_slot(‘repmgr_slot_3’);
select * from sys_replication_slots;
在新节点执行clone预演 – -h ip为已有备库地址
./repmgr standby clone -h 10.37.129.12 -U esrep -d esrep --dry-run
在新节点执行clone --ip为已有备库地址
./repmgr standby clone -h 10.37.129.12 -U esrep -d esrep
启动新备库数据库服务
sys_ctl -D /home/kingbase/cluster/projectName/cluster/kingbase/data start
修改集群参数文件
vim repmgr.conf
注册备库到集群
repmgr standby register --force
查看集群节点状态
repmgr cluster show
主节点查看集群状态
查看新增节点数据库日志
tail -50 /home/kingbase/KingbaseES/V8/data/sys_log/*.csv
从日志信息可知,node3通过"repmgr_slot_3"复制槽做流复制连接,而复制槽不存在