达梦数据库系列—46.DMHS实现DM8到DM8的同步

目录

DMHS实现DM8到DM8的同步

1、准备介质

2、安装

图形化安装

静默方式安装

3、准备DM8数据库

软件安装

数据库创建

打开归档

开启附加日志

创建辅助表

创建连接用户

创建测试用户和表

4、同步配置

修改服务配置

双向同步配置

单向同步配置

5、启动DMHS服务

装载字典

启动cpt模块

启动exec模块

6、查看信息


DMHS实现DM8到DM8的同步

源端:DM8,麒麟V10

目标端:DM8,麒麟V10

介质:

1、准备介质

2、安装

图形化安装

静默方式安装

3、准备DM8数据库

软件安装

数据库创建

没有数据库可参考该步骤创建,否则略过。

dmdba用户:

节点一:

dminit path=/dm/data PAGE_SIZE=32 EXTENT_SIZE=32 CASE_SENSITIVE=y CHARSET=1 DB_NAME=HS01 INSTANCE_NAME=HS01 PORT_NUM=5239

root用户:

cd /home/dmdba/dmdbms/script/root/

./dm_service_installer.sh -t dmserver -dm_ini /dm/data/HS01/dm.ini -p HS01

节点二:

dminit path=/dm/data PAGE_SIZE=32 EXTENT_SIZE=32 CASE_SENSITIVE=y CHARSET=1 DB_NAME=HS02 INSTANCE_NAME=HS02 PORT_NUM=5239

root用户:

cd /home/dmdba/dmdbms/script/root/

./dm_service_installer.sh -t dmserver -dm_ini /dm/data/HS02/dm.ini -p HS02

打开归档

节点一:

ALTER DATABASE MOUNT;

ALTER DATABASE ADD ARCHIVELOG 'TYPE = LOCAL,DEST = /dm/data/HS01/arch,FILE_SIZE = 128,SPACE_LIMIT = 1024';

ALTER DATABASE ARCHIVELOG;

ALTER DATABASE OPEN;

select para_value from v$dm_ini where para_name in ('ARCH_INI');

节点二:

ALTER DATABASE MOUNT;

ALTER DATABASE ADD ARCHIVELOG 'TYPE = LOCAL,DEST = /dm/data/HS02/arch,FILE_SIZE = 128,SPACE_LIMIT = 1024';

ALTER DATABASE ARCHIVELOG;

ALTER DATABASE OPEN;

select para_value from v$dm_ini where para_name in ('ARCH_INI');

开启附加日志

两节点分别执行:

SP_SET_PARA_VALUE(1,'RLOG_APPEND_LOGIC',1);

select para_value from v$dm_ini where para_name in ('RLOG_APPEND_LOGIC');

创建辅助表

两节点分别执行:

set define off

set char_code utf8

start /dmhs/scripts/ddl_sql_dm8.sql

共9个辅助表,4个触发器:

select owner, table_name from dba_tables where owner = 'SYSDBA' and table_name like 'DMHS%' and status = 'VALID';

select owner, trigger_name from dba_triggers where owner = 'SYSDBA' and trigger_name like 'DMHS%' and status = 'Y';

创建连接用户

两节点分别执行:

CREATE TABLESPACE HSEXEC DATAFILE 'HSEXEC.DBF' size 128;

CREATE USER HSEXEC IDENTIFIED by "HSEXEC" DEFAULT TABLESPACE HSEXEC DEFAULT INDEX TABLESPACE HSEXEC;

GRANT VTI TO HSEXEC;

GRANT PUBLIC TO HSEXEC;

GRANT RESOURCE TO HSEXEC;

GRANT DBA TO HSEXEC;

创建测试用户和表

4、同步配置

修改服务配置

节点一:

cd /dmhs/bin

cp TemplateDmhsService DmhsService

vim DmhsService

节点二:

同上

双向同步配置

节点一:

cd /dmhs/bin

vim dmhs.hs

exec_policy=2表示执行事务出错时,忽略出错的操作后继续执行;ddl_continue=1表示DDL操作同步出错时,继续往下操作。

<?xml version="1.0" encoding="GB2312" standalone="no"?>

<dmhs>

<base>

<lang>en</lang>

<mgr_port>5345</mgr_port>

<ckpt_interval>60</ckpt_interval>

<siteid>11</siteid>

<version>2.0</version>

</base>

<cpt>

<name>cpt1</name>

