[1] 机器准备
3台zookeeper 服务器
- zookeeper1地址:192.168.234.130:2181
- zookeeper2地址: 192.168.234.131:2181
- zookeeper3地址: 192.168.234.132:2181
mysql 地址: 192.168.1.224
运行canal的服务器1: 192.168.234.132
运行canal的服务器2: 192.168.1.224
[2] zookeeper1 配置
etc/hosts
hosts配置
192.168.234.130 test201
192.168.234.131 test202
192.168.234.132 test203
cd ect/profile
export ZOOKEEPER=/opt/module/zookeeper-3.4.5
export PATH=
P
A
T
H
:
PATH:
PATH:ZOOKEEPER/bin:$PATH
source/profile 使配置生效
配置 canal
cd /opt/module/zookeeper-3.4.5/conf/zoo.cfg
dataDir=/opt/module/zookeeper-3.4.5/zkData
dataLogDir=/opt/module/zookeeper-3.4.5/zkLog
server.1=test201:2888:3888
server.2=test202:2888:3888
server.3=test203:2888:3888
2888:选举端口
3888:心跳端口
3台机器重复上面的配置:
cd /opt/module/zookeeper-3.4.5/data
echo “1” > myid
echo “2” > myid
echo “3” > myid
分别放在 data 目标下
分别启动zookeeper1,2,3
命令: zkServer.sh start
[3] 配置canal
192.168.1.224上的 canal.properties
canal.id = 132
canal.ip = 192.168.1.224
canal.port = 11111
canal.metrics.pull.port = 11112
canal.zkServers = 192.168.234.130:2181
canal.instance.filter.druid.ddl = true
canal.instance.filter.query.dcl = false
canal.instance.filter.query.dml = false
canal.instance.filter.query.ddl = false
instace.properties
#username/password
canal.instance.dbUsername=root
canal.instance.dbPassword=root
canal.instance.connectionCharset = UTF-8
canl2 服务器地址:192.168.234.132
canal.properties
canal.id = 133
canal.ip = 192.168.234.132
canal.port = 11111
canal.metrics.pull.port = 11112
canal.zkServers = 192.168.234.132:2181
instace.properties
#username/password
canal.instance.dbUsername=canal
canal.instance.dbPassword=canal
canal.instance.connectionCharset = UTF-8
分别启动canal
canal1:startup.bat 192.168.1.224(windows)
canal2.startup.sh 192.168.234.132(linux/ubuntu)
[4] 查看工具 zktools