开发者社区> 问答> 正文

HA模式,正常关闭一个server节点,zookeeper切换节点之后,client消费不到数据

我先启动了两个server注册至zookeeper, client连接zookeeper,选择了一个节点进行订阅。

当我关闭正在被订阅的server节点之后, zookeeper进行了节点切换,切换至了另一个节点。

但是client报错

16:13:46.186 [main] WARN c.a.o.c.c.impl.ClusterCanalConnector - something goes wrong when getWithoutAck data from server:/192.168.1.158:11111 com.alibaba.otter.canal.protocol.exception.CanalClientException: java.io.IOException: end of stream when reading header at com.alibaba.otter.canal.client.impl.SimpleCanalConnector.getWithoutAck(SimpleCanalConnector.java:224) at com.alibaba.otter.canal.client.impl.SimpleCanalConnector.getWithoutAck(SimpleCanalConnector.java:207) at com.alibaba.otter.canal.client.impl.ClusterCanalConnector.getWithoutAck(ClusterCanalConnector.java:165) at ClientSample.start(ClientSample.java:43) at ClientSample.main(ClientSample.java:116) Caused by: java.io.IOException: end of stream when reading header at com.alibaba.otter.canal.client.impl.SimpleCanalConnector.read(SimpleCanalConnector.java:307) at com.alibaba.otter.canal.client.impl.SimpleCanalConnector.readNextPacket(SimpleCanalConnector.java:295) at com.alibaba.otter.canal.client.impl.SimpleCanalConnector.receiveMessages(SimpleCanalConnector.java:229) at com.alibaba.otter.canal.client.impl.SimpleCanalConnector.getWithoutAck(SimpleCanalConnector.java:222) ... 4 more

然后订阅不到数据,只是不停的打印 16:19:29.846 [main-SendThread(192.168.0.81:2181)] DEBUG org.apache.zookeeper.ClientCnxn - Got ping response for sessionid: 0x161835c99bb1978 after 3ms

切换至的新server日志

