达梦数据库系列—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

相关推荐
打鱼又晒网17 分钟前
【MySQL】数据库精细化讲解:内置函数知识穿透与深度学习解析
数据库·mysql
大白要努力!22 分钟前
android 使用SQLiteOpenHelper 如何优化数据库的性能
android·数据库·oracle
tatasix1 小时前
MySQL UPDATE语句执行链路解析
数据库·mysql
南城花随雪。1 小时前
硬盘(HDD)与固态硬盘(SSD)详细解读
数据库
儿时可乖了1 小时前
使用 Java 操作 SQLite 数据库
java·数据库·sqlite
懒是一种态度1 小时前
Golang 调用 mongodb 的函数
数据库·mongodb·golang
天海华兮1 小时前
mysql 去重 补全 取出重复 变量 函数 和存储过程
数据库·mysql
gma9992 小时前
Etcd 框架
数据库·etcd
爱吃青椒不爱吃西红柿‍️2 小时前
华为ASP与CSP是什么?
服务器·前端·数据库
Yz98763 小时前
hive的存储格式
大数据·数据库·数据仓库·hive·hadoop·数据库开发