达梦数据库数据守护(主备集群)

文章来源:   作者:李琪琪     发布时间:2022-04-29 10:09    浏览量:

# 1.数据规划

环境部署

图片2.png

 

# 2.主库配置

## 1)初始化实例

使用 dm.init 工具初始化实例

 

> [dmdba@localhost bin]$cd /dm8/bin

>

>   [dmdba@localhost bin]$ ./dminit  path=/dmdata page_size=32

 

## 2)修改参数

修改dm.ini

 

>  [dmdba@localhost ]$vi  /dm8/data/DAMENG/dm.ini

 

> INSTANCE_NAME = RAC01

PORT_NUM = 5246

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 配置文件

 

> [dmdba@localhost ]$vi /dm8/data/DAMENG/dmmal.ini

 

> MAL_CHECK_INTERVAL = 5

MAL_CONN_FAIL_INTERVAL = 5

[MAL_INST1]

MAL_INST_NAME = RAC01

MAL_HOST = 11.11.11.10

MAL_PORT = 55101

MAL_INST_HOST = 11.11.11.10

MAL_INST_PORT = 5246

MAL_DW_PORT = 65101

MAL_INST_DW_PORT = 45101

[MAL_INST2]

MAL_INST_NAME = RAC02

MAL_HOST = 11.11.11.11

MAL_PORT = 55121

MAL_INST_HOST = 11.11.11.11

MAL_INST_PORT = 5246

MAL_DW_PORT = 65121

MAL_INST_DW_PORT = 45121

 

编辑归档配置文件dmarch.ini

 

> [dmdba@localhost ]$vi /dm8/data/DAMENG/dmarch.ini

 

> [ARCHIVE_REALTIME]

ARCH_TYPE = REALTIME

ARCH_DEST = RAC02

[ARCHIVE_LOCAL1]

ARCH_TYPE = LOCAL

ARCH_DEST = /dm8/arch

ARCH_FILE_SIZE = 128

ARCH_SPACE_LIMIT = 0

 

创建守护进程配置文件dmwatcher.ini

 

> [dmdba@localhost ]$vi /dm8/data/DAMENG/dmwatcher.ini

 

> [GRP1]

DW_TYPE = GLOBAL

DW_MODE = AUTO

DW_ERROR_TIME = 10

INST_RECOVER_TIME = 60

INST_ERROR_TIME = 10

INST_OGUID = 453331

INST_INI = /dm8/data/DAMENG/dm.ini  

INST_AUTO_RESTART = 1

INST_STARTUP_CMD = /dm8/bin/dmserver

RLOG_SEND_THRESHOLD = 0  

RLOG_APPLY_THRESHOLD = 0

 

## (3)mount方式启动主库

 

> [dmdba@localhost ]$ ./dmserver /dm8/data/DAMENG/dm.ini  mount

>

 

> ***必须以 Mount 启动数据库实例, 否则系统启动时会重构回滚表空间,生 成 Redo 日志; 并且启动后应用可能连接到数据库实例进行操作,破坏主备库的数据一致性。数据守护配置结束后,守护进程会自动 Open 数据库***

 

#启动命令行工具 DIsql

 

> SQL>SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 1);

> SQL>sp_set_oguid(453331);  

> SQL>alter database primary;

> SQL>SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 0);

 

# 3.配置备库

 

## 1)初始化实例

 

使用 dm.init 工具初始化实例

 

> [dmdba@localhost bin]$cd /dm8/bin

>

>  [dmdba@localhost bin]$ ./dminit path=/dmdata page_size=32

 

## 2)修改参数

 

修改dm.ini

 

>  [dmdba@localhost ]$vi  /dm8/data/DAMENG/dm.ini

 

>INSTANCE_NAME = RAC02

PORT_NUM = 5246

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 配置文件

 

> [dmdba@localhost ]$vi /dm8/data/DAMENG/dmmal.ini

 

> MAL_CHECK_INTERVAL = 5

MAL_CONN_FAIL_INTERVAL = 5  

[MAL_INST1]

MAL_INST_NAME = RAC01  

MAL_HOST = 11.11.11.10

MAL_PORT = 55101

MAL_INST_HOST = 11.11.11.10

MAL_INST_PORT = 5246

MAL_DW_PORT = 65101  

MAL_INST_DW_PORT = 45101

[MAL_INST2]

MAL_INST_NAME = RAC02

MAL_HOST = 11.11.11.11

MAL_PORT = 55121

MAL_INST_HOST = 11.11.11.11

MAL_INST_PORT = 5246

MAL_DW_PORT = 65121

MAL_INST_DW_PORT = 45121

 

编辑归档配置文件dmarch.ini

 

> [dmdba@localhost ]$vi /dm8/data/DAMENG/dmarch.ini

 

> [ARCHIVE_REALTIME]

ARCH_TYPE = REALTIME

ARCH_DEST = RAC01  

[ARCHIVE_LOCAL1]

ARCH_TYPE = LOCAL

ARCH_DEST = /dm8/arch  

ARCH_FILE_SIZE = 128  

ARCH_SPACE_LIMIT = 0

 

创建守护进程配置文件dmwatcher.ini

 

> [dmdba@localhost ]$vi /dm8/data/DAMENG/dmwatcher.ini

 

>

> [GRP1]

>   DW_TYPE = GLOBAL  

>   DW_MODE = AUTO  DW_ERROR_TIME = 10

> INST_RECOVER_TIME = 60  

> INST_ERROR_TIME = 10   

> INST_OGUID = 453331

> INST_INI = /dm8/data/DAMENG/dm.ini

> INST_AUTO_RESTART = 1

> INST_STARTUP_CMD = /dm8/bin/dmserver  

> RLOG_APPLY_THRESHOLD = 0

 

## (3)mount方式启动主库

 

> [dmdba@localhost ]$ ./dmserver /dm8/data/DAMENG/dm.ini  mount

 

#启动命令行工具 DIsql

 

> SQL>SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 1);

> SQL>sp_set_oguid(453331);  

> SQL>alter database standby;

> SQL>SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 0);

 

 

# 4.配置监听

 

## 1)创建监听参数

 

> [dmdba@localhost ]$vi /dm8/bin/dmmonitor.ini

 

> MON_DW_CONFIRM = 1  

> MON_LOG_PATH = /dm8/data/log  

>  MON_LOG_INTERVAL = 60  

>  MON_LOG_FILE_SIZE = 32  

>  MON_LOG_SPACE_LIMIT = 0  [GRP1]

> MON_INST_OGUID = 453331   

> MON_DW_IP = 11.11.11.10:65101  

> MON_DW_IP => 11.11.11.11:65121

 

## 2) 启动监视器

 

> [dmdba@localhost ]$ ./dmmonitor /opt/dmdbms/bin/dmmonitor.ini

 

# 写在最后

## 1)实时主备集群重启有顺序要求:

1、关闭监视器

2、关闭主库守护进程

3、关闭备库守护进程

4、关闭主库实例

5、关闭备库实例

6、启动主库实例 (mount)

7、启动备库实例  (mount)

8、启动主库守护进程 (open)

9、启动备库守护进程  (open)

10、启动监视器


甘肃华科信息技术有限责任公司    版权所有    甘公网安备 62010202001329