一、双机数据库安装
1、禁用防火墙及SElinux
systemctl stop firewalld
systemctl disable firewalld
sed -i -e 's,enforcing,disabled,' /etc/selinux/config
2、创建用户
groupadd dbgrp
useradd -g dbgrp -d /home/omm -m -s /bin/bash omm
echo redhat|passwd --stdin omm
3、解压缩安装包
mkdir -p /opt/software/gaussdb
cd /opt/software/gaussdb
tar -xf GaussDB_T_*.tar.gz
4、重启服务器
5、主节点安装
cd GaussDB_T_*
python install.py
-U omm:dbgrp \
-R /opt/gaussdb/app \
-D /opt/gaussdb/data \
-C LSNR_ADDR=127.0.0.1,192.168.120.28 \
-C LSNR_PORT=1888 \
-C REPL_PORT=1889 \
-C "ARCHIVE_DEST_2=SERVICE=192.168.120.29:1889 SYNC" \
-C SESSIONS=1500
6、备节点安装
cd GaussDB_T_*
python install.py
-U omm:dbgrp \
-R /opt/gaussdb/app \
-D /opt/gaussdb/data \
-C LSNR_ADDR=127.0.0.1,192.168.120.29 \
-C LSNR_PORT=1888 \
-C REPL_PORT=1889 \
-C "ARCHIVE_DEST_2=SERVICE=192.168.120.28:1889 SYNC" \
-O
7、备节点重建数据库
cd /opt/gaussdb/app/bin
python zctl.py -t build
8、模拟数据同步
zsql sys/[email protected]:1888
create table test(id int);
insert into test values (1);
insert into test values (2);
insert into test values (3);
select * from test;
9、主备倒换switchover
备机查询
select database_role,database_condition,switchover_status from dv_database;
主备切换
alter database switchover;
10、主备倒换failover
主机停止
shutdown immediate;
备机状态查询
select database_role,database_condition,switchover_status from dv_database;
备升主
alter database failover;
原主降备
python zctl.py -t demote
标签:opt,dbgrp,database,数据库,omm,test,HCNA,双机,gaussdb
From: https://blog.51cto.com/u_13236892/8535926