withlin / canal-go

Alibaba mysql database binlog incremental subscription & consumer components Canal's golang client[阿里巴巴mysql数据库binlog的增量订阅&消费组件 Canal 的 go 客户端 ] https://github.com/alibaba/canal

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

多个canal-go连接同一个canal server后挂掉

bellpk opened this issue · comments

commented

使用的是 client.NewSimpleCanalConnector(),是否只能起一个客户端?
起多个相同的客户端后,全部客户段都挂了。
Panicing something goes wrong with reason:something goes wrong with channel:[id: 0x5609bb8b, /127.0.0.1:49897 =\u003e /127.0.0.1:11111], exception=com.alibaba.otter.canal.server.exception.CanalServerException: ack error , clientId:1001 batchId:18 is not exist , please check

Panicing something goes wrong with reason:something goes wrong with channel:[id: 0x6e1eb5f4, /127.0.0.1:50066 =\u003e /127.0.0.1:11111], exception=com.alibaba.otter.canal.meta.exception.CanalMetaManagerException: batchId:21 is not the firstly:20

我的逻辑是先获取了数据,处理后再应答,但多个客户端的情况下不按顺序应答会有问题,请问如何解决?

commented

启动多个客户端肯定是不行的,我现在做的就是一个客户端,然后在本地维护一个内存队列,客户端拼命的获取数据,然后丢到队列里面,然后按顺序处理处理完就ack。当然这个是得设置好你get数据的数量,当处理的时间大于GET数据的时间即可。