<db_type>dm8</db_type>

<db_server>192.168.64.131</db_server>

<db_user>HSEXEC</db_user>

<db_ssl_path/>

<db_ssl_pwd/>

<db_pwd>8888888888</db_pwd>

<char_code>PG_UTF8</char_code>

<db_port>5239</db_port>

<ddl_mask>op:TABLE:VIEW:PROCEDURE:FUNCTION:TRIGGER:INDEX:CHECK:SEQUENCE:TYPE:PACKAGE:SYNONYM</ddl_mask>

<parse_thr>1</parse_thr>

<arch>

<clear_flag>1</clear_flag>

<clear_interval>600</clear_interval>

</arch>

<send>

<ip>192.168.64.132</ip>

<mgr_port>5345</mgr_port>

<data_port>5346</data_port>

<trigger>1</trigger>

<constraint>1</constraint>

<identity>1</identity>

<net_turns>0</net_turns>

<filter>

<enable>

<item>HSTEST.T1</item>

<item>HSTEST.T2</item>

</enable>

</filter>

<map>

<item>HSTEST.T1==HSTEST1.T1</item>

<item>HSTEST.T2==HSTEST1.T2</item>

</map>

</send>

</cpt>

<exec>

<recv>

<mgr_port>5345</mgr_port>

<data_port>5346</data_port>

</recv>

<enable>1</enable>

<name>exec1</name>

<db_type>DM8</db_type>

<db_server>192.168.64.131</db_server>

<db_user>HSEXEC</db_user>

<db_pwd>8888888888</db_pwd>

<db_port>5239</db_port>

<exec_thr>1</exec_thr>

<exec_sql>1024</exec_sql>

<exec_trx> 5000 </exec_trx>

<exec_rows>1000</exec_rows>

<save_mask>EXEC</save_mask>

<exec_policy>2</exec_policy>

<ddl_continue>1</ddl_continue>

</exec>

</dmhs>

节点二:

cd /dmhs/bin

vim dmhs.hs

<?xml version="1.0" encoding="GB2312" standalone="no"?>

<dmhs>

<base>

<lang>en</lang>

<mgr_port>5345</mgr_port>

<ckpt_interval>60</ckpt_interval>

<siiteid>12</siteid>

<version>2.0</version>

</base>

<cpt>

<name>cpt1</name>

<db_type>dm8</db_type>

<db_server>192.168.64.132</db_server>

<db_user>HSEXEC</db_user>

<db_ssl_path/>

<db_ssl_pwd/>

<db_pwd>HSEXEC</db_pwd>

<char_code>PG_UTF8</char_code>

<db_port>5239</db_port>

<ddl_mask>op:TABLE:VIEW:PROCEDURE:FUNCTION:TRIGGER:INDEX:CHECK:SEQUENCE:TYPE:PACKAGE:SYNONYM</ddl_mask>

<parse_thr>1</parse_thr>

<arch>

<clear_flag>1</clear_flag>

<clear_interval>600</clear_interval>

</arch>

<send>

<ip>192.168.64.131</ip>

<mgr_port>5345</mgr_port>

<data_port>5346</data_port>

<trigger>1</trigger>

<constraint>1</constraint>

<identity>1</identity>

<net_turns>0</net_turns>

<filter>

<enable>

<item>HSTEST1.T1</item>

<item>HSTEST1.T2</item>

</enable>

</filter>

<map>

<item>HSTEST1.T1==HSTEST.T1</item>

<item>HSTEST1.T2==HSTEST.T2</item>

</map>

</send>

</cpt>

<exec>

<recv>

<mgr_port>5345</mgr_port>

<data_port>5346</data_port>

</recv>

<enable>1</enable>

<name>exec1</name>

<db_type>DM8</db_type>

<db_server>192.168.64.132</db_server>

<db_user>HSEXEC</db_user>

<db_pwd>HSEXEC</db_pwd>

<db_port>5239</db_port>

<exec_thr>1</exec_thr>

<exec_sql>1024</exec_sql>

<exec_trx> 5000 </exec_trx>

<exec_rows>1000</exec_rows>

<save_mask>EXEC</save_mask>

<exec_policy>2</exec_policy>

<ddl_continue>1</ddl_continue>

</exec>

</dmhs>

单向同步配置

节点一:

<?xml version="1.0" encoding="GB2312" standalone="no"?>

<dmhs>

<base>

