[root@hadoop100 module]$ sudo vim /etc/my.cnf server-id=1 log-bin=mysql-bin binlog_format=row binlog-do-db=test
MySQL [testck]> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | innodb | | mysql | | performance_schema | | sys | | testck | | tmp | +--------------------+ 11 rows in set (0.00 sec) MySQL [testck]> use testck; Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Database changed MySQL [testck]> show tables; +------------------+ | Tables_in_testck | +------------------+ | t_organization | | t_user | +------------------+ 2 rows in set (0.00 sec) MySQL [testck]>
cnnxpredn02 :) CREATE DATABASE t_tmp ENGINE = MySQL('ip:3306', 'testck', 'user', 'pass'); CREATE DATABASE t_tmp ENGINE = MySQL('ip:3306', 'testck', 'user', 'pass') Query id: 9f6d7179-3c97-47c2-93ea-abc0c6ca873b Ok. 0 rows in set. Elapsed: 0.013 sec. cnnxpredn02 :) show databases; SHOW DATABASES Query id: 5b5baaf5-86f5-46c1-ac34-2618c34462f1 ┌─name────┐ │ default │ │ system │ │ t_tmp │ └─────────┘ 3 rows in set. Elapsed: 0.009 sec. cnnxpredn02 :)
cnnxpredn02 :) create database testck; CREATE DATABASE testck Query id: 397261c0-a8f0-48c6-b4f6-71d121b975b8 Ok. 0 rows in set. Elapsed: 0.004 sec. cnnxvopredn02 :) show databases; SHOW DATABASES Query id: f467f4bb-99fa-4322-a3c1-e33be74b6e81 ┌─name────┐ │ default │ │ system │ │ t_tmp │ │ testck │ └─────────┘ 4 rows in set. Elapsed: 0.002 sec. cnnxvpredn02 :)
cnnxvpredn02 :) create table testck.t_organization as t_tmp.t_organization; :-] create table testck.t_user as t_tmp.t_user; CREATE TABLE testck.t_organization AS t_tmp.t_organization Query id: f942cf5d-701f-4dbd-9ffd-de2206eec851 Ok. 0 rows in set. Elapsed: 0.006 sec. CREATE TABLE testck.t_user AS t_tmp.t_user Query id: ef7dddd7-64b2-4dbc-88be-a105b49aff57 Ok. 0 rows in set. Elapsed: 0.004 sec. cnnxvopredn02 :)
mkdir /opt/module/canal tar -zxvf canal.deployer-1.1.2.tar.gz -C /opt/module/canal
################################################# ######### common argument ############# ################################################# # tcp bind ip canal.ip = # register ip to zookeeper canal.register.ip = canal.port = 11111 canal.metrics.pull.port = 11112 # canal instance user/passwd # canal.user = canal # canal.passwd = E3619321C1A937C46A0D8BD1DAC39F93B27D4458 # canal admin config #canal.admin.manager = 127.0.0.1:8089 canal.admin.port = 11110 canal.admin.user = admin canal.admin.passwd = 4ACFE3202A5FF5CF467898FC58AAB1D615029441 # admin auto register #canal.admin.register.auto = true #canal.admin.register.cluster = #canal.admin.register.name = canal.zkServers = # flush data to zk canal.zookeeper.flush.period = 1000 canal.withoutNetty = false # tcp, kafka, rocketMQ, rabbitMQ canal.serverMode = tcp # flush meta cursor/parse position to file canal.file.data.dir = ${canal.conf.dir} canal.file.flush.period = 1000 ## memory store RingBuffer size, should be Math.pow(2,n) ......
################################################# ######### destinations ############# ################################################# canal.destinations = example
################################################# ## mysql serverId , v1.0.26+ will autoGen canal.instance.mysql.slaveId=20 # enable gtid use true/false canal.instance.gtidon=false # position info canal.instance.master.address=hadoop100:3306
# username/password canal.instance.dbUsername=canal canal.instance.dbPassword=canal canal.instance.connectionCharset = UTF-8 canal.instance.defaultDatabaseName =test # enable druid Decrypt database password canal.instance.enableDruid=false
bin/startup.sh
[root@cnnxpredn02 canal]# cat canal.log 2022-03-07 08:47:21.349 [main] INFO com.alibaba.otter.canal.deployer.CanalLauncher - ## set default uncaught exception handler 2022-03-07 08:47:21.398 [main] INFO com.alibaba.otter.canal.deployer.CanalLauncher - ## load canal configurations 2022-03-07 08:47:21.415 [main] INFO com.alibaba.otter.canal.deployer.CanalStarter - ## start the canal server. 2022-03-07 08:47:21.475 [main] INFO com.alibaba.otter.canal.deployer.CanalController - ## start the canal server):11111] 2022-03-07 08:47:23.137 [main] INFO com.alibaba.otter.canal.deployer.CanalStarter - ## the canal server is running now ......
... # srcDataSources: defaultDS: url: jdbc:mysql://ip:3306/database?useUnicode=true username: user password: pass canalAdapters: - instance: test # canal instance Name or mq topic name groups: - groupId: g1 outerAdapters: - name: logger - name: rdb key: mysql1 properties: jdbc.driverClassName: ru.yandex.clickhouse.ClickHouseDriver jdbc.url: jdbc:clickhouse://ip:port/database jdbc.username: user jdbc.password: pass # - name: rdb ...
Mirror schema synchronize config dataSourceKey: defaultDS destination: test groupId: g1 outerAdapterKey: mysql1 concurrent: true dbMapping: mirrorDb: true database: testck
bin/startup.sh
本文由博客一文多发平台 OpenWrite 发布!