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

相关推荐
云和数据.ChenGuang15 分钟前
Django 应用安装脚本 – 如何将应用添加到 INSTALLED_APPS 设置中 原创
数据库·django·sqlite
woshilys43 分钟前
sql server 查询对象的修改时间
运维·数据库·sqlserver
Hacker_LaoYi43 分钟前
SQL注入的那些面试题总结
数据库·sql
建投数据2 小时前
建投数据与腾讯云数据库TDSQL完成产品兼容性互认证
数据库·腾讯云
Hacker_LaoYi3 小时前
【渗透技术总结】SQL手工注入总结
数据库·sql
岁月变迁呀3 小时前
Redis梳理
数据库·redis·缓存
独行soc3 小时前
#渗透测试#漏洞挖掘#红蓝攻防#护网#sql注入介绍06-基于子查询的SQL注入(Subquery-Based SQL Injection)
数据库·sql·安全·web安全·漏洞挖掘·hw
你的微笑,乱了夏天3 小时前
linux centos 7 安装 mongodb7
数据库·mongodb
工业甲酰苯胺3 小时前
分布式系统架构:服务容错
数据库·架构
独行soc4 小时前
#渗透测试#漏洞挖掘#红蓝攻防#护网#sql注入介绍08-基于时间延迟的SQL注入(Time-Based SQL Injection)
数据库·sql·安全·渗透测试·漏洞挖掘