zookeeper
manager.deployer-4.2.18
node.deployer-4.2.18
启动zookeeper
启动 manager.deployer-4.2.18
2.启动managerwindows:bin/startup.bat
或者linux:bin/startup.sh
浏览器访问 http://localhost:9999/
进入otter图形化配置界面
启动前更改 manager配置, 在 conf/otter.properties
中修改
##otter名称
otter.domainName=127.0.0.1
##ottermanagerhttpport
otter.port=9999
##zookeeper地址
otter.zookeeper.cluster.default=127.0.0.1:2181
##zookeepersession超时
otter.zookeeper.sessionTimeout=60000
##otter数据库配置,otter配置依赖mysql,数据库配置的建表语句写在下面
otter.database.driver.class.name=com.mysql.jdbc.Driver
otter.database.driver.url=jdbc:mysql://127.0.0.1:3306/otter
otter.database.driver.username=root
otter.database.driver.password=root
数据库执行语句(ottermanager依赖)
CREATEDATABASE/*!32312IFNOTEXISTS*/`otter`/*!40100DEFAULTCHARACTERSETutf8COLLATEutf8_bin*/;
USE`otter`;
SETsql_mode='ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
CREATETABLE`ALARM_RULE`(
`ID`bigint(20)unsignedNOTNULLAUTO_INCREMENT,
`MONITOR_NAME`varchar(1024)DEFAULTNULL,
`RECEIVER_KEY`varchar(1024)DEFAULTNULL,
`STATUS`varchar(32)DEFAULTNULL,
`PIPELINE_ID`bigint(20)NOTNULL,
`DESCRIPTION`varchar(256)DEFAULTNULL,
`GMT_CREATE`timestampNOTNULLDEFAULT'0000-00-0000:00:00',
`GMT_MODIFIED`timestampNOTNULLDEFAULTCURRENT_TIMESTAMPONUPDATECURRENT_TIMESTAMP,
`MATCH_VALUE`varchar(1024)DEFAULTNULL,
`PARAMETERS`textDEFAULTNULL,
PRIMARYKEY(`ID`)
)ENGINE=InnoDBAUTO_INCREMENT=1DEFAULTCHARSET=utf8;
CREATETABLE`AUTOKEEPER_CLUSTER`(
`ID`bigint(20)NOTNULLAUTO_INCREMENT,
`CLUSTER_NAME`varchar(200)NOTNULL,
`SERVER_LIST`varchar(1024)NOTNULL,
`DESCRIPTION`varchar(200)DEFAULTNULL,
`GMT_CREATE`timestampNOTNULLDEFAULT'0000-00-0000:00:00',
`GMT_MODIFIED`timestampNOTNULLDEFAULTCURRENT_TIMESTAMPONUPDATECURRENT_TIMESTAMP,
PRIMARYKEY(`ID`)
)ENGINE=InnoDBAUTO_INCREMENT=1DEFAULTCHARSET=utf8;
CREATETABLE`CANAL`(
`ID`bigint(20)unsignedNOTNULLAUTO_INCREMENT,
`NAME`varchar(200)DEFAULTNULL,
`DESCRIPTION`varchar(200)DEFAULTNULL,
`PARAMETERS`textDEFAULTNULL,
`GMT_CREATE`timestampNOTNULLDEFAULT'0000-00-0000:00:00',
`GMT_MODIFIED`timestampNOTNULLDEFAULTCURRENT_TIMESTAMPONUPDATECURRENT_TIMESTAMP,
PRIMARYKEY(`ID`),
UNIQUEKEY`CANALUNIQUE`(`NAME`)
)ENGINE=InnoDBAUTO_INCREMENT=1DEFAULTCHARSET=utf8;
CREATETABLE`CHANNEL`(
`ID`bigint(20)NOTNULLAUTO_INCREMENT,
`NAME`varchar(200)NOTNULL,
`DESCRIPTION`varchar(200)DEFAULTNULL,
`PARAMETERS`textDEFAULTNULL,
`GMT_CREATE`timestampNOTNULLDEFAULT'0000-00-0000:00:00',
`GMT_MODIFIED`timestampNOTNULLDEFAULTCURRENT_TIMESTAMPONUPDATECURRENT_TIMESTAMP,
PRIMARYKEY(`ID`),
UNIQUEKEY`CHANNELUNIQUE`(`NAME`)
)ENGINE=InnoDBAUTO_INCREMENT=1DEFAULTCHARSET=utf8;
CREATETABLE`COLUMN_PAIR`(
`ID`bigint(20)NOTNULLAUTO_INCREMENT,
`SOURCE_COLUMN`varchar(200)DEFAULTNULL,
`TARGET_COLUMN`varchar(200)DEFAULTNULL,
`DATA_MEDIA_PAIR_ID`bigint(20)NOTNULL,
`GMT_CREATE`timestampNOTNULLDEFAULT'0000-00-0000:00:00',
`GMT_MODIFIED`timestampNOTNULLDEFAULTCURRENT_TIMESTAMPONUPDATECURRENT_TIMESTAMP,
PRIMARYKEY(`ID`),
KEY`idx_DATA_MEDIA_PAIR_ID`(`DATA_MEDIA_PAIR_ID`)
)ENGINE=InnoDBAUTO_INCREMENT=1DEFAULTCHARSET=utf8;
CREATETABLE`COLUMN_PAIR_GROUP`(
`ID`bigint(20)NOTNULLAUTO_INCREMENT,
`DATA_MEDIA_PAIR_ID`bigint(20)NOTNULL,
`COLUMN_PAIR_CONTENT`textDEFAULTNULL,
`GMT_CREATE`timestampNOTNULLDEFAULT'0000-00-0000:00:00',
`GMT_MODIFIED`timestampNOTNULLDEFAULTCURRENT_TIMESTAMPONUPDATECURRENT_TIMESTAMP,
PRIMARYKEY(`ID`),
KEY`idx_DATA_MEDIA_PAIR_ID`(`DATA_MEDIA_PAIR_ID`)
)ENGINE=InnoDBAUTO_INCREMENT=1DEFAULTCHARSET=utf8;
CREATETABLE`DATA_MEDIA`(
`ID`bigint(20)NOTNULLAUTO_INCREMENT,
`NAME`varchar(200)NOTNULL,
`NAMESPACE`varchar(200)NOTNULL,
`PROPERTIES`varchar(1000)NOTNULL,
`DATA_MEDIA_SOURCE_ID`bigint(20)NOTNULL,
`GMT_CREATE`timestampNOTNULLDEFAULT'0000-00-0000:00:00',
`GMT_MODIFIED`timestampNOTNULLDEFAULTCURRENT_TIMESTAMPONUPDATECURRENT_TIMESTAMP,
PRIMARYKEY(`ID`),
UNIQUEKEY`DATAMEDIAUNIQUE`(`NAME`,`NAMESPACE`,`DATA_MEDIA_SOURCE_ID`)
)ENGINE=InnoDBAUTO_INCREMENT=1DEFAULTCHARSET=utf8;
CREATETABLE`DATA_MEDIA_PAIR`(
`ID`bigint(20)NOTNULLAUTO_INCREMENT,
`PULLWEIGHT`bigint(20)DEFAULTNULL,
`PUSHWEIGHT`bigint(20)DEFAULTNULL,
`RESOLVER`textDEFAULTNULL,
`FILTER`textDEFAULTNULL,
`SOURCE_DATA_MEDIA_ID`bigint(20)DEFAULTNULL,
`TARGET_DATA_MEDIA_ID`bigint(20)DEFAULTNULL,
`PIPELINE_ID`bigint(20)NOTNULL,
`COLUMN_PAIR_MODE`varchar(20)DEFAULTNULL,
`GMT_CREATE`timestampNOTNULLDEFAULT'0000-00-0000:00:00',
`GMT_MODIFIED`timestampNOTNULLDEFAULTCURRENT_TIMESTAMPONUPDATECURRENT_TIMESTAMP,
PRIMARYKEY(`ID`),
KEY`idx_PipelineID`(`PIPELINE_ID`,`ID`)
)ENGINE=InnoDBAUTO_INCREMENT=1DEFAULTCHARSET=utf8;
CREATETABLE`DATA_MEDIA_SOURCE`(
`ID`bigint(20)NOTNULLAUTO_INCREMENT,
`NAME`varchar(200)NOTNULL,
`TYPE`varchar(20)NOTNULL,
`PROPERTIES`varchar(1000)NOTNULL,
`GMT_CREATE`timestampNOTNULLDEFAULT'0000-00-0000:00:00',
`GMT_MODIFIED`timestampNOTNULLDEFAULTCURRENT_TIMESTAMPONUPDATECURRENT_TIMESTAMP,
PRIMARYKEY(`ID`),
UNIQUEKEY`DATAMEDIASOURCEUNIQUE`(`NAME`)
)ENGINE=InnoDBAUTO_INCREMENT=1DEFAULTCHARSET=utf8;
CREATETABLE`DELAY_STAT`(
`ID`bigint(20)NOTNULLAUTO_INCREMENT,
`DELAY_TIME`bigint(20)NOTNULL,
`DELAY_NUMBER`bigint(20)NOTNULL,
`PIPELINE_ID`bigint(20)NOTNULL,
`GMT_CREATE`timestampNOTNULLDEFAULT'0000-00-0000:00:00',
`GMT_MODIFIED`timestampNOTNULLDEFAULTCURRENT_TIMESTAMPONUPDATECURRENT_TIMESTAMP,
PRIMARYKEY(`ID`),
KEY`idx_PipelineID_GmtModified_ID`(`PIPELINE_ID`,`GMT_MODIFIED`,`ID`),
KEY`idx_Pipeline_GmtCreate`(`PIPELINE_ID`,`GMT_CREATE`),
KEY`idx_GmtCreate_id`(`GMT_CREATE`,`ID`)
)ENGINE=InnoDBAUTO_INCREMENT=1DEFAULTCHARSET=utf8;
CREATETABLE`LOG_RECORD`(
`ID`bigint(20)NOTNULLAUTO_INCREMENT,
`NID`varchar(200)DEFAULTNULL,
`CHANNEL_ID`varchar(200)NOTNULL,
`PIPELINE_ID`varchar(200)NOTNULL,
`TITLE`varchar(1000)DEFAULTNULL,
`MESSAGE`textDEFAULTNULL,
`GMT_CREATE`timestampNOTNULLDEFAULT'0000-00-0000:00:00',
`GMT_MODIFIED`timestampNOTNULLDEFAULTCURRENT_TIMESTAMPONUPDATECURRENT_TIMESTAMP,
PRIMARYKEY(`ID`),
KEY`logRecord_pipelineId`(`PIPELINE_ID`)
)ENGINE=InnoDBAUTO_INCREMENT=1DEFAULTCHARSET=utf8;
CREATETABLE`NODE`(
`ID`bigint(20)NOTNULLAUTO_INCREMENT,
`NAME`varchar(200)NOTNULL,
`IP`varchar(200)NOTNULL,
`PORT`bigint(20)NOTNULL,
`DESCRIPTION`varchar(200)DEFAULTNULL,
`PARAMETERS`textDEFAULTNULL,
`GMT_CREATE`timestampNOTNULLDEFAULT'0000-00-0000:00:00',
`GMT_MODIFIED`timestampNOTNULLDEFAULTCURRENT_TIMESTAMPONUPDATECURRENT_TIMESTAMP,
PRIMARYKEY(`ID`),
UNIQUEKEY`NODEUNIQUE`(`NAME`,`IP`)
)ENGINE=InnoDBAUTO_INCREMENT=1DEFAULTCHARSET=utf8;
CREATETABLE`PIPELINE`(
`ID`bigint(20)NOTNULLAUTO_INCREMENT,
`NAME`varchar(200)NOTNULL,
`DESCRIPTION`varchar(200)DEFAULTNULL,
`PARAMETERS`textDEFAULTNULL,
`CHANNEL_ID`bigint(20)NOTNULL,
`GMT_CREATE`timestampNOTNULLDEFAULT'0000-00-0000:00:00',
`GMT_MODIFIED`timestampNOTNULLDEFAULTCURRENT_TIMESTAMPONUPDATECURRENT_TIMESTAMP,
PRIMARYKEY(`ID`),
UNIQUEKEY`PIPELINEUNIQUE`(`NAME`,`CHANNEL_ID`),
KEY`idx_ChannelID`(`CHANNEL_ID`,`ID`)
)ENGINE=InnoDBAUTO_INCREMENT=1DEFAULTCHARSET=utf8;
CREATETABLE`PIPELINE_NODE_RELATION`(
`ID`bigint(20)NOTNULLAUTO_INCREMENT,
`NODE_ID`bigint(20)NOTNULL,
`PIPELINE_ID`bigint(20)NOTNULL,
`LOCATION`varchar(20)NOTNULL,
`GMT_CREATE`timestampNOTNULLDEFAULT'0000-00-0000:00:00',
`GMT_MODIFIED`timestampNOTNULLDEFAULTCURRENT_TIMESTAMPONUPDATECURRENT_TIMESTAMP,
PRIMARYKEY(`ID`),
KEY`idx_PipelineID`(`PIPELINE_ID`)
)ENGINE=InnoDBAUTO_INCREMENT=1DEFAULTCHARSET=utf8;
CREATETABLE`SYSTEM_PARAMETER`(
`ID`bigint(20)unsignedNOTNULL,
`VALUE`textDEFAULTNULL,
`GMT_CREATE`timestampNOTNULLDEFAULT'0000-00-0000:00:00',
`GMT_MODIFIED`timestampNOTNULLDEFAULTCURRENT_TIMESTAMPONUPDATECURRENT_TIMESTAMP,
PRIMARYKEY(`ID`)
)ENGINE=InnoDBDEFAULTCHARSET=utf8;
CREATETABLE`TABLE_HISTORY_STAT`(
`ID`bigint(20)unsignedNOTNULLAUTO_INCREMENT,
`FILE_SIZE`bigint(20)DEFAULTNULL,
`FILE_COUNT`bigint(20)DEFAULTNULL,
`INSERT_COUNT`bigint(20)DEFAULTNULL,
`UPDATE_COUNT`bigint(20)DEFAULTNULL,
`DELETE_COUNT`bigint(20)DEFAULTNULL,
`DATA_MEDIA_PAIR_ID`bigint(20)DEFAULTNULL,
`PIPELINE_ID`bigint(20)DEFAULTNULL,
`START_TIME`timestampNOTNULLDEFAULT'0000-00-0000:00:00',
`END_TIME`timestampNOTNULLDEFAULT'0000-00-0000:00:00',
`GMT_CREATE`timestampNOTNULLDEFAULT'0000-00-0000:00:00',
`GMT_MODIFIED`timestampNOTNULLDEFAULTCURRENT_TIMESTAMPONUPDATECURRENT_TIMESTAMP,
PRIMARYKEY(`ID`),
KEY`idx_DATA_MEDIA_PAIR_ID_END_TIME`(`DATA_MEDIA_PAIR_ID`,`END_TIME`),
KEY`idx_GmtCreate_id`(`GMT_CREATE`,`ID`)
)ENGINE=InnoDBAUTO_INCREMENT=1DEFAULTCHARSET=utf8;
CREATETABLE`TABLE_STAT`(
`ID`bigint(20)NOTNULLAUTO_INCREMENT,
`FILE_SIZE`bigint(20)NOTNULL,
`FILE_COUNT`bigint(20)NOTNULL,
`INSERT_COUNT`bigint(20)NOTNULL,
`UPDATE_COUNT`bigint(20)NOTNULL,
`DELETE_COUNT`bigint(20)NOTNULL,
`DATA_MEDIA_PAIR_ID`bigint(20)NOTNULL,
`PIPELINE_ID`bigint(20)NOTNULL,
`GMT_CREATE`timestampNOTNULLDEFAULT'0000-00-0000:00:00',
`GMT_MODIFIED`timestampNOTNULLDEFAULTCURRENT_TIMESTAMPONUPDATECURRENT_TIMESTAMP,
PRIMARYKEY(`ID`),
KEY`idx_PipelineID_DataMediaPairID`(`PIPELINE_ID`,`DATA_MEDIA_PAIR_ID`)
)ENGINE=InnoDBAUTO_INCREMENT=1DEFAULTCHARSET=utf8;
CREATETABLE`THROUGHPUT_STAT`(
`ID`bigint(20)NOTNULLAUTO_INCREMENT,
`TYPE`varchar(20)NOTNULL,
`NUMBER`bigint(20)NOTNULL,
`SIZE`bigint(20)NOTNULL,
`PIPELINE_ID`bigint(20)NOTNULL,
`START_TIME`timestampNOTNULLDEFAULT'0000-00-0000:00:00',
`END_TIME`timestampNOTNULLDEFAULT'0000-00-0000:00:00',
`GMT_CREATE`timestampNOTNULLDEFAULT'0000-00-0000:00:00',
`GMT_MODIFIED`timestampNOTNULLDEFAULTCURRENT_TIMESTAMPONUPDATECURRENT_TIMESTAMP,
PRIMARYKEY(`ID`),
KEY`idx_PipelineID_Type_GmtCreate_ID`(`PIPELINE_ID`,`TYPE`,`GMT_CREATE`,`ID`),
KEY`idx_PipelineID_Type_EndTime_ID`(`PIPELINE_ID`,`TYPE`,`END_TIME`,`ID`),
KEY`idx_GmtCreate_id`(`GMT_CREATE`,`ID`)
)ENGINE=InnoDBAUTO_INCREMENT=1DEFAULTCHARSET=utf8;
CREATETABLE`USER`(
`ID`bigint(20)NOTNULLAUTO_INCREMENT,
`USERNAME`varchar(20)NOTNULL,
`PASSWORD`varchar(20)NOTNULL,
`AUTHORIZETYPE`varchar(20)NOTNULL,
`DEPARTMENT`varchar(20)NOTNULL,
`REALNAME`varchar(20)NOTNULL,
`GMT_CREATE`timestampNOTNULLDEFAULT'0000-00-0000:00:00',
`GMT_MODIFIED`timestampNOTNULLDEFAULTCURRENT_TIMESTAMPONUPDATECURRENT_TIMESTAMP,
PRIMARYKEY(`ID`),
UNIQUEKEY`USERUNIQUE`(`USERNAME`)
)ENGINE=InnoDBAUTO_INCREMENT=1DEFAULTCHARSET=utf8;
CREATETABLE`DATA_MATRIX`(
`ID`bigint(20)NOTNULLAUTO_INCREMENT,
`GROUP_KEY`varchar(200)DEFAULTNULL,
`MASTER`varchar(200)DEFAULTNULL,
`SLAVE`varchar(200)DEFAULTNULL,
`DESCRIPTION`varchar(200)DEFAULTNULL,
`GMT_CREATE`timestampNOTNULLDEFAULT'0000-00-0000:00:00',
`GMT_MODIFIED`timestampNOTNULLDEFAULTCURRENT_TIMESTAMPONUPDATECURRENT_TIMESTAMP,
PRIMARYKEY(`ID`),
KEY`GROUPKEY`(`GROUP_KEY`)
)ENGINE=InnoDBAUTO_INCREMENT=1DEFAULTCHARSET=utf8;
CREATETABLEIFNOTEXISTS`meta_history`(
`id`bigint(20)unsignedNOTNULLAUTO_INCREMENTCOMMENT'主键',
`gmt_create`datetimeNOTNULLCOMMENT'创建时间',
`gmt_modified`datetimeNOTNULLCOMMENT'修改时间',
`destination`varchar(128)DEFAULTNULLCOMMENT'通道名称',
`binlog_file`varchar(64)DEFAULTNULLCOMMENT'binlog文件名',
`binlog_offest`bigint(20)DEFAULTNULLCOMMENT'binlog偏移量',
`binlog_master_id`varchar(64)DEFAULTNULLCOMMENT'binlog节点id',
`binlog_timestamp`bigint(20)DEFAULTNULLCOMMENT'binlog应用的时间戳',
`use_schema`varchar(1024)DEFAULTNULLCOMMENT'执行sql时对应的schema',
`sql_schema`varchar(1024)DEFAULTNULLCOMMENT'对应的schema',
`sql_table`varchar(1024)DEFAULTNULLCOMMENT'对应的table',
`sql_text`longtextDEFAULTNULLCOMMENT'执行的sql',
`sql_type`varchar(256)DEFAULTNULLCOMMENT'sql类型',
`extra`textDEFAULTNULLCOMMENT'额外的扩展信息',
PRIMARYKEY(`id`),
UNIQUEKEYbinlog_file_offest(`destination`,`binlog_master_id`,`binlog_file`,`binlog_offest`),
KEY`destination`(`destination`),
KEY`destination_timestamp`(`destination`,`binlog_timestamp`),
KEY`gmt_modified`(`gmt_modified`)
)ENGINE=InnoDBAUTO_INCREMENT=1DEFAULTCHARSET=utf8COMMENT='表结构变化明细表';
CREATETABLEIFNOTEXISTS`meta_snapshot`(
`id`bigint(20)unsignedNOTNULLAUTO_INCREMENTCOMMENT'主键',
`gmt_create`datetimeNOTNULLCOMMENT'创建时间',
`gmt_modified`datetimeNOTNULLCOMMENT'修改时间',
`destination`varchar(128)DEFAULTNULLCOMMENT'通道名称',
`binlog_file`varchar(64)DEFAULTNULLCOMMENT'binlog文件名',
`binlog_offest`bigint(20)DEFAULTNULLCOMMENT'binlog偏移量',
`binlog_master_id`varchar(64)DEFAULTNULLCOMMENT'binlog节点id',
`binlog_timestamp`bigint(20)DEFAULTNULLCOMMENT'binlog应用的时间戳',
`data`longtextDEFAULTNULLCOMMENT'表结构数据',
`extra`textDEFAULTNULLCOMMENT'额外的扩展信息',
PRIMARYKEY(`id`),
UNIQUEKEYbinlog_file_offest(`destination`,`binlog_master_id`,`binlog_file`,`binlog_offest`),
KEY`destination`(`destination`),
KEY`destination_timestamp`(`destination`,`binlog_timestamp`),
KEY`gmt_modified`(`gmt_modified`)
)ENGINE=InnoDBAUTO_INCREMENT=1DEFAULTCHARSET=utf8COMMENT='表结构记录表快照表';
insertintoUSER(ID,USERNAME,PASSWORD,AUTHORIZETYPE,DEPARTMENT,REALNAME,GMT_CREATE,GMT_MODIFIED)values(null,'admin','801fc357a5a74743894a','ADMIN','admin','admin',now(),now());
insertintoUSER(ID,USERNAME,PASSWORD,AUTHORIZETYPE,DEPARTMENT,REALNAME,GMT_CREATE,GMT_MODIFIED)values(null,'guest','471e02a154a2121dc577','OPERATOR','guest','guest',now(),now());
点击右上角登陆: 用户名和密码默认都是 admin
zookeeper
机器管理>zookeeper管理>添加
机器管理>node管理>添加
配置完后会回到列表页面,可以看到该配置对应的 id
记住这个序号
启动nodenode.deployer-4.2.18
1): 在conf目录下创建一个 名为 nid
的文件, 里面的内容是刚才创建node配置时返回的序号, 比如刚才我创建配置返回的序号为1
那么我创建的nid
文件的内容为 1
2): 更改conf/otter.properties
文件
#更改ottermanager的地址,ottermanager默认的通讯地址是1099
otter.manager.address=127.0.0.1:1099
3): 启动 node, windows: bin/startip.bat
linux: bin/startup.sh
然后我们进入 otterManager中可以看到状态为已启动
配置管理>数据源配置>添加
这一步的目的是指定同步的数据源和被同步的数据源,由于我是本地测试,且只有一个数据源,配一个就好了
注意, 如果点击验证链接数据源
出错,提升数据库编码不正确,则修改数据库编码为 utf-8
mysql修改方式: 修改my.ini
文件
在 [mysqld]
上面添加一行
default-character-set=utf8
在[mysqld]
下面添加
default-storage-engine=INNODB
character-set-server=utf8
collation-server=utf8_general_ci
然后重启mysql即可
比如我要同步database0
库下的所有表
canal是阿里开源的用来监听mysql bnarylog 日志的一个工具
配置管理>canal>添加canal
同步管理>添加
点击 cannel的名称进入pipeline配置
至此 database0 同步到 database1的pipeline创建完成
点击pipeline的名称进入映射关系表配置
添加关系表配置, 配置好后保存即可
至此 database0 同步到 database1 的pipeline已经配置成功了
点击database1->database0
的pipeline的名称,进入表关系映射配置
retl
库,双A同步需要记录一些日志源实例和目标实例都要创建该库
建库语句
/*
供otter使用,otter需要对retl.*的读写权限,以及对业务表的读写权限
1.创建databaseretl
*/
CREATEDATABASEretl;
/*2.用户授权给同步用户授权*/
CREATEUSERretl@'%'IDENTIFIEDBY'retl';
GRANTUSAGEON*.*TO`retl`@'%';
GRANTSELECT,REPLICATIONSLAVE,REPLICATIONCLIENTON*.*TO`retl`@'%';
GRANTSELECT,INSERT,UPDATE,DELETE,EXECUTEON`retl`.*TO`retl`@'%';
/*业务表授权,这里可以限定只授权同步业务的表*/
GRANTSELECT,INSERT,UPDATE,DELETEON*.*TO`retl`@'%';
/*3.创建系统表*/
USEretl;
DROPTABLEIFEXISTSretl.retl_buffer;
DROPTABLEIFEXISTSretl.retl_mark;
DROPTABLEIFEXISTSretl.xdual;
CREATETABLEretl_buffer
(
IDBIGINT(20)AUTO_INCREMENT,
TABLE_IDINT(11)NOTNULL,
FULL_NAMEvarchar(512),
TYPECHAR(1)NOTNULL,
PK_DATAVARCHAR(256)NOTNULL,
GMT_CREATETIMESTAMPNOTNULL,
GMT_MODIFIEDTIMESTAMPNOTNULL,
CONSTRAINTRETL_BUFFER_IDPRIMARYKEY(ID)
)ENGINE=InnoDBDEFAULTCHARSET=utf8;
CREATETABLEretl_mark
(
IDBIGINTAUTO_INCREMENT,
CHANNEL_IDINT(11),
CHANNEL_INFOvarchar(128),
CONSTRAINTRETL_MARK_IDPRIMARYKEY(ID)
)ENGINE=InnoDBAUTO_INCREMENT=1DEFAULTCHARSET=utf8;
CREATETABLExdual(
IDBIGINT(20)NOTNULLAUTO_INCREMENT,
XtimestampNOTNULLDEFAULTCURRENT_TIMESTAMP,
PRIMARYKEY(ID)
)ENGINE=InnoDBAUTO_INCREMENT=1DEFAULTCHARSET=utf8;
/*4.插入初始化数据*/
INSERTINTOretl.xdual(id,x)VALUES(1,now())ONDUPLICATEKEYUPDATEx=now();
查看日志 点击 channel>pipeline 查看 日志
至此双A同步配置完成,
在 database0 中进行 cud操作, 会同步到 database1中,
在database1 中进行 cud操作, 会同步到database0中
github: https://github.com/alibaba/otter
----------------------------------------- 广告时间 -----------------------------------------
各位看官, 欢迎关注公众号,每天推送有意思的小东西哦!!! 嘻嘻