报错如下:
com.github.shyiko.mysql.binlog.network.ServerException: Could not find first log file name in binary log index file
at com.github.shyiko.mysql.binlog.BinaryLogClient.listenForEventPackets(BinaryLogClient.java:946) [mysql-binlog-connector-java-0.20.0.jar:0.20.0]
at com.github.shyiko.mysql.binlog.BinaryLogClient.connect(BinaryLogClient.java:581) [mysql-binlog-connector-java-0.20.0.jar:0.20.0]
at com.github.shyiko.mysql.binlog.BinaryLogClient$7.run(BinaryLogClient.java:857) [mysql-binlog-connector-java-0.20.0.jar:0.20.0]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_144]
13:28:35,452 INFO BinlogConnectorLifecycleListener - Binlog disconnected.
13:28:35,505 ERROR BinlogConnectorReplicator - Shutting down due to communication errors to Mysql
com.github.shyiko.mysql.binlog.network.ServerException: Could not find first log file name in binary log index file
at com.github.shyiko.mysql.binlog.BinaryLogClient.listenForEventPackets(BinaryLogClient.java:946) ~[mysql-binlog-connector-java-0.20.0.jar:0.20.0]
at com.github.shyiko.mysql.binlog.BinaryLogClient.connect(BinaryLogClient.java:581) ~[mysql-binlog-connector-java-0.20.0.jar:0.20.0]
at com.github.shyiko.mysql.binlog.BinaryLogClient$7.run(BinaryLogClient.java:857) ~[mysql-binlog-connector-java-0.20.0.jar:0.20.0]
at java.lang.Thread.run(Thread.java:748) ~[?:1.8.0_144]
13:28:35,508 INFO TaskManager - Stopping 4 tasks
13:28:35,509 ERROR TaskManager - cause:
com.github.shyiko.mysql.binlog.network.ServerException: Could not find first log file name in binary log index file
at com.github.shyiko.mysql.binlog.BinaryLogClient.listenForEventPackets(BinaryLogClient.java:946) ~[mysql-binlog-connector-java-0.20.0.jar:0.20.0]
at com.github.shyiko.mysql.binlog.BinaryLogClient.connect(BinaryLogClient.java:581) ~[mysql-binlog-connector-java-0.20.0.jar:0.20.0]
at com.github.shyiko.mysql.binlog.BinaryLogClient$7.run(BinaryLogClient.java:857) ~[mysql-binlog-connector-java-0.20.0.jar:0.20.0]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_144]
原因:
Maxwell 在 maxwell 库中维护了 binlog 的位移等信息,由于一些原因譬如 reset master;
,导致 maxwell 库中的记录与实际的binlog对不上,这时将报异常,这是可以手动修正binlog位移或者直接清空/删除 maxwell 库重建
解决:
办法一 :删除mysql里面 maxwell 数据库,重新创建
办法二:清空maxwell 数据库 里面positions表