2018-04-10 15:40:09.114 [pool-2-thread-1] INFO c.a.o.c.i.spring.support.PropertyPlaceholderConfigurer - Loading properties file from class path resource [canal.properties] 2018-04-10 15:40:09.118 [pool-2-thread-1] INFO c.a.o.c.i.spring.support.PropertyPlaceholderConfigurer - Loading properties file from class path resource [gjj/instance.properties] 2018-04-10 15:40:09.284 [pool-2-thread-1] WARN o.s.beans.GenericTypeAwarePropertyDescriptor - Invalid JavaBean property 'connectionCharset' being accessed! Ambiguous write methods found next to actually used [public void com.alibaba.otter.canal.parse.inbound.mysql.AbstractMysqlEventParser.setConnectionCharset(java.nio.charset.Charset)]: [public void com.alibaba.otter.canal.parse.inbound.mysql.AbstractMysqlEventParser.setConnectionCharset(java.lang.String)] 2018-04-10 15:40:09.381 [pool-2-thread-1] INFO c.a.o.c.i.spring.support.PropertyPlaceholderConfigurer - Loading properties file from class path resource [canal.properties] 2018-04-10 15:40:09.387 [pool-2-thread-1] INFO c.a.o.c.i.spring.support.PropertyPlaceholderConfigurer - Loading properties file from class path resource [gjj/instance.properties] 2018-04-10 15:40:09.496 [New I/O server worker #1-1] ERROR com.alibaba.otter.canal.server.netty.NettyUtils - ErrotCode:400 , Caused by : something goes wrong with channel:[id: 0x6cf56c87, /192.168.43.133:54479 => /192.168.1.158:11111], exception=com.alibaba.otter.canal.server.exception.CanalServerException: destination:gjj should start first

2018-04-10 15:40:09.501 [New I/O server worker #1-1] ERROR com.alibaba.otter.canal.server.netty.NettyUtils - ErrotCode:400 , Caused by : something goes wrong with channel:[id: 0x6cf56c87, /192.168.43.133:54479 :> /192.168.1.158:11111], exception=com.alibaba.otter.canal.server.exception.CanalServerException: destination:gjj should start first

2018-04-10 15:40:09.509 [New I/O server worker #1-1] ERROR c.a.otter.canal.server.netty.handler.SessionHandler - something goes wrong with channel:[id: 0x6cf56c87, /192.168.43.133:54479 :> /192.168.1.158:11111], exception=java.nio.channels.ClosedChannelException at org.jboss.netty.channel.socket.nio.NioWorker.cleanUpWriteBuffer(NioWorker.java:649) at org.jboss.netty.channel.socket.nio.NioWorker.writeFromUserCode(NioWorker.java:370) at org.jboss.netty.channel.socket.nio.NioServerSocketPipelineSink.handleAcceptedSocket(NioServerSocketPipelineSink.java:137) at org.jboss.netty.channel.socket.nio.NioServerSocketPipelineSink.eventSunk(NioServerSocketPipelineSink.java:76) at org.jboss.netty.channel.Channels.write(Channels.java:611) at org.jboss.netty.channel.Channels.write(Channels.java:578) at com.alibaba.otter.canal.server.netty.NettyUtils.write(NettyUtils.java:30) at com.alibaba.otter.canal.server.netty.NettyUtils.error(NettyUtils.java:51) at com.alibaba.otter.canal.server.netty.handler.SessionHandler.messageReceived(SessionHandler.java:200) at org.jboss.netty.handler.timeout.IdleStateAwareChannelHandler.handleUpstream(IdleStateAwareChannelHandler.java:48) at org.jboss.netty.handler.timeout.IdleStateHandler.messageReceived(IdleStateHandler.java:276) at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:302) at org.jboss.netty.handler.codec.replay.ReplayingDecoder.unfoldAndfireMessageReceived(ReplayingDecoder.java:526) at org.jboss.netty.handler.codec.replay.ReplayingDecoder.callDecode(ReplayingDecoder.java:507) at org.jboss.netty.handler.codec.replay.ReplayingDecoder.cleanup(ReplayingDecoder.java:542) at org.jboss.netty.handler.codec.replay.ReplayingDecoder.channelDisconnected(ReplayingDecoder.java:450) at org.jboss.netty.channel.Channels.fireChannelDisconnected(Channels.java:360) at org.jboss.netty.channel.socket.nio.NioWorker.close(NioWorker.java:599) at org.jboss.netty.channel.socket.nio.NioServerSocketPipelineSink.handleAcceptedSocket(NioServerSocketPipelineSink.java:119) at org.jboss.netty.channel.socket.nio.NioServerSocketPipelineSink.eventSunk(NioServerSocketPipelineSink.java:76) at org.jboss.netty.channel.Channels.close(Channels.java:720) at org.jboss.netty.channel.AbstractChannel.close(AbstractChannel.java:208) at org.jboss.netty.channel.ChannelFutureListener$1.operationComplete(ChannelFutureListener.java:46) at org.jboss.netty.channel.DefaultChannelFuture.notifyListener(DefaultChannelFuture.java:381) at org.jboss.netty.channel.DefaultChannelFuture.addListener(DefaultChannelFuture.java:148) at com.alibaba.otter.canal.server.netty.NettyUtils.write(NettyUtils.java:30) at com.alibaba.otter.canal.server.netty.NettyUtils.error(NettyUtils.java:51) at com.alibaba.otter.canal.server.netty.handler.SessionHandler.messageReceived(SessionHandler.java:200) at org.jboss.netty.handler.timeout.IdleStateAwareChannelHandler.handleUpstream(IdleStateAwareChannelHandler.java:48) at org.jboss.netty.handler.timeout.IdleStateHandler.messageReceived(IdleStateHandler.java:276) at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:302) at org.jboss.netty.handler.codec.replay.ReplayingDecoder.unfoldAndfireMessageReceived(ReplayingDecoder.java:526) at org.jboss.netty.handler.codec.replay.ReplayingDecoder.callDecode(ReplayingDecoder.java:507) at org.jboss.netty.handler.codec.replay.ReplayingDecoder.messageReceived(ReplayingDecoder.java:444) at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:274) at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:261) at org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:350) at org.jboss.netty.channel.socket.nio.NioWorker.processSelectedKeys(NioWorker.java:281) at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:201) at org.jboss.netty.util.internal.IoWorkerRunnable.run(IoWorkerRunnable.java:46) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745)

2018-04-10 15:40:09.649 [pool-2-thread-1] ERROR com.alibaba.druid.pool.DruidDataSource - testWhileIdle is true, validationQuery not set 2018-04-10 15:40:10.337 [pool-2-thread-1] INFO c.a.otter.canal.instance.spring.CanalInstanceWithSpring - start CannalInstance for 1-gjj 2018-04-10 15:40:10.392 [pool-2-thread-1] INFO c.a.otter.canal.instance.core.AbstractCanalInstance - subscribe filter change to bshousingfund.bsh_data_log 2018-04-10 15:40:10.392 [pool-2-thread-1] INFO c.a.otter.canal.instance.core.AbstractCanalInstance - start successful.... 2018-04-10 15:40:11.537 [destination = gjj , address = /192.168.0.72:3306 , EventParser] WARN c.a.otter.canal.parse.inbound.mysql.MysqlEventParser - prepare to find start position just last position {"identity":{"slaveId":-1,"sourceAddress":{"address":"192.168.0.72","port":3306}},"postion":{"included":false,"journalName":"mysql-bin.000017","position":864668422,"serverId":2821031644,"timestamp":1523346001000}} 2018-04-10 15:41:13.152 [New I/O server worker #1-3] INFO c.a.otter.canal.instance.core.AbstractCanalInstance - subscribe filter change to bshousingfund.bsh_data_log 2018-04-10 16:07:49.172 [New I/O server worker #1-4] INFO c.a.otter.canal.instance.core.AbstractCanalInstance - subscribe filter change to bshousingfund.bsh_data_log

原提问者GitHub用户CXninesuns

展开
收起
绿子直子 2023-05-09 10:38:36 92 0
1 条回答
写回答
取消 提交回答
  • 建议都用26-alpha版本试试,印象中高可用切换修复过几个问题

    原回答者GitHub用户agapple

    2023-05-10 10:01:03
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
《MSE 微服务网关》 立即下载
微服务引擎 MSE 治理中心重磅发布 立即下载
阿里云微服务引擎 MSE 2.0 线上发布 立即下载