当前位置:   article > 正文

DM8-搭建读写分离集群_dm8读写分离 安装

dm8读写分离 安装

搭建读写分离集群
主机
内网:10.10.10.7
外网:192.168.152.133

备机
内网:10.10.10.8
外网:192.168.152.134

步骤一:主机脱机备份
关闭服务
cd /etc/init.d
./DmServiceDW_1 stop

到bin目录
./dmrman,使用dmrman工具脱机备份
脱机备份
BACKUP DATABASE ‘/home/dmdba/dmdbms/data/DW_1/dm.ini’ FULL BACKUPSET ‘/home/dmdba/bak/fullbak2’;

把主机全量备份的备份集拷贝到备机
scp -r /home/dmdba/bak/fullbak2 192.168.152.134:/home/dmdba/bak

restore database ‘/home/dmdba/dmdbms/dmdata/DW_2/dm.ini’ from backupset ‘/home/dmdba/bak/fullbak2’

recover database ‘/home/dmdba/dmdbms/dmdata/DW_2/dm.ini’ from backupset ‘/home/dmdba/bak/fullbak2’

recover database ‘/home/dmdba/dmdbms/dmdata/DW_2/dm.ini’ update db_magic

确认主备库的lsn和永久魔数是否一致
前台启动数据库,mount状态
./dmserver …/data/DW_1/dm.ini mount
./dmserver /home/dmdba/dmdbms/dmdata/DW_2/dm.ini mount
在这里插入图片描述
在这里插入图片描述

步骤二:配置主库的参数
主机
dm.ini配置参数
INSTANCE_NAME = DW_1
PORT_NUM = 5239
DW_INACTIVE_INTERVAL = 60
ALTER_MODE_STATUS = 0
ENABLE_OFFLINE_TS = 2
MAL_INI = 1
ARCH_INI = 1
RLOG_SEND_APPLY_MON = 64

dmmal.ini
MAL_CHECK_INTERVAL = 5
MAL_CONN_FAIL_INTERVAL = 5
[MAL_INST1]
MAL_INST_NAME = DW_1
MAL_HOST = 10.10.10.7
MAL_PORT = 61143
MAL_INST_HOST = 192.168.152.133
MAL_INST_PORT = 5239
MAL_DW_PORT = 52143
MAL_INST_DW_PORT=33143
[MAL_INST2]
MAL_INST_NAME = DW_2
MAL_HOST = 10.10.10.8
MAL_PORT = 61144
MAL_INST_HOST = 192.168.152.134
MAL_INST_PORT = 5239
MAL_DW_PORT = 52144
MAL_INST_DW_PORT=33144
dmarch.ini
[ARCHIVE_TIMELY1]
ARCH_TYPE = TIMELY
ARCH_DEST = DW_2
[ARCHIVE_LOCAL1]
ARCH_TYPE = LOCAL
ARCH_DEST = /home/dmdba/dmdbms/arch
ARCH_FILE_SIZE = 128
ARCH_SPACE_LIMIT = 10240

dmwatcher.ini
[GROUP_B]
DW_TYPE = GLOBAL
DW_MODE = AUTO
DW_ERROR_TIME = 10
INST_RECOVER_TIME = 60
INST_ERROR_TIME = 10
INST_OGUID = 453332
INST_INI = /home/dmdba/dmdbms/data/DW_1/dm.ini
INST_AUTO_RESTART = 1
INST_STARTUP_CMD = /home/dmdba/dmdbms/bin/dmserver
RLOG_SEND_THRESHOLD=0
RLOG_APPLY_THRESHOLD=0

以mount方式启动主库
设置OGUID
SQL>SP_SET_PARA_VALUE(1, ‘ALTER_MODE_STATUS’, 1);
SQL>sp_set_oguid(453332);
SQL>SP_SET_PARA_VALUE(1, ‘ALTER_MODE_STATUS’, 0);

修改数据库模式
alter database primary;

步骤三:配置备库参数
配置dm.ini
INSTANCE_NAME = DW_2
PORT_NUM = 5239
DW_INACTIVE_INTERVAL = 60
ALTER_MODE_STATUS = 0
ENABLE_OFFLINE_TS = 2
MAL_INI = 1
ARCH_INI = 1
RLOG_SEND_APPLY_MON = 64

dmmal.ini
MAL_CHECK_INTERVAL = 5
MAL_CONN_FAIL_INTERVAL = 5
[MAL_INST1]
MAL_INST_NAME = DW_1
MAL_HOST = 10.10.10.7
MAL_PORT = 61143
MAL_INST_HOST = 192.168.152.133
MAL_INST_PORT = 5239
MAL_DW_PORT = 52143
MAL_INST_DW_PORT=33143
[MAL_INST2]
MAL_INST_NAME = DW_2
MAL_HOST = 10.10.10.8
MAL_PORT = 61144
MAL_INST_HOST = 192.168.152.134
MAL_INST_PORT = 5239
MAL_DW_PORT = 52144
MAL_INST_DW_PORT=33144

dmarch.ini
[ARCHIVE_TIMELY1]
ARCH_TYPE = TIMELY
ARCH_DEST = DW_1
[ARCHIVE_LOCAL1]
ARCH_TYPE = LOCAL
ARCH_DEST = /home/dmdba/dmdbms/arch
ARCH_FILE_SIZE = 128
ARCH_SPACE_LIMIT = 10240

dmwatcher.ini
[GROUP_B]
DW_TYPE = GLOBAL
DW_MODE = AUTO
DW_ERROR_TIME = 10
INST_RECOVER_TIME = 60
INST_ERROR_TIME = 10
INST_OGUID = 453332
INST_INI = /home/dmdba/dmdbms/dmdata/DW_2/dm.ini
INST_AUTO_RESTART = 1
INST_STARTUP_CMD = /opt/dm/bin/dmserver
RLOG_SEND_THRESHOLD=0
RLOG_APPLY_THRESHOLD=0

mount状态启动备库
SQL>SP_SET_PARA_VALUE(1, ‘ALTER_MODE_STATUS’, 1);
SQL>sp_set_oguid(453332);
SQL>SP_SET_PARA_VALUE(1, ‘ALTER_MODE_STATUS’, 0);

数据库模式更改为STANDBY;
ALTER DATABASE STANDBY;

步骤四:配置监听器
配置监听器dmmonitor.ini
放到备库上
MON_DW_CONFIRM = 1
MON_LOG_PATH = /home/dmdba/dmdbms/dmdata/DW_2/log
MON_LOG_INTERVAL = 60
MON_LOG_FILE_SIZE = 32
MON_LOG_SPACE_LIMIT =0
[GROUP_B]
MON_INST_OGUID =453332
MON_DW_IP = 10.10.10.7:52143
MON_DW_IP = 10.10.10.8:52144

启动主备库守护进程
./dmwatcher /home/dmdba/dmdbms/data/DW_1/dmwatcher.ini
./dmwatcher /home/dmdba/dmdbms/dmdata/DW_2/dmwatcher.ini

启动监听器
./dmmonitor /home/dmdba/dmdbms/dmdata/DW_2/dmmonitor.ini
在这里插入图片描述
在这里插入图片描述

读写分离集群搭配完成

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小丑西瓜9/article/detail/615762
推荐阅读
相关标签
  

闽ICP备14008679号