开发者社区> 问答> 正文

怎么解决宿主机访问docker 绑定的ip啊

使用docker 模式时,canal向zookeeper注册的ip是docker容器的网络的ip:172.17.0.3 比如docker里的canal-server绑定的地址是/172.17.0.3:11111 那么我的客户端访问不了的啊

com.alibaba.otter.canal.protocol.exception.CanalClientException: java.net.ConnectException: Connection timed out: connect at com.alibaba.otter.canal.client.impl.SimpleCanalConnector.doConnect(SimpleCanalConnector.java:171) at com.alibaba.otter.canal.client.impl.SimpleCanalConnector.access$000(SimpleCanalConnector.java:48) at com.alibaba.otter.canal.client.impl.SimpleCanalConnector$1.processActiveEnter(SimpleCanalConnector.java:396) at com.alibaba.otter.canal.client.impl.running.ClientRunningMonitor.processActiveEnter(ClientRunningMonitor.java:207) at com.alibaba.otter.canal.client.impl.running.ClientRunningMonitor.initRunning(ClientRunningMonitor.java:118) at com.alibaba.otter.canal.client.impl.running.ClientRunningMonitor.start(ClientRunningMonitor.java:92) at com.alibaba.otter.canal.client.impl.SimpleCanalConnector.connect(SimpleCanalConnector.java:93) at com.alibaba.otter.canal.client.impl.ClusterCanalConnector.connect(ClusterCanalConnector.java:63) at com.fcbox.canal.scheduling.SchedulerTask.run(SchedulerTask.java:39) Caused by: java.net.ConnectException: Connection timed out: connect at sun.nio.ch.Net.connect0(Native Method) at sun.nio.ch.Net.connect(Net.java:454) at sun.nio.ch.Net.connect(Net.java:446) at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:648) at com.alibaba.otter.canal.client.impl.SimpleCanalConnector.doConnect(SimpleCanalConnector.java:132) ... 8 common frames omitted 2018-09-10 11:03:05,454 WARN (ClusterCanalConnector.java:66)- failed to connect to:### /172.17.0.3:11111 after retry 0 times 而且canal.ip也不能直接写成宿主机的ip,会报错的。

原提问者GitHub用户shizhengchao

展开
收起
Java工程师 2023-05-08 19:16:11 147 0
1 条回答
写回答
取消 提交回答
  • 可以考虑docker的host模式

    原回答者GitHub用户agapple

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

相关电子书

更多
应用 Docker 进行持续交付:用技术改变交付路程 立即下载
从Docker到容器服务 立即下载
Docker@Alibaba——超大规模Docker化的实战经验 立即下载