1 前置条件
- 服务器已安装2节点DSC集群
- DSC节点服务器有root权限
- DSC节点服务器防火墙已关闭或开放所有配置涉及端口
- 备机已安装DM8并以DSC物理备份还原兼容模式初始化(主要是PAGE_SIZE、 BLANK_PAD_MODE、 CASE_SENSITIVE、 CHARSET/UNICODE_FLAG、 USE_NEW_HASH、 LENGTH_IN_CHAR、 PAGE_ENC_SLICE_SIZE、 ENCRYPT_NAME参数与DSC库一致)
- 如需安装监视器,则另需一台安装DM8的服务器
2 安装环境
- 操作系统:CentOS Linux release 7.9.2009 x64
- 硬盘空间:20G
- 软件版本:DM8企业版
- 共享存储:30G(仅虚拟机测试)
2.1 服务器信息
IP地址 | EP_SEQNO | EP_NAME | OGUID | 安装目录 | 备注 |
---|---|---|---|---|---|
192.168.11.131 | 0 | DSC0 | 313239 | /dmdb/data | DSC节点1 |
192.168.11.132 | 1 | DSC1 | 313239 | /dmdb/data | DSC节点2 |
192.168.11.139 | DSCS | 313239 | /opt/dmdb/data/ | 单实例备机 | |
192.168.11.133 | 313239 | 监视器 |
2.2 MAL通信
MAL_INST_NAME | MAL_HOST/ MAL_INST_HOST | MAL_PORT | MAL_INST_PORT | MAL_DW_PORT | MAL_INST_DW_PORT |
---|---|---|---|---|---|
DSC0 | 192.168.11.131 | 40131 | 5236 | 51131 | 61131 |
DSC1 | 192.168.11.132 | 40132 | 5236 | 51132 | 61132 |
DSCS | 192.168.11.139 | 40139 | 5236 | 51139 | 61139 |
3 安装步骤
3.1 准备数据
物理备份DSC集群数据库
[dmdba@localhost ~]$ dmrman dcr_ini=/dmdb/data/dmdcr.ini use_ap=2 ctlstmt="backup database '/dmdb/data/dsc0_config/dm.ini' backupset '/opt/dmdb/dsc_bak'"
复制备份数据到实时备机139
[dmdba@localhost ~]$ scp -r /opt/dmdb/dsc_bak/ dmdba@192.168.11.133:/opt/dmdb/
3.2 恢复备机
# 139备机
[dmdba@localhost ~]$ dmrman use_ap=2 ctlstmt="restore database '/opt/dmdb/data/DAMENG/dm.ini' from backupset '/opt/dmdb/dsc_bak'"
[dmdba@localhost ~]$ dmrman use_ap=2 ctlstmt="recover database '/opt/dmdb/data/DAMENG/dm.ini' from backupset '/opt/dmdb/dsc_bak'"
[dmdba@localhost ~]$ dmrman use_ap=2 ctlstmt="recover database '/opt/dmdb/data/DAMENG/dm.ini' update db_magic"
3.3 实例参数 - dm.ini
# 3个实例参数分别做以下参数修改
# 131节点
INSTANCE_NAME = DSC0
ALTER_MODE_STATUS = 0
ENABLE_OFFLINE_TS = 2
MAL_INI = 1
ARCH_INI = 1
# 132节点
INSTANCE_NAME = DSC1
ALTER_MODE_STATUS = 0
ENABLE_OFFLINE_TS = 2
MAL_INI = 1
ARCH_INI = 1
# 139节点
INSTANCE_NAME = DSCS
ALTER_MODE_STATUS = 0
ENABLE_OFFLINE_TS = 2
MAL_INI = 1
ARCH_INI = 1
3.4 MAL通信 – dmmal.ini
# 3个节点实例完全一致
MAL_CHECK_INTERVAL = 5
MAL_CONN_FAIL_INTERVAL = 5
[MAL_INST0]
MAL_INST_NAME = DSC0
MAL_HOST = 192.168.11.131
MAL_PORT = 40131
MAL_INST_HOST = 192.168.11.131
MAL_INST_PORT = 5236
MAL_DW_PORT = 51131
MAL_INST_DW_PORT = 61131
[MAL_INST1]
MAL_INST_NAME = DSC1
MAL_HOST = 192.168.11.132
MAL_PORT = 40132
MAL_INST_HOST = 192.168.11.132
MAL_INST_PORT = 5236
MAL_DW_PORT = 51132
MAL_INST_DW_PORT = 61132
[MAL_INST2]
MAL_INST_NAME = DSCS
MAL_HOST = 192.168.11.139
MAL_PORT = 40139
MAL_INST_HOST = 192.168.11.139
MAL_INST_PORT = 5236
MAL_DW_PORT = 51139
MAL_INST_DW_PORT = 61139
3.5 实时归档 – dmarch.ini
# 131节点
ARCH_LOCAL_SHARE = 1
[ARCHIVE_LOCAL1]
ARCH_TYPE = LOCAL
ARCH_DEST =+DMDATA/DSC0/arch
ARCH_FILE_SIZE = 128
ARCH_SPACE_LIMIT = 0
[ARCH_REMOTE1]
ARCH_TYPE = REMOTE
ARCH_DEST = DSC1
ARCH_INCOMING_PATH =+DMDATA/DSC1/arch
ARCH_FILE_SIZE = 128
ARCH_SPACE_LIMIT = 0
[ARCH_SLAVE]
ARCH_TYPE = REALTIME
ARCH_DEST = DSCS
################################################
# 132节点
ARCH_LOCAL_SHARE = 1
[ARCHIVE_LOCAL1]
ARCH_TYPE = LOCAL
ARCH_DEST =+DMDATA/DSC1/arch
ARCH_FILE_SIZE = 128
ARCH_SPACE_LIMIT = 0
[ARCH_REMOTE1]
ARCH_TYPE = REMOTE
ARCH_DEST = DSC0
ARCH_INCOMING_PATH =+DMDATA/DSC0/arch
ARCH_FILE_SIZE = 128
ARCH_SPACE_LIMIT = 0
[ARCH_SLAVE]
ARCH_TYPE = REALTIME
ARCH_DEST = DSCS
################################################
# 139节点
[ARC_LOCAL1]
ARCH_TYPE = LOCAL
ARCH_DEST = /opt/dmdb/data/DAMENG/arch
ARCH_FILE_SIZE = 128
ARCH_SPACE_LIMIT = 0
[ARCH_SLAVE]
ARCH_TYPE = REALTIME
ARCH_DEST = DSC0/DSC1
3.6 配置守护 – dmwatcher.ini
# 131节点
cat > /dmdb/data/dsc0_config/dmwatcher.ini << EOF
[GRP_DSC]
DW_TYPE = GLOBAL
DW_MODE = MANUAL
DW_ERROR_TIME = 60
INST_RECOVER_TIME = 60
INST_ERROR_TIME = 30
INST_OGUID = 313239
INST_INI = /dmdb/data/dsc0_config/dm.ini
DCR_INI = /dmdb/data/dmdcr.ini
INST_AUTO_RESTART = 0
INST_STARTUP_CMD = /opt/dmdb/dmdbms/bin/dmserver
EOF
# 132节点
cat > /dmdb/data/dsc1_config/dmwatcher.ini << EOF
[GRP_DSC]
DW_TYPE = GLOBAL
DW_MODE = MANUAL
DW_ERROR_TIME = 60
INST_RECOVER_TIME = 60
INST_ERROR_TIME = 30
INST_OGUID = 313239
INST_INI = /dmdb/data/dsc1_config/dm.ini
DCR_INI = /dmdb/data/dmdcr.ini
INST_AUTO_RESTART = 0
INST_STARTUP_CMD = /opt/dmdb/dmdbms/bin/dmserver
EOF
# 139节点
cat > /opt/dmdb/data/DAMENG/dmwatcher.ini << EOF
[GRP_DSC]
DW_TYPE = GLOBAL
DW_MODE = MANUAL
DW_ERROR_TIME = 60
INST_RECOVER_TIME = 60
INST_ERROR_TIME = 30
INST_OGUID = 313239
INST_INI = /opt/dmdb/data/DAMENG/dm.ini
INST_AUTO_RESTART = 0
INST_STARTUP_CMD = /opt/dmdb/dmdbms/bin/dmserver
EOF
3.7 重启CSS和ASM服务
# 131节点
[dmdba@localhost ~]$ killall dmcss dmasmsvr
[dmdba@localhost ~]$ /opt/dmdb/dmdbms/bin/dmcss DCR_INI=/dmdb/data/dmdcr.ini
[dmdba@localhost ~]$ /opt/dmdb/dmdbms/bin/dmasmsvr DCR_INI=/dmdb/data/dmdcr.ini
# 132节点
[dmdba@localhost ~]$ killall dmcss dmasmsvr
[dmdba@localhost ~]$ /opt/dmdb/dmdbms/bin/dmcss DCR_INI=/dmdb/data/dmdcr.ini
[dmdba@localhost ~]$ /opt/dmdb/dmdbms/bin/dmasmsvr DCR_INI=/dmdb/data/dmdcr.ini
3.8 mount启动所有实例
# 131节点
[dmdba@localhost ~]$ dmserver /dmdb/data/dsc0_config/dm.ini mount
# 132节点
[dmdba@localhost ~]$ dmserver /dmdb/data/dsc1_config/dm.ini mount
# 139节点
[dmdba@localhost ~]$ dmserver /opt/dmdb/data/DAMENG/dm.ini mount
将生成的另一节点配置文件目录dsc1_config复制到132节点对应目录
[dmdba@localhost ~]$ scp -r /dmdb/data/dsc1_config/ dmdba@192.168.11.132:/dmdb/data/
3.9 设置库模式、OGUID
# 131或者132节点
[dmdba@localhost ~]$ disql SYSDBA/SYSDBA@localhost:5236
SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 1);
SP_SET_OGUID(313239);
ALTER DATABASE PRIMARY;
SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 0)
# 139节点
[dmdba@localhost ~]$ disql SYSDBA/SYSDBA@localhost:5236
SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 1);
SP_SET_OGUID(313239);
ALTER DATABASE STANDBY;
SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 0)
3.10 启动守护服务
# 131节点
[dmdba@localhost ~]$ dmwatcher /dmdb/data/dsc0_config/dmwatcher.ini
# 132节点
[dmdba@localhost ~]$ dmwatcher /dmdb/data/dsc1_config/dmwatcher.ini
# 139节点
[dmdba@localhost ~]$ dmwatcher /opt/dmdb/data/DAMENG/dmwatcher.ini
3.11 监视器配置 – dmmonitor.ini
# 133节点
[dmdba@localhost ~]$ cat > /opt/dmdb/data/DAMENG/dmmonitor.ini << EOF
MON_DW_CONFIRM = 1
MON_LOG_PATH = /opt/dmdb/data/DAMENG/log/monitor
MON_LOG_INTERVAL = 60
MON_LOG_FILE_SIZE = 32
MON_LOG_SPACE_LIMIT = 0
[GRP_DSC]
MON_INST_OGUID = 313239
MON_DW_IP = 192.168.11.131:51131/192.168.11.132:51132
MON_DW_IP = 192.168.11.132:51139
EOF
# 启动监视器
[dmdba@localhost ~]$ dmmonitor /opt/dmdb/data/DAMENG/dmmonitor.ini
4 功能测试
4.1 数据同步
# 任选一个DSC节点登陆(这里选择131节点)
[dmdba@localhost ~]$ disql SYSDBA/SYSDBA@192.168.11.131
服务器[192.168.11.131:5236]:处于普通打开状态
登录使用时间 : 10.638(ms)
disql V8
SQL> create user test IDENTIFIED BY testuserpwd;
SQL> create table test.tb_test (username VARCHAR(50) );
SQL> insert into test.tb_test(username)values('jc');
SQL> commit;
SQL> select * from test.tb_test;
行号 USERNAME
---------- --------
1 jc
# 登陆139备库
[dmdba@localhost ~]$ disql SYSDBA/SYSDBA@192.168.11.139
服务器[192.168.11.139:5236]:处于备库打开状态
登录使用时间 : 7.984(ms)
disql V8
SQL> select * from test.tb_test;
行号 USERNAME
---------- --------
1 jc
已用时间: 4.226(毫秒). 执行号:300.
SQL>