canal 切换 zookeeper 机器

把 120.27.227.13 跳板机上的 zk 换成 192.168.150.61 的 zk,以 rds1 为例 ,对应 canal41

1、修改192.168.150.23: canal41里面相关配置
cd /home/pangu/app/canal41
vi conf/canal.properties
canal.zkServers=192.168.150.61:2880,192.168.150.61:2881,192.168.150.61:2882

2、停掉canal41
./bin/stop.sh

3、120.27.227.13 服务器拿到旧zk canal 的 binlog 位点信息

cd /mnt/zookeeper1/bin
./zkCli.sh -server 192.168.0.212:2181,192.168.2.121:2181,192.168.150.6:2181
(如果此前输入过,可用ctrl+r,输入zk即可)
get /otter/canal/destinations/rds1/1001/cursor
拿到位点,”journalName”:”mysql-bin.000961”,”position”:338259243

4、修改192.168.150.23: canal41里面rds1相关配置
vi conf/rds1/instance.properties
canal.instance.master.journal.name=mysql-bin.000961
canal.instance.master.position=338259243

5、启动canal
./bin/startup.sh

6、canal客户端,以trans-delta-canal-rds1(192.168.150.41)为例
cd /home/pangu/app/trans-delta-canal-rds1
vi conf/config.properties
zkAddrs=192.168.150.61:2880,192.168.150.61:2881,192.168.150.61:2882

7、重启trans-delta-canal-rds1
ps -ef | grep canal
kill -9 pid (停止canal-rds1)
./bin/run.sh(启动canal-rds1)

8、查看新zk(192.168.150.61)当前位点是否在动
./zkCli.sh -server 192.168.150.61:2880,192.168.150.61:2881,192.168.150.61:2882
get /otter/canal/destinations/rds1/1001/cursor
get /otter/canal/destinations/rds1/1001/cursor

9、如果切换成功,把192.168.150.23: canal41里面rds1相关配置的位点信息去掉,防止下次出错
vi conf/rds1/instance.properties
canal.instance.master.journal.name=
canal.instance.master.position=