使用 docker 部署的 canal-server-1.1.6,客户端调度过程中遇到错误断开重连,重连次数过多后连接到 canal-server 的时候报连接拒绝 (java.net.ConnectException: Connection refused: connect) 错误。
try { message = connector.getWithoutAck(batchSize); // 获取指定数量的数据 } catch (CanalClientException | NullPointerException e) { log.warn("Get messages failed, reconnect to canal server.", e);
connector.disconnect();
connectCanal();
return;
}
重连是因为每隔一段时间就会因为 batchId 错误导致反序列化失败。
com.alibaba.otter.canal.protocol.exception.CanalClientException: deserializer failed at com.alibaba.otter.canal.client.CanalMessageDeserializer.deserializer(CanalMessageDeserializer.java:54) ~[canal.client-1.1.6.jar:?] at com.alibaba.otter.canal.client.impl.SimpleCanalConnector.receiveMessages(SimpleCanalConnector.java:340) ~[canal.client-1.1.6.jar:?] at com.alibaba.otter.canal.client.impl.SimpleCanalConnector.getWithoutAck(SimpleCanalConnector.java:332) ~[canal.client-1.1.6.jar:?] at com.alibaba.otter.canal.client.impl.SimpleCanalConnector.getWithoutAck(SimpleCanalConnector.java:303) ~[canal.client-1.1.6.jar:?] at com.changhongedu.sccp.syncd.service.SyncdService.doSync(SyncdService.java:117) ~[classes/:?] at org.springframework.cloud.sleuth.instrument.async.TraceRunnable.run(TraceRunnable.java:64) ~[spring-cloud-sleuth-instrumentation-3.1.2.jar:3.1.2] at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54) ~[spring-context-5.3.19.jar:5.3.19] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) ~[?:?] at java.util.concurrent.FutureTask.runAndReset$$$capture(FutureTask.java:305) ~[?:?] at java.util.concurrent.FutureTask.runAndReset(FutureTask.java) ~[?:?] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305) ~[?:?] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[?:?] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[?:?] at java.lang.Thread.run(Thread.java:829) ~[?:?] Caused by: com.alibaba.otter.canal.protocol.exception.CanalClientException: something goes wrong with reason: something goes wrong with channel:[id: 0x149f2f1a, /192.168.33.12:55963 => /172.17.0.5:11111], exception=com.alibaba.otter.canal.meta.exception.CanalMetaManagerException: batchId:3488 is not the firstly:3486
at com.alibaba.otter.canal.client.CanalMessageDeserializer.deserializer(CanalMessageDeserializer.java:46) ~[canal.client-1.1.6.jar:?]
... 13 more
docker 镜像回退到 canal-server-1.1.5 ,虽然还是会每隔一段时间就会因为 batchId 错误导致反序列化失败,但是客户端可以正常重新连接上 canal-server 。
原提问者GitHub用户JaynLa
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。