数据守护集群和读写分离集群的配置上,只有归档模式不同,其他配置步骤相同。
启动过程:开主机实例——开主机守护进程——开备机实例——开备机守护进程——打开确认监视器
关闭过程:关闭确认监视器——关闭备机守护进程——关闭主机守护进程——关闭主机实例服务——关闭备机实例服务
环境准备,测'试环境下把确认监视器放在了备机上。主备机分别装好了数h据库,但是还没有初始化
应用 |
Ip |
prot |
主机DM22 |
192.168.109.22 |
PORT_NUM/MAL_INST_PORT= 5236 |
主机DM22 |
192.168.109.22 |
MAL_DW_PORT = 53141 |
主机DM22 |
192.168.109.22 |
MAL_INST_DW_PORT = 34141 |
主机DM22 |
|
MAL_PORT = 62141 |
备机DM23 |
192.168.109.23 |
PORT_NUM/MAL_INST_PORT= 5236 |
备机DM23 |
192.168.109.23 |
MAL_DW_PORT = 53142 |
备机DM23 |
192.168.109.23 |
MAL_INST_DW_PORT = 34142 |
|
|
MAL_PORT = 62142 |
监视器 |
192.168.109.23 |
|
配置前记得使用root用户检查主备机的防火墙有没有关
#检查防火墙状态:systemctl status firewalld
#永久关闭防火墙:systemctl disable firewalld
Systemctl stop firewalld
path |
/home/dmdba/dmdbms/data/ |
Page_size |
16 |
./dminit PATH=/home/dmdba/dmdbms/data PAGE_SIZE=16 CASE_SENSITIVE=1
./dmserver /home/dmdba/dmdbms/data/DAMENG/dm.ini
exit
./dminit PATH=/home/dmdba/dmdbms/data PAGE_SIZE=16 CASE_SENSITIVE=1
./dmserver /home/dmdba/dmdbms/data/DAMENG/dm.ini
exit
./dmrman ctlstmt="backup database '/home/dmdba/dmdbms/data/DAMENG/dm.ini' full to backup_file1 backupset '/home/dmdba/dmdbms/data/backup_file_01'"
scp -r /home/dmdba/dmdbms/data/backup_file_01/ [email protected]:/home/dmdba/dmdbms/data
还原:./dmrman ctlstmt="restore database '/home/dmdba/dmdbms/data/DAMENG/dm.ini' from backupset '/home/dmdba/dmdbms/data/backup_file_01'"
恢复:./dmrman ctlstmt="recover database '/home/dmdba/dmdbms/data/DAMENG/dm.ini' from backupset '/home/dmdba/dmdbms/data/backup_file_01'"
更新db_magic:
./dmrman ctlstmt="recover database '/home/dmdba/dmdbms/data/DAMENG/dm.ini' update db_magic"
修改INSTANCE_NAME为DM22
MAL_INI=1
ARCH_INI=1
ALTER_MODE_STATUS= 0
ENABLE_OFFLINE_TS = 2
主机:模式修改为primary
SQL> SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 1);
SQL> sp_set_oguid(453331);
SQL> alter database primary;
SQL> SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 0);
备机:模式修改为standby
主库:
./dm_service_installer.sh -t dmserver -m mount -dm_ini /home/dmdba/dmdbms/data/DAMENG/dm.ini -p DM22
./dm_service_installer.sh -t dmwatcher -watcher_ini /home/dmdba/dmdbms/data/DAMENG/dmwatcher.ini -p DM22
备库:
./dm_service_installer.sh -t dmserver -m mount -dm_ini /home/dmdba/dmdbms/data/DAMENG/dm.ini -p DM23
./dm_service_installer.sh -t dmwatcher -watcher_ini /home/dmdba/dmdbms/data/DAMENG/dmwatcher.ini -p DM23