开发者社区> 问答> 正文

canal客户端连接问题

ZK在47.96.186.32:2181 Canal在47.96.186.32:11111 端口方面都没问题, Canal服务端日志都正常.

客户端连接的时候, ZK能成功连上, 但是调用 canalConnector.subscribe(canalClientProperties.getSubscribeFilter()); 这一段方法时抛出下面的异常, canal的autoScan已关闭.

something goes wrong when subscribing from server:null 2018-07-23 14:14:30.100 [main-SendThread(47.96.186.32:2181)] DEBUG org.apache.zookeeper.ClientCnxn.readResponse(815) - Reading reply sessionid:0x164b770991e0058, packet:: clientPath:null serverPath:null finished:false header:: 298,4 replyHeader:: 298,12176,0 request:: '/otter/canal/destinations/example/1001/running,T response:: #7b22616374697665223a747275652c2261646472657373223a223132372e302e302e313a3536333633222c22636c69656e744964223a313030317d,s{12174,12175,1532326470040,1532326470047,1,0,0,100406785942093912,59,0,12174} 2018-07-23 14:14:30.100 [taskExecutor-5] WARN c.a.o.c.c.i.r.ClientRunningMonitor.check(168) - canal is running in [127.0.0.1:56363] , but not in [192.168.31.207] 2018-07-23 14:14:30.101 [taskExecutor-5] ERROR t.j.m.m.s.c.CanalIncrementSyncTask.handleException(25) - com.alibaba.otter.canal.protocol.exception.CanalClientException: failed to subscribe after 3 times retry. at com.alibaba.otter.canal.client.impl.ClusterCanalConnector.subscribe(ClusterCanalConnector.java:119) at tech.jiyu.micromagasin.mc.sync.canal.CanalIncrementSyncTask.sync(CanalIncrementSyncTask.java:75) at tech.jiyu.micromagasin.mc.sync.canal.CanalIncrementSyncTask$$FastClassBySpringCGLIB$$783fbb6f.invoke() at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:720) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) at org.springframework.aop.interceptor.AsyncExecutionInterceptor$1.call(AsyncExecutionInterceptor.java:115) at java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:266) at java.util.concurrent.FutureTask.run(FutureTask.java) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748)

com.alibaba.otter.canal.protocol.exception.CanalClientException: failed to subscribe after 3 times retry. at com.alibaba.otter.canal.client.impl.ClusterCanalConnector.subscribe(ClusterCanalConnector.java:119) at tech.jiyu.micromagasin.mc.sync.canal.CanalIncrementSyncTask.sync(CanalIncrementSyncTask.java:75) at tech.jiyu.micromagasin.mc.sync.canal.CanalIncrementSyncTask$$FastClassBySpringCGLIB$$783fbb6f.invoke() at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:720) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) at org.springframework.aop.interceptor.AsyncExecutionInterceptor$1.call(AsyncExecutionInterceptor.java:115) at java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:266) at java.util.concurrent.FutureTask.run(FutureTask.java) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748)

原提问者GitHub用户wbsch52

展开
收起
绿子直子 2023-05-09 08:10:33 64 0
1 条回答
写回答
取消 提交回答
  • 目前找到问题的原因,

    回答23.png

    canalServer 的canal.properties ip配置为127.0.0.1 当客户端连接至ZK时获取上面的数据连接Canal时使用的也是127.0.0.1的地址去连接Canal Server, 这就变成了客户端机器在连接本地的CanalServer , 一开始这只是个猜想, 但是当我在本地起了一个CanalServer后就不再抛异常了,可以正常连接. 问题在于, 我尝试把远端的CanalServer的ip配置成公网IP, 这样应该就能正常连接了, 但是改成公网IP后CanalServer 启动失败, 提示出错 "canal cannot assign requested address"

    原回答者GitHub用户wbsch52

    2023-05-09 19:38:54
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载