diff --git a/AdminGuide.md b/AdminGuide.md index 4bb9975..6824086 100644 --- a/AdminGuide.md +++ b/AdminGuide.md @@ -474,5 +474,35 @@ sh bin/stop.sh

   b. canal server所在的网络出现闪断,导致zookeeper认为session失效,释放了running节点,此时canal server对应的jvm并未退出,(一种假死状态,非常特殊的情况)

ps. 为了保护假死状态的canal server,避免因瞬间runing失效导致instance重新分布,所以做了一个策略:canal server在收到running节点释放后,延迟一段时间抢占running,原本running节点的拥有者可以不需要等待延迟,优先取得running节点,可以保证假死状态下尽可能不无谓的释放资源。 目前延迟时间的默认值为5秒,即running节点针对假死状态的保护期为5秒.

+

mysql多节点解析配置(parse解析自动切换)

+

1. mysql机器准备

+

准备两台mysql机器,配置为M-M模式,比如ip为:10.20.144.25:3306,10.20.144.29:3306

+
[mysqld] 
+xxxxx ##其他正常master/slave配置
+log_slave_updates=true ##这个配置一定要打开
+

2. canal instance配置

+
# position info
+canal.instance.master.address = 10.20.144.25:3306
+canal.instance.master.journal.name = 
+canal.instance.master.position = 
+canal.instance.master.timestamp = 
+
+canal.instance.standby.address = 10.20.144.29:3306
+canal.instance.standby.journal.name =
+canal.instance.standby.position = 
+canal.instance.standby.timestamp =
+
+## detecing config
+canal.instance.detecting.enable = true ## 需要开启心跳检查
+canal.instance.detecting.sql = insert into retl.xdual values(1,now()) on duplicate key update x=now() ##心跳检查sql,也可以选择类似select 1的query语句
+canal.instance.detecting.interval.time = 3 ##心跳检查频率
+canal.instance.detecting.retry.threshold = 3  ## 心跳检查失败次数阀值,超过该阀值后会触发mysql链接切换,比如切换到standby机器上继续消费binlog
+canal.instance.detecting.heartbeatHaEnable = true ## 心跳检查超过失败次数阀值后,是否开启master/standby的切换. 
+

注意:

+

a. 填写master/standby的地址和各自的起始binlog位置,目前配置只支持一个standby配置.

+

b. 发生master/standby的切换的条件:(heartbeatHaEnable = true) && (失败次数>=retry.threshold).

+

c. 多引入一个heartbeatHaEnable的考虑:开启心跳sql有时候是为client检测canal server是否正常工作,如果定时收到了心跳语句,那说明整个canal server工作正常

+

3. 启动 & 测试

+

比如关闭一台机器的mysql , /etc/init.d/mysql stop 。在经历大概 interval.time * retry.threshold时间后,就会切换到standby机器上

\ No newline at end of file