达梦主备集群添加一个备机操作流程

达梦主备集群添加一个备机操作流程

集群架构

操作系统:centos7
添加新备机,加入的时候集群必然停止服务,无法做到热增,重启服务时,严格按照先关闭主,在关闭备

ip规划

主机名ip名称数据库名称
dmmonitor192.168.142.131确认监视器DAMENG
dm-master192.168.142.132DM01(主机)DAMENG
dm-slave192.168.142.133DM02(备机1)DAMENG
dm-slave2(新备机)192.168.142.134DM03(备机2)DAMENG

添加步骤

1、新主机操作系统安装(centos7),安装DM数据库软件、初始化实例(参照单机安装步骤)
2、安装软件版本应保持与旧集群版本一致,如果不一致还原时会报错:备份集无效
3、初始化实例参数应保持与旧集群一致,实例名指定为DM03
4、从主库全库备份,复制备份集到新主机,利用主库的备份集在新主机做还原。
5、修改配置文件,涉及四个配置文件,如下详细配置
6、修改新主机上数据库的OGUID及模式
7、重启集群,刷新归档文件,新库即可添加进集群中

此处省略机器初始化过程(安装数据库,配置系统参数等)

1、将主库备份同步到新备机

主库创建备份

./dmrman
BACKUP DATABASE '/data/dmdata/DAMENG/dm.ini' BACKUPSET '/data/dmbak/db_full';
scp -r /data/dmbak/db_full dmdba@备库IP:/data/dmbak/

–新备库还原

cd /opt/dmdbms/bin
./dmrman
RESTORE DATABASE '/data/dmdata/DAMENG/dm.ini' FROM BACKUPSET '/data/dmbak/db_full';
RECOVER DATABASE '/data/dmdata/DAMENG/dm.ini' FROM BACKUPSET '/data/dmbak/db_full';
RECOVER DATABASE '/data/dmdata/DAMENG/dm.ini' UPDATE DB_MAGIC;

2、修改4个配置文件

后面使用主库同步另外四个个文件

新备库修改dm.ini

vi /data/dmdata/DAMENG/dm.ini

INSTANCE_NAME  =  DM03 ##备库为DM03
INI_SYNC  = 0 
ENABLE_OFFLINE_TS  = 2
ARCH_INI  = 1
MAL_INI   = 1 
COMPATIBLE_MODE = 2				

主库修改dmmal.ini

vim dmmal.ini
MAL_CHECK_INTERVAL   = 5
MAL_CONN_FAIL_INTERVAL  = 5
[MAL_INST1]
MAL_INST_NAME          = DM01
MAL_HOST               = 192.168.142.132
MAL_PORT               = 61141
MAL_INST_HOST          = 192.168.142.132
MAL_INST_PORT          = 5236
MAL_DW_PORT            = 52141
MAL_INST_DW_PORT       = 33141
[MAL_INST2]
MAL_INST_NAME           = DM02
MAL_HOST                = 192.168.142.133
MAL_PORT                = 61142
MAL_INST_HOST           = 192.168.142.133
MAL_INST_PORT           = 5236
MAL_DW_PORT             = 52142
MAL_INST_DW_PORT        = 33142
[MAL_INST3]
MAL_INST_NAME           = DM03
MAL_HOST                = 192.168.142.134
MAL_PORT                = 61143
MAL_INST_HOST           = 192.168.142.134
MAL_INST_PORT           = 5236
MAL_DW_PORT             = 52143
MAL_INST_DW_PORT        = 33143		#注意新备机端口配置

主库修改dmarch.ini 归档这个很重要

vim dmarch.ini
[ARCHIVE_REALTIME]
ARCH_TYPE                               = REALTIME
ARCH_DEST                               = DM02  ##备库为DM02
[ARCHIVE_REALTIME2]
ARCH_TYPE                               = REALTIME
ARCH_DEST                               = DM03  ##备库为DM03
[ARCHIVE_LOCAL1]
ARCH_TYPE                   = LOCAL
ARCH_DEST                   = /data/dmarch
ARCH_FILE_SIZE             = 1024
ARCH_SPACE_LIMIT      = 10240    ##根据实际磁盘填写,勿超出

###添加ARCHIVE_REALTIME2 配置,并且每个备机都要修改,仅指向另外两台机器

主库修改dmwatcher.ini

vim dmwatcher.ini
[GRP1]
DW_TYPE    = GLOBAL
DW_MODE    = AUTO		#故障自动切换
DW_ERROR_TIME     = 10
INST_RECOVER_TIME  = 60
INST_ERROR_TIME   = 10
INST_OGUID         = 45335
INST_INI           = /data/dmdata/DAMENG/dm.ini
INST_AUTO_RESTART  = 1
INST_STARTUP_CMD   = /opt/dmdbms/bin/dmserver
RLOG_SEND_THRESHOLD  = 0
RLOG_APPLY_THRESHOLD = 0

主库修改dmmonitor.ini

vim dmmonitor.ini
MON_DW_CONFIRM = 0
MON_LOG_PATH = /opt/dmdbms/log
MON_LOG_INTERVAL = 60
MON_LOG_FILE_SIZE = 32
MON_LOG_SPACE_LIMIT = 2048
[GRP1]
MON_INST_OGUID = 45335
MON_DW_IP = 192.168.142.132:52141
MON_DW_IP = 192.168.142.133:52142
MON_DW_IP = 192.168.142.134:52143	#添加新配置

确认监视器也要加MON_DW_IP = 192.168.142.134:52143 这个配置。

3、同步配置文件,重启集群

scp dmarch.ini dmmal.ini dmmonitor.ini dmwatcher.ini dmdba@备机ip:/data/dmdata/DAMENG/

## 传完一定要再去修改归档配置里的指向

重启集群

关闭主–在关闭备

关闭集群
#主备都执行
./DmMonitorServiceMONITOR stop
./DmWatcherServiceDM01 stop
./DmWatcherServiceDM02 stop
./DmServiceDM01 stop
./DmServiceDM02 stop

启动

先启动数据库服务
cd /opt/dmdbms/bin
#主--->备
./DmServiceDM01 start
./DmServiceDM02 start
./DmServiceDM03 start
#主--->备
./DmWatcherServiceDM01 start
./DmWatcherServiceDM02 start
./DmWatcherServiceDM03 start

#主备都启动
./DmMonitorServiceMONITOR start

显示都ok就没问题了,查看监视器集群状态

确认监视器配置
vim /data/dmdata/DAMENG/dmmonitor0.ini

MON_DW_CONFIRM = 1				##配置1
MON_LOG_PATH = /opt/dmdbms/log
MON_LOG_INTERVAL = 60
MON_LOG_FILE_SIZE = 32
MON_LOG_SPACE_LIMIT = 2048
MON_TAKEOVER_SHUTDOWN = 10
[GRP1]
MON_INST_OGUID = 45335
MON_DW_IP = 192.168.142.132:52141
MON_DW_IP = 192.168.142.133:52142
MON_DW_IP = 192.168.142.134:52143

#执行查看
./dmmonitor /data/dmdata/DAMENG/dmmonitor0.ini

在这里插入图片描述
集群正常,添加成功

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值