目录
- 环境
- 主备机分别完成以下操作
- 主机操作
- 备机操作
- 同步验证
环境
主备库 | 云环境规格 | 操作系统 | 主机名 | IP地址 | 端口号 |
---|---|---|---|---|---|
主库 | 4vCPUs 8G | EulerOS 2.8 64bit with ARM | THR102-0001 | 192.168.0.164 | 1888 |
备库 | 4vCPUs 8G | EulerOS 2.8 64bit with ARM | THR102-0002 | 192.168.0.231 | 1888 |
主备机分别完成以下操作
- 创建用户及用户组
groupadd dbgrp
useradd -g dbgrp -d /home/omm -m -s /bin/bash omm
- 修改OMM用户密码
passwd omm
- 创建软件目录
mkdir -p /opt/software/gaussdb
- 进入目录并上传软件
GaussDB_T_1.0.2-EULER20SP8-ARM-64bit.tar.gz
主机操作
- 解压软件
[[email protected] ~]# cd /opt/software/gaussdb/
[[email protected] gaussdb]# ls
GaussDB_T_1.0.2-EULER20SP8-ARM-64bit.tar.gz
[[email protected] gaussdb]# tar -zxvf GaussDB_T_1.0.2-EULER20SP8-ARM-64bit.tar.gz
- 解压数据库
[[email protected] gaussdb]# tar -zxvf GaussDB_T_1.0.2-DATABASE-EULER20SP8-64bit.tar.gz
- 进入目录执行安装
[[email protected] gaussdb]# cd GaussDB_T_1.0.2-DATABASE-EULER20SP8-64bit/
[[email protected] GaussDB_T_1.0.2-DATABASE-EULER20SP8-64bit]# python install.py -U omm:dbgrp -R /opt/gaussdb/app -D /opt/gaussdb/data -C LSNR_ADDR=127.0.0.1,192.168.0.164 -C LSNR_PORT=1888 -C REPL_PORT=1889 -C "LOG_ARCHIVE_DEST_2=SERVICE=192.168.0.231:1889 SYNC"
# 输出信息
Checking runner.
Checking parameters.
End check parameters.
Checking user.
End check user.
Checking old install.
End check old install.
Checking kernel parameters.
Checking directory.
Checking integrality of run file...
Decompressing run file.
Setting user env.
Checking data dir and config file
Initialize db instance.
Creating database.
Creating database succeed.
Changing file permission due to security audit.
Install successfully, for more detail information see /home/omm/zengineinstall.log.
- 登录数据库查询主机角色
[[email protected] GaussDB_T_1.0.2-DATABASE-EULER20SP8-64bit]# cd
[[email protected] ~]# su - omm
Last login: Mon Mar 23 18:44:52 CST 2020
[[email protected] ~]$ zsql / as sysdba -q
connected.
SQL> select database_role from dv_database;
DATABASE_ROLE
------------------------------
PRIMARY
1 rows fetched.
备机操作
- 解压软件
[[email protected] ~]# cd /opt/software/gaussdb/
[[email protected] gaussdb]# ls
GaussDB_T_1.0.2-EULER20SP8-ARM-64bit.tar.gz
[[email protected] gaussdb]# tar -zxvf GaussDB_T_1.0.2-EULER20SP8-ARM-64bit.tar.gz
- 解压数据库
[[email protected] gaussdb]# tar -zxvf GaussDB_T_1.0.2-DATABASE-EULER20SP8-64bit.tar.gz
- 进入目录执行安装
[[email protected] gaussdb]# cd GaussDB_T_1.0.2-DATABASE-EULER20SP8-64bit/
[[email protected] GaussDB_T_1.0.2-DATABASE-EULER20SP8-64bit]# python install.py -U omm:dbgrp -R /opt/gaussdb/app -D /opt/gaussdb/data -C LSNR_ADDR=127.0.0.1,192.168.0.231 -C LSNR_PORT=1888 -C REPL_PORT=1889 -C "LOG_ARCHIVE_DEST_2=SERVICE=192.168.0.164:1889 SYNC" -O
# 输出信息
Checking runner.
Checking parameters.
End check parameters.
Checking user.
End check user.
Checking old install.
End check old install.
Checking kernel parameters.
Checking directory.
Checking integrality of run file...
Decompressing run file.
Setting user env.
Checking data dir and config file
Initialize db instance.
Changing file permission due to security audit.
Install successfully, for more detail information see /home/omm/zengineinstall.log.
- 执行脚本
[[email protected] GaussDB_T_1.0.2-DATABASE-EULER20SP8-64bit]# su - omm
[[email protected] ~]$ cd /opt/gaussdb/app/bin/
[[email protected] bin]$ python zctl.py -t build
# 输出信息
Check if incremental build is available ...
Begin to shutdown database ...
Done
Begin to clear data and log ...
Done
Begin to startup instance nomount ...
Done
Is incremental build: False
Begin to build database ...
Done
Successfully build database
- 登录数据库查询备机角色
[[email protected] bin]$ zsql / as sysdba -q
connected.
SQL> select database_role from dv_database;
DATABASE_ROLE
------------------------------
PHYSICAL_STANDBY
1 rows fetched.
同步验证
- 主库创建测试表插入数据
SQL> create table henry(id number);
Succeed.
SQL> insert into henry values(1);
1 rows affected.
SQL> commit;
Succeed.
SQL> select * from henry;
ID
----------------------------------------
1
1 rows fetched.
- 备库查询验证
SQL> select * from henry;
ID
----------------------------------------
1
1 rows fetched.
原文地址:https://www.cnblogs.com/askscuti/p/12553986.html
时间: 2024-10-09 11:11:13