今天在测试Maxwell时候,出现了一个错误,报错如下:
kuroneko@localhost:/opt/module/maxwell$ maxwell
Using kafka version: 1.0.0
18:17:54,387 INFO Maxwell - Starting Maxwell. maxMemory: 3695181824 bufferMemoryUsage: 0.25
18:17:55,179 INFO TaskManager - Stopping 0 tasks
18:17:55,179 ERROR TaskManager - cause:
com.zendesk.maxwell.MaxwellCompatibilityError: server_id is '0'. Maxwell will not function without a server_id being set.
at com.zendesk.maxwell.MaxwellMysqlStatus.ensureServerIDIsSet(MaxwellMysqlStatus.java:50) ~[maxwell-1.29.0.jar:1.29.0]
at com.zendesk.maxwell.MaxwellMysqlStatus.ensureReplicationMysqlState(MaxwellMysqlStatus.java:68) ~[maxwell-1.29.0.jar:1.29.0]
at com.zendesk.maxwell.Maxwell.startInner(Maxwell.java:200) ~[maxwell-1.29.0.jar:1.29.0]
at com.zendesk.maxwell.Maxwell.start(Maxwell.java:183) ~[maxwell-1.29.0.jar:1.29.0]
at com.zendesk.maxwell.Maxwell.main(Maxwell.java:286) ~[maxwell-1.29.0.jar:1.29.0]
18:17:55,183 INFO TaskManager - Stopped all tasks
com.zendesk.maxwell.MaxwellCompatibilityError: server_id is '0'. Maxwell will not function without a server_id being set.
at com.zendesk.maxwell.MaxwellMysqlStatus.ensureServerIDIsSet(MaxwellMysqlStatus.java:50)
at com.zendesk.maxwell.MaxwellMysqlStatus.ensureReplicationMysqlState(MaxwellMysqlStatus.java:68)
at com.zendesk.maxwell.Maxwell.startInner(Maxwell.java:200)
at com.zendesk.maxwell.Maxwell.start(Maxwell.java:183)
at com.zendesk.maxwell.Maxwell.main(Maxwell.java:286)
错误原因:
server_id未设置,MySQL的binlog服务未开启:
解决方法:
编辑/etc/my.cnf,在[mysqld]下加入以下内容:
server_id=1
log-bin=mysql-bin
binlog_format=row
问题成功解决。