目录
1、概述
DM8提供了系统函数,可以动态增加 MAL 中的节点信息。当需要进行系统扩容,希望系统运行不中断,或者影响运行的时间尽可能短时,可通过动态增加节点的方式进行。
2、实验环境
2.1环境信息
操作系统:CentOS7.6
达梦数据库版本:DM8_20240712
达梦守护集群版本:V4.0
集群主库:192.168.220.101
集群备库:192.168.220.102
集群确认监视器:192.168.220.109
新备库IP:192.168.220.109
注:建议生产环境备库与监视器安装到不同的主机
2.2配置信息
MAL_PORT : 62361
MAL_INST_PORT : 6236
MAL_DW_PORT : 7222
MAL_INST_DW_PORT : 62362
组名:DM8DW
OGUID:241007001
库名:DM8DW
主库实例名:DM8DW01
原备库实例名:DM8DW02
新备库实例名:DM8DW03
2.3 查看初始化参数
在原主库执行
SELECT '字符集',CASE SF_GET_UNICODE_FLAG() WHEN '0' THEN 'GBK18030' WHEN '1' then 'UTF-8' when '2' then 'EUC-KR' end union all
SELECT '页大小',cast(PAGE()/1024 as varchar) union all
SELECT '簇大小',cast(SF_GET_EXTENT_SIZE() as varchar) union all
select 'id_code',id_code from dual;
3、动态增加实时备库
3.1数据准备
联机备份主库数据
su - dmdba
disql SYSDBA/SYSDBA
SQL> backup database backupset '/dm8/backup/full_bak_20241102_001';
scp -r /dm8/backup/full_bak_20241102_001 192.168.220.109:/dm8/backup
3.2配置新备库
1)安装DM8软件
步骤略
2)初始化数据库
dminit path=/dm8/datadm EXTENT_SIZE=32 PAGE_SIZE=32 DB_NAME=DM8DW INSTANCE_NAME=DM8DW03 LOG_SIZE=256
#完成首次启动
dmserver /dm8/datadm/DM8DW/dm.ini
#关闭服务
exit
#root权限注册服务
cd /dm8/dmdbms/script/root
./dm_service_installer.sh -t dmserver -p DM8DW03 -dm_ini /dm8/datadm/DM8DW/dm.ini
./dm_service_installer.sh -t dmwatcher -p DM8DW03 -watcher_ini /dm8/datadm/DM8DW/dmwatcher.ini
3)配置dm.ini
可以使用主库的dm.ini,修改INSTANCE_NAME即可
在主库执行
scp dm.ini 192.168.220.109:/dm8/backup
在新备库执行
cp /dm8/backup/dm.ini /dm8/datadm/DM8DW/dm.ini
vi /dm8/datadm/DM8DW/dm.ini
#实例名INSTANCE_NAME 的值改为 DM8DW03
4)还原恢复新备库
使用dmrman脱机还原,在新备库执行
dmrman
restore database '/dm8/datadm/DM8DW/dm.ini' from backupset '/dm8/backup/full_bak_20241102_001';
recover database '/dm8/datadm/DM8DW/dm.ini' from backupset '/dm8/backup/full_bak_20241102_001';
recover database '/dm8/datadm/DM8DW/dm.ini' update db_magic;
5)配置dmmal.ini
vi /dm8/datadm/DM8DW/dmmal.ini
MAL_CHECK_INTERVAL = 30
MAL_CONN_FAIL_INTERVAL = 10
MAL_SYS_BUF_SIZE = 3000
MAL_BUF_SIZE = 3000
MAL_VPOOL_SIZE = 3000
[MAL_INST1]
MAL_INST_NAME = DM8DW01
MAL_HOST = 192.168.220.101
MAL_PORT = 62361
MAL_INST_HOST = 192.168.220.101
MAL_INST_PORT = 6236
MAL_DW_PORT = 7222
MAL_INST_DW_PORT = 62362
[MAL_INST2]
MAL_INST_NAME = DM8DW02
MAL_HOST = 192.168.220.102
MAL_PORT = 62361
MAL_INST_HOST = 192.168.220.102
MAL_INST_PORT = 6236
MAL_DW_PORT = 7222
MAL_INST_DW_PORT = 62362
[MAL_INST3]
MAL_INST_NAME = DM8DW03
MAL_HOST = 192.168.220.109
MAL_PORT = 62361
MAL_INST_HOST = 192.168.220.109
MAL_INST_PORT = 6236
MAL_DW_PORT = 7222
MAL_INST_DW_PORT = 62362
6)配置dmarch.ini
vi /dm8/datadm/DM8DW/dmarch.ini
ARCH_WAIT_APPLY = 0
[ARCHIVE_LOCAL1]
ARCH_TYPE = LOCAL
ARCH_DEST = /dm8/archdm
ARCH_FILE_SIZE = 1024
ARCH_SPACE_LIMIT = 20480
[ARCHIVE_REALTIME1]
ARCH_TYPE = REALTIME
ARCH_DEST = DM8DW01
[ARCHIVE_REALTIME2]
ARCH_TYPE = REALTIME
ARCH_DEST = DM8DW02
7)配置dmwatcher.ini
vi /dm8/datadm/DM8DW/dmwatcher.ini
[DM8DW]
DW_TYPE = GLOBAL
DW_MODE = AUTO
DW_ERROR_TIME = 10
INST_RECOVER_TIME = 60
INST_ERROR_TIME = 10
INST_OGUID = 241007001
INST_INI = /dm8/datadm/DM8DW/dm.ini
INST_AUTO_RESTART = 1
INST_STARTUP_CMD = /dm8/dmdbms/bin/dmserver
RLOG_SEND_THRESHOLD = 0
RLOG_APPLY_THRESHOLD = 0
8)配置OGUID及数据库模式
dmserver /dm8/datadm/DM8DW/dm.ini mount #mount模式启动服务
在disql 中执行
disql SYSDBA/SYSDBA:6236
SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 1);
sp_set_oguid(241007001);
ALTER DATABASE STANDBY;
SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 0);
#关闭服务
shutdown immediate
3.3动态增加MAL配置
在原集群所有节点执行:
disql SYSDBA/SYSDBA:6236
SF_MAL_CONFIG(1,0);
SF_MAL_INST_ADD('MAL_INST3','DM8DW03','192.168.220.109',62361,'192.168.220.109',6236,7222,0,62362);
SF_MAL_CONFIG_APPLY();
SF_MAL_CONFIG(0,0);
3.4 关闭守护进程及监视器
关闭确认监视器
DmMonitorServiceDM8DW stop
关闭原主库守护进程
DmWatcherServiceDM8DW01 stop
关闭原备库守护进程
DmWatcherServiceDM8DW02 stop
3.5修改归档(方法1:动态添加归档配置)
1)查看DW_INACTIVE_INTERVAL配置
disql SYSDBA/SYSDBA:6236
select para_value from v$dm_ini where para_name='DW_INACTIVE_INTERVAL';
2)先修改主库、再修改备库:
disql SYSDBA/SYSDBA:6236
SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 1);
SP_SET_PARA_VALUE(1, 'DW_INACTIVE_INTERVAL', 0); -- 临时关闭守护进程活动状态检测,允许用户手动修改模式状态,动态添加完毕后需要再改回原值
ALTER DATABASE MOUNT;
ALTER DATABASE ADD ARCHIVELOG 'DEST= GRP1_RT_03, TYPE= REALTIME';
3)先修改备库、再修改主库
ALTER DATABASE OPEN FORCE;
SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 0);
SP_SET_PARA_VALUE(1, 'DW_INACTIVE_INTERVAL', 60);
3.6 修改归档(方法2:手动修改dmarch.ini)
1)修改原主库归档文件
vi /dm8/datadm/DM8DW/dmarch.ini
ARCH_WAIT_APPLY = 0
[ARCHIVE_LOCAL1]
ARCH_TYPE = LOCAL
ARCH_DEST = /dm8/archdm
ARCH_FILE_SIZE = 1024
ARCH_SPACE_LIMIT = 20480
[ARCHIVE_REALTIME1]
ARCH_TYPE = REALTIME
ARCH_DEST = DM8DW02
[ARCHIVE_REALTIME2]
ARCH_TYPE = REALTIME
ARCH_DEST = DM8DW03
2)修改原备库归档文件
vi /dm8/datadm/DM8DW/dmarch.ini
ARCH_WAIT_APPLY = 0
[ARCHIVE_LOCAL1]
ARCH_TYPE = LOCAL
ARCH_DEST = /dm8/archdm
ARCH_FILE_SIZE = 1024
ARCH_SPACE_LIMIT = 20480
[ARCHIVE_REALTIME1]
ARCH_TYPE = REALTIME
ARCH_DEST = DM8DW01
[ARCHIVE_REALTIME2]
ARCH_TYPE = REALTIME
ARCH_DEST = DM8DW03
3)重启实例
DmServiceDM8DW02 stop #备库
DmServiceDM8DW01 restart #主库
DmServiceDM8DW02 start #备库
3.7修改监视器
修改确认监视器
vi dmmonitor_1.ini
MON_DW_CONFIRM = 1
MON_LOG_PATH = /dm8/dmdbms/log
MON_LOG_INTERVAL = 60
MON_LOG_FILE_SIZE = 32
MON_LOG_SPACE_LIMIT = 4096
[DM8DW]
MON_INST_OGUID = 241007001
MON_DW_IP = 192.168.220.101:7222
MON_DW_IP = 192.168.220.102:7222
MON_DW_IP = 192.168.220.109:7222
修改非确认监视器
vi dmmonitor_0.ini
MON_DW_CONFIRM = 0
MON_LOG_PATH = /dm8/dmdbms/log
MON_LOG_INTERVAL = 60
MON_LOG_FILE_SIZE = 32
MON_LOG_SPACE_LIMIT = 4096
[DM8DW]
MON_INST_OGUID = 241007001
MON_DW_IP = 192.168.220.101:7222
MON_DW_IP = 192.168.220.102:7222
MON_DW_IP = 192.168.220.109:7222
3.8 启动新备库及所有守护进程及监视器
DmServiceDM8DW03 start #新备库
DmWatcherServiceDM8DW01 start #主库
DmWatcherServiceDM8DW02 start #备库
DmWatcherServiceDM8DW03 start #备库
DmMonitorServiceDM8DW start #监视器
3.9验证
登录非确认监视器,查看新备库是否增加成功
/dm8/dmdbms/bin/dmmonitor /dm8/dmdbms/bin/dmmonitor_0.ini
show
备库DM8DW03增加成功,本文结束!
参考文档《DM8数据守护与读写分离集群V4.0》
2024.11.02
本站资源均来自互联网,仅供研究学习,禁止违法使用和商用,产生法律纠纷本站概不负责!如果侵犯了您的权益请与我们联系!
转载请注明出处: 免费源码网-免费的源码资源网站 » 达梦数据守护集群_动态增加实时备库
发表评论 取消回复