版本:1.1.0 mysql:5.6.36
所有配置只修改两处,一个是example中配置的mysql的ip:port,另外一处就是spring/file-instance.xml ,如下:
<property name="logPositionManager">
<bean class="com.alibaba.otter.canal.parse.index.FailbackLogPositionManager">
<constructor-arg>
<bean class="com.alibaba.otter.canal.parse.index.FileMixedLogPositionManager" >
<constructor-arg index="0" value="/tmp/parse.dat" />
<constructor-arg index="1" value="2000" />
<constructor-arg index="2" ref="memoryLogPositionManager"/>
</bean>
</constructor-arg>
<constructor-arg>
<bean class="com.alibaba.otter.canal.parse.index.MetaLogPositionManager">
<constructor-arg ref="metaManager"/>
</bean>
</constructor-arg>
</bean>
</property>
memoryLogPositionManager定义:
报错如下:
2018-10-12 15:46:57.245 [destination = example , address = /127.0.0.1:3307 , EventParser] ERROR c.a.o.c.p.inbound.mysql.rds.RdsBinlogEventParserProxy - dump address /127.0.0.1:3307 has an error, retrying. caused by java.lang.NullPointerException: null at com.alibaba.otter.canal.parse.inbound.mysql.MysqlEventParser.findStartPositionInternal(MysqlEventParser.java:480) ~[canal.parse-1.1.0.jar:na] at com.alibaba.otter.canal.parse.inbound.mysql.MysqlEventParser.findStartPosition(MysqlEventParser.java:362) ~[canal.parse-1.1.0.jar:na] at com.alibaba.otter.canal.parse.inbound.AbstractEventParser$3.run(AbstractEventParser.java:182) ~[canal.parse-1.1.0.jar:na] at java.lang.Thread.run(Thread.java:748) [na:1.8.0_171] 2018-10-12 15:46:57.258 [destination = example , address = /127.0.0.1:3307 , EventParser] ERROR com.alibaba.otter.canal.common.alarm.LogAlarmHandler - destination:example[java.lang.NullPointerException at com.alibaba.otter.canal.parse.inbound.mysql.MysqlEventParser.findStartPositionInternal(MysqlEventParser.java:480) at com.alibaba.otter.canal.parse.inbound.mysql.MysqlEventParser.findStartPosition(MysqlEventParser.java:362) at com.alibaba.otter.canal.parse.inbound.AbstractEventParser$3.run(AbstractEventParser.java:182) at java.lang.Thread.run(Thread.java:748) ]
spring的原本配置:(保持原本配置,此时启动一切正常)
<property name="logPositionManager">
<bean class="com.alibaba.otter.canal.parse.index.FailbackLogPositionManager">
<constructor-arg>
<bean class="com.alibaba.otter.canal.parse.index.MemoryLogPositionManager" />
</constructor-arg>
<constructor-arg>
<bean class="com.alibaba.otter.canal.parse.index.MetaLogPositionManager">
<constructor-arg ref="metaManager"/>
</bean>
</constructor-arg>
</bean>
</property>
原提问者GitHub用户naruto-june
com.alibaba.otter.canal.parse.index.FileMixedLogPositionManager这里要求dataDir是一个根路径,查找dat文件时,会是这样的一个路径 dataDir + /$destination$/ + parse.dat,你的路径构造错了
原回答者GitHub用户agapple
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。