配置虚拟机网络并安装麒麟v10操作系统
三个节点的IP分别为
主:192.168.88.88
备:192.168.88.89
监控:192.168.88.90
在各节点执行以下准备工作:
#创建达梦用户组和用户 并设置dmdba的密码
groupadd dinstall
useradd -g dinstall dmdba
passwd dmdba
#关闭并禁用防火墙
systemctl stop firewalld
systemctl disable firewalld
#修改selinux
sed -i "s/SELINUX=enforcing/SELINUX=disabled/g" /etc/selinux/config
#修改系统设置
vim /etc/security/limits.conf
#新增或修改最大进程数和最大文件数
* soft nofile 65535
* hard nofile 65535
* soft nproc 65535
* hard nproc 65535
安装达梦数据库(使用dm8_20231109_x86版本 安装路径为/home/dmdba/dmdbms)
并先在主库做如下操作
MAL_INI = 1 ## 0改为1
ARCH_INI = 1 ## 0改为1
ALTER_MODE_STATUS = 0 #1改为0
ENABLE_OFFLINE_TS = 2 #1改为2
INSTANCE_NAME = DM01 #修改为自己需要的主库实例名
参考samples下的文件在主库下创建dmmal.ini、dmarch.ini、dmwatcher.ini
#切换dmdba用户创建一下配置文件
su - dmdba
cp /home/dmdba/dmdbms/samples/ini_script/UTF-8/dmmal_example.ini /home/dmdba/dmdbms/data/DAMENG/dmmal.ini
cp /home/dmdba/dmdbms/samples/ini_script/UTF-8/dmarch_example.ini /home/dmdba/dmdbms/data/DAMENG/dmarch.ini
cp /home/dmdba/dmdbms/samples/ini_script/UTF-8/dmwatcher_example.ini /home/dmdba/dmdbms/data/DAMENG/dmwatcher.ini
#修改dmmal.ini
MAL_CHECK_INTERVAL = 5
MAL_CONN_FAIL_INTERVAL = 5
[MAL_INST1]
MAL_INST_NAME = DM01 #实例名,和dm.ini中的INSTANCE_NAME一致
MAL_HOST = 192.168.88.88
MAL_PORT = 15236
MAL_INST_HOST = 192.168.88.88 #主机实例对外服务地址
MAL_INST_PORT = 5236 #实例对外服务端口,和dm.ini中的PORT_NUM一致
MAL_DW_PORT = 15238
MAL_INST_DW_PORT = 5238 #sample文件中没有,需要手动加上
[MAL_INST2]
MAL_INST_NAME = DM02 #根据备机实例名修改
MAL_HOST = 192.168.88.89
MAL_PORT = 15236
MAL_INST_HOST = 192.168.88.89
MAL_INST_PORT = 5236
MAL_DW_PORT = 15238
MAL_INST_DW_PORT = 5238
#修改dmarch.ini
[ARCHIVE_LOCAL1]
ARCH_TYPE = LOCAL
ARCH_DEST = /home/dmdba/dmdbms/data/DAMENG/arch
ARCH_FILE_SIZE = 128
ARCH_SPACE_LIMIT = 0
[ARCHIVE_REALTIME]
ARCH_TYPE = REALTIME
ARCH_DEST = DM02 #实时归档目标实例名(主机配置向备机同步)
#修改dmwatch.ini
[GROUP_A]
DW_TYPE = GLOBAL
DW_MODE = AUTO
DW_ERROR_TIME = 10
INST_ERROR_TIME = 10
INST_OGUID = 666666
INST_INI = /home/dmdba/dmdbms/data/DAMENG/dm.ini
INST_AUTO_RESTART = 1
INST_STARTUP_CMD = service DmServiceDM01 restart
INST_RECOVER_TIME = 60
#使用命令行注册主机数据库实例服务和数据库守护服务
cd /home/dmdba/dmdbms/script/root/
./dm_service_installer.sh -t dmserver -p DM01 -dm_ini /home/dmdba/dmdbms/data/DAMENG/dm.ini
./dm_service_installer.sh -t dmwatcher -p DM01 -watcher_ini /home/dmdba/dmdbms/data/DAMENG/dmwatcher.ini
#主机进行备份
cd /home/dmdba/dmdbms/bin/
su - dmdba
./dmrman
RMAN> backup database '/home/dmdba/dmdbms/data/DAMENG/dm.ini' backupset '/home/dmdba/dmdbms/backup';
RMAN> exit
scp -r /home/dmdba/dmdbms/backup/ dmdba@192.168.88.89:/home/dmdba/dmdbms/backup/
cd /home/dmdba/dmdbms/data/DAMENG
scp dmmal.ini dmdba@192.168.88.89:/home/dmdba/dmdbms/data/DAMENG/
scp dmarch.ini dmdba@192.168.88.89:/home/dmdba/dmdbms/data/DAMENG/
scp dmwatcher.ini dmdba@192.168.88.89:/home/dmdba/dmdbms/data/DAMENG/
#切换到备机 进行还原和修改部分配置文件
cd /home/dmdba/dmdbms/bin/
su - dmdba
./dmrman
RMAN> restore database '/home/dmdba/dmdbms/data/DAMENG/dm.ini' from backupset '/home/dmdba/dmdbms/backup';
RMAN> recover database '/home/dmdba/dmdbms/data/DAMENG/dm.ini' update db_magic;
RMAN> exit
#修改dm.ini
MAL_INI = 1 ## 0改为1
ARCH_INI = 1 ## 0改为1
ALTER_MODE_STATUS = 0 #1改为0
ENABLE_OFFLINE_TS = 2 #1改为2
INSTANCE_NAME = DM02
#修改dmwatch.ini
INST_STARTUP_CMD = service DmServiceDM02 restart
#修改dmarch.ini
ARCH_DEST = DM01 #实时归档目标实例名(备机指向主机)
#注册备机数据库实例服务和数据库守护服务
cd /home/dmdba/dmdbms/script/root/
./dm_service_installer.sh -t dmserver -p DM02 -dm_ini /home/dmdba/dmdbms/data/DAMENG/dm.ini
./dm_service_installer.sh -t dmwatcher -p DM02 -watcher_ini /home/dmdba/dmdbms/data/DAMENG/dmwatcher.ini
cd /home/dmdba/dmdbms/bin/
./DmServiceDM01 start mount
#修改主机为 Primary 模式,并修改主机的 OGUID 为之前 dmwatch.ini 中配置的 666666
./disql SYSDBA/SYSDBA
SQL> alter database primary;
操作已执行
已用时间: 19.164(毫秒). 执行号:0.
SQL> SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS',1);
DMSQL 过程已成功完成
已用时间: 16.242(毫秒). 执行号:101.
SQL> sp_set_oguid(666666);
DMSQL 过程已成功完成
已用时间: 3.793(毫秒). 执行号:102.
SQL> SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS',0);
DMSQL 过程已成功完成
已用时间: 5.281(毫秒). 执行号:103.
SQL> exit
cd /home/dmdba/dmdbms/bin/
./DmServiceDM01 start mount
#修改备机为 Standby 模式,并修改备机的 OGUID 为之前 dmwatch.ini 中配置的 666666
./disql SYSDBA/SYSDBA
SQL> alter database standby;
操作已执行
已用时间: 19.164(毫秒). 执行号:0.
SQL> SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS',1);
DMSQL 过程已成功完成
已用时间: 16.242(毫秒). 执行号:101.
SQL> sp_set_oguid(666666);
DMSQL 过程已成功完成
已用时间: 3.793(毫秒). 执行号:102.
SQL> SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS',0);
DMSQL 过程已成功完成
已用时间: 5.281(毫秒). 执行号:103.
SQL> exit
#主机
cd /home/dmdba/dmdbms/bin
./DmWatcherServiceDM01 start
#备机
cd /home/dmdba/dmdbms/bin
./DmWatcherServiceDM02 start
#参考sample中的配置文件
cp /home/dmdba/dmdbms/samples/ini_script/UTF-8/dmmonitor_example.ini /home/dmdba/dmdbms/data/DAMENG/dmmonitor.ini
#修改dmmonitor.ini
MON_DW_CONFIRM = 1
MON_LOG_PATH = /home/dmdba/dmdbms/log
MON_LOG_INTERVAL = 60
MON_LOG_FILE_SIZE = 32
MON_LOG_SPACE_LIMIT = 0
[GROUP_A] #与之前 dmwatch.ini 中的 [GROUP] 名称一致
MON_INST_OGUID = 666666 #与之前 dmwatch.ini 中的 INST_OGUID 名称一致
MON_DW_IP = 192.168.88.88:15238 #主备 dmwatcher 的IP和端口
MON_DW_IP = 192.168.88.89:15238
#创建监视器服务
cd /home/dmdba/dmdbms/script/root
./dm_service_installer.sh -t dmmonitor -p DMMON -monitor_ini /home/dmdba/dmdbms/data/DAMENG/dmmonitor.ini
文章
阅读量
获赞