下面的方法不对,还没有解决!!Canal Otter MySQL第一次使用踩坑记 connect /127.0.0.1:3306 failure Socket already closed.

按照网络上的博客进行配置后,出现:

2018-05-02 19:18:23.674 [destination = example , address = /127.0.0.1:3306 , EventParser] ERROR c.a.otter.canal.parse.inbound.mysql.MysqlEventParser - dump address /127.0.0.1:3306 has an error, retrying. caused by
com.alibaba.otter.canal.parse.exception.CanalParseException: java.io.IOException: connect /127.0.0.1:3306 failure
Caused by: java.io.IOException: connect /127.0.0.1:3306 failure
        at com.alibaba.otter.canal.parse.driver.mysql.MysqlConnector.connect(MysqlConnector.java:77) ~[canal.parse.driver-1.0.26-SNAPSHOT.jar:na]
        at com.alibaba.otter.canal.parse.inbound.mysql.MysqlConnection.connect(MysqlConnection.java:77) ~[canal.parse-1.0.26-SNAPSHOT.jar:na]
        at com.alibaba.otter.canal.parse.inbound.mysql.MysqlEventParser.preDump(MysqlEventParser.java:87) ~[canal.parse-1.0.26-SNAPSHOT.jar:na]
        at com.alibaba.otter.canal.parse.inbound.AbstractEventParser$3.run(AbstractEventParser.java:160) ~[canal.parse-1.0.26-SNAPSHOT.jar:na]
        at java.lang.Thread.run(Thread.java:748) [na:1.8.0_162]
Caused by: java.net.SocketException: Socket already closed.
        at com.alibaba.otter.canal.parse.driver.mysql.socket.BioSocketChannel.write(BioSocketChannel.java:38) ~[canal.parse.driver-1.0.26-SNAPSHOT.jar:na]
        at com.alibaba.otter.canal.parse.driver.mysql.utils.PacketManager.writePkg(PacketManager.java:31) ~[canal.parse.driver-1.0.26-SNAPSHOT.jar:na]
        at com.alibaba.otter.canal.parse.driver.mysql.MysqlConnector.negotiate(MysqlConnector.java:186) ~[canal.parse.driver-1.0.26-SNAPSHOT.jar:na]
        at com.alibaba.otter.canal.parse.driver.mysql.MysqlConnector.connect(MysqlConnector.java:74) ~[canal.parse.driver-1.0.26-SNAPSHOT.jar:na]
        ... 4 common frames omitted
2018-05-02 19:18:23.681 [destination = example , address = /127.0.0.1:3306 , EventParser] ERROR com.alibaba.otter.canal.common.alarm.LogAlarmHandler - destination:example[com.alibaba.otter.canal.parse.exception.CanalParseException: java.io.IOException: connect /127.0.0.1:3306 failure
Caused by: java.io.IOException: connect /127.0.0.1:3306 failure
        at com.alibaba.otter.canal.parse.driver.mysql.MysqlConnector.connect(MysqlConnector.java:77)
        at com.alibaba.otter.canal.parse.inbound.mysql.MysqlConnection.connect(MysqlConnection.java:77)
        at com.alibaba.otter.canal.parse.inbound.mysql.MysqlEventParser.preDump(MysqlEventParser.java:87)
        at com.alibaba.otter.canal.parse.inbound.AbstractEventParser$3.run(AbstractEventParser.java:160)
        at java.lang.Thread.run(Thread.java:748)
Caused by: java.net.SocketException: Socket already closed.
        at com.alibaba.otter.canal.parse.driver.mysql.socket.BioSocketChannel.write(BioSocketChannel.java:38)
        at com.alibaba.otter.canal.parse.driver.mysql.utils.PacketManager.writePkg(PacketManager.java:31)
        at com.alibaba.otter.canal.parse.driver.mysql.MysqlConnector.negotiate(MysqlConnector.java:186)
        at com.alibaba.otter.canal.parse.driver.mysql.MysqlConnector.connect(MysqlConnector.java:74)
        ... 4 more

从网络上搜索到以下两篇文章,个人觉得可能是因为没有127.0.0.1的用户,所至,重新添加用户不使用通配符:

create user [email protected];

update user set authentication_string = password('canal') where user = 'canal';

grant select, replication slave, replication client, show view on *.* to [email protected];

flush privileges;

http://www.mamicode.com/info-detail-1824894.html

https://blog.csdn.net/xiaoshunzi111/article/details/52803669

设置之后,不会报Socket的错误,不过在运行客户端时,已报另一个错误:

2018-05-02 19:40:42.736 [New I/O server worker #1-1] ERROR com.alibaba.otter.canal.server.netty.NettyUtils - ErrotCode:400 , Caused by :
something goes wrong with channel:[id: 0x1536403f, /127.0.0.1:52312 => /127.0.0.1:11111], exception=com.alibaba.otter.canal.server.exception.CanalServerException: destination:example should start first

2018-05-02 19:41:00.919 [New I/O server worker #1-2] ERROR com.alibaba.otter.canal.server.netty.NettyUtils - ErrotCode:400 , Caused by :
something goes wrong with channel:[id: 0x0dc0f04f, /127.0.0.1:52320 => /127.0.0.1:11111], exception=com.alibaba.otter.canal.server.exception.CanalServerException: destination:example should start first

2018-05-02 19:41:30.954 [Hashed wheel timer #1] WARN  c.a.o.c.server.netty.handler.ClientAuthenticationHandler - channel:[id: 0x0dc0f04f, /127.0.0.1:52320 => /127.0.0.1:11111] idle timeout exceeds, close channel to save server resources...
2018-05-02 19:42:11.163 [New I/O server worker #1-3] ERROR com.alibaba.otter.canal.server.netty.NettyUtils - ErrotCode:400 , Caused by :
something goes wrong with channel:[id: 0x65223f62, /127.0.0.1:52347 => /127.0.0.1:11111], exception=com.alibaba.otter.canal.server.exception.CanalServerException: destination:example should start first

你可能感兴趣的:(原创)