<lang>en</lang>

<mgr_port>5345</mgr_port>

<ckpt_interval>60</ckpt_interval>

<siteid>11</siteid>

<version>2.0</version>

</base>

<cpt>

<name>cpt1</name>

<db_type>dm8</db_type>

<db_server>192.168.64.131</db_server>

<db_user>HSEXEC</db_user>

<db_ssl_path/>

<db_ssl_pwd/>

<db_pwd>8888888888</db_pwd>

<char_code>PG_UTF8</char_code>

<db_port>5239</db_port>

<ddl_mask>op:TABLE:VIEW:PROCEDURE:FUNCTION:TRIGGER:INDEX:CHECK:SEQUENCE:TYPE:PACKAGE:SYNONYM</ddl_mask>

<parse_thr>1</parse_thr>

<arch>

<clear_flag>1</clear_flag>

<clear_interval>600</clear_interval>

</arch>

<send>

<ip>192.168.64.132</ip>

<mgr_port>5345</mgr_port>

<data_port>5346</data_port>

<trigger>1</trigger>

<constraint>1</constraint>

<identity>1</identity>

<net_turns>0</net_turns>

<filter>

<enable>

<item>HSTEST.T1</item>

<item>HSTEST.T2</item>

</enable>

</filter>

<map>

<item>HSTEST.T1==HSTEST1.T1</item>

<item>HSTEST.T2==HSTEST1.T2</item>

</map>

</send>

</cpt>

</dmhs>

节点二:

<?xml version="1.0" encoding="GB2312" standalone="no"?>

<dmhs>

<base>

<lang>en</lang>

<mgr_port>5345</mgr_port>

<ckpt_interval>60</ckpt_interval>

<siteid>12</siteid>

<version>2.0</version>

</base>

<exec>

<recv>

<mgr_port>5345</mgr_port>

<data_port>5346</data_port>

</recv>

<enable>1</enable>

<name>exec1</name>

<db_type>DM8</db_type>

<db_server>192.168.64.132</db_server>

<db_user>HSEXEC</db_user>

<db_pwd>HSEXEC</db_pwd>

<db_port>5239</db_port>

<exec_thr>1</exec_thr>

<exec_sql>1024</exec_sql>

<exec_trx> 5000 </exec_trx>

<exec_rows>1000</exec_rows>

<save_mask>EXEC</save_mask>

<exec_policy>2</exec_policy>

<ddl_continue>1</ddl_continue>

</exec>

</dmhs>

5、 启动DMHS服务

节点一:

cd /dmhs/bin

./DmhsService start

ps -ef |grep dmhs

节点二:

cd /dmhs/bin

./DmhsService start

ps -ef |grep dmhs

装载字典

源端:

copy 0 "sch.name = 'HSTEST'" DICT

启动cpt模块

节点一

DMHS> start cpt

DMHS> state

节点二

DMHS> start cpt

DMHS> state

启动exec模块

节点一

cd /dmhs/bin

./dmhs_console

DMHS> start exec

DMHS> state

节点二

DMHS> start exec

DMHS> state

双向同步:

节点1:

节点2:

单向同步:

节点1:

节点2:

6、查看信息

查看日志:

cd /dmhs/bin/log

tail -100f dmhs_202408.log

目标端:

exec

thr

trx

源端:

cpt

相关推荐
wowocpp1 小时前
查看 磁盘文件系统格式 linux ubuntu blkid ext4
linux·数据库·ubuntu
Ai 编码助手6 小时前
MySQL中distinct与group by之间的性能进行比较
数据库·mysql
陈燚_重生之又为程序员7 小时前
基于梧桐数据库的实时数据分析解决方案
数据库·数据挖掘·数据分析
caridle7 小时前
教程:使用 InterBase Express 访问数据库(五):TIBTransaction
java·数据库·express
白云如幻7 小时前
MySQL排序查询
数据库·mysql
萧鼎7 小时前
Python并发编程库:Asyncio的异步编程实战
开发语言·数据库·python·异步
^velpro^7 小时前
数据库连接池的创建
java·开发语言·数据库
荒川之神7 小时前
ORACLE _11G_R2_ASM 常用命令
数据库·oracle
IT培训中心-竺老师7 小时前
Oracle 23AI创建示例库
数据库·oracle
小白学大数据7 小时前
JavaScript重定向对网络爬虫的影响及处理
开发语言·javascript·数据库·爬虫