shyiko/mysql-binlog-connector-java

Trying to restore lost connection to xxxxx

Opened this issue · 8 comments

from 2020.3.11, the log is below, once/1 mintue:
03-12 00:05:42
Trying to restore lost connection to xxxx:3306
03-12 00:05:42
Connected to to xxxx:3306 at mysql-bin.000059/66627783 (sid:1001, cid:957302)
03-12 00:06:42
Trying to restore lost connection to xxxx:3306
03-12 00:06:42
Connected to to xxxx:3306 at mysql-bin.000059/66627783 (sid:1001, cid:959064)
....

Run into the same issue

Meet the same issue, too

Meet the same issue, too

same issue

me too issue

346cxh commented

the same issue

this question :BinaryLogClient client = new BinaryLogClient(ip,host....),
client.setServerId(new Random().nextInt(65535))

client.setServerId(new Random().nextInt(65535)) worked for me.

Some background for this:
If you are using multiple instances of BinaryLogClient then you have multiple clients with the same (default) server-id: 65535

As stated in the description of setServerId(long serverId) you must use a different id for each client that uses binlog.

A even better solution might be:
client.setServerId(new Random().nextInt(45535) + 20000)
So we don't accidentally use something like 0 or 1 (these might be used by the server itself or by replication?)