基于上一篇博文问题的条件下;我们考虑在另外一台机器上进行maxwell的配置。

首先查看docker版本情况:

docker version

Client: Docker Engine - Community

Version:           20.10.12

API version:       1.41

Go version:        go1.16.12

Git commit:        e91ed57

Built:             Mon Dec 13 11:45:41 2021

OS/Arch:           linux/amd64

Context:           default

Experimental:      true

Server: Docker Engine - Community

Engine:

  Version:          20.10.12

  API version:      1.41 (minimum version 1.12)

  Go version:       go1.16.12

  Git commit:       459d0df

  Built:            Mon Dec 13 11:44:05 2021

  OS/Arch:          linux/amd64

  Experimental:     false

containerd:

  Version:          1.4.12

  GitCommit:        7b11cfaabd73bb80907dd23182b9347b4245eb5d

runc:

  Version:          1.0.2

  GitCommit:        v1.0.2-0-g52b36a2

docker-init:

  Version:          0.19.0

  GitCommit:        de40ad0

发现已经是最新版,直接进行本地输出测试:

docker run -it --rm zendesk/maxwell bin/maxwell --user='maxwell' --password='xxxxxx' --host='xxxxxxx'   --producer=stdout

首先排除版本影响,本次输出结果仍为异常,但与之前权限问题不同,具体错误信息如下:
 

02:43:10,092 ERROR Maxwell - SQLException: Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
	at com.mysql.cj.jdbc.exceptions.SQLError.createCommunicationsException(SQLError.java:174) ~[mysql-connector-java-8.0.17.jar:8.0.17]
	at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:64) ~[mysql-connector-java-8.0.17.jar:8.0.17]
	at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:827) ~[mysql-connector-java-8.0.17.jar:8.0.17]
	at com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:447) ~[mysql-connector-java-8.0.17.jar:8.0.17]
	at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:237) ~[mysql-connector-java-8.0.17.jar:8.0.17]
	at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:199) ~[mysql-connector-java-8.0.17.jar:8.0.17]
	at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:175) ~[c3p0-0.9.5.5.jar:0.9.5.5]
	at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:220) ~[c3p0-0.9.5.5.jar:0.9.5.5]
	at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:206) ~[c3p0-0.9.5.5.jar:0.9.5.5]
	at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:203) ~[c3p0-0.9.5.5.jar:0.9.5.5]
	at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1176) ~[c3p0-0.9.5.5.jar:0.9.5.5]
	at com.mchange.v2.resourcepool.BasicResourcePool.doAcquireAndDecrementPendingAcquiresWithinLockOnSuccess(BasicResourcePool.java:1163) ~[c3p0-0.9.5.5.jar:0.9.5.5]
	at com.mchange.v2.resourcepool.BasicResourcePool.access$700(BasicResourcePool.java:44) ~[c3p0-0.9.5.5.jar:0.9.5.5]
	at com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask.run(BasicResourcePool.java:1908) ~[c3p0-0.9.5.5.jar:0.9.5.5]
	at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:696) ~[mchange-commons-java-0.2.19.jar:0.2.19]
Caused by: com.mysql.cj.exceptions.CJCommunicationsException: Communications link failure

网上搜索很多有关问题的处理版本:

 

无一例外,全都无法使用,首先我们来分析下:
 

首先我们排查网络的问题:

curl 47.111.99.56:3306

5.7.22-log2?p

             z>8??!??0*j6z=4(mmysql_native_password?Got packets out of order

 由此可见,网络连接、端口访问正常。

然后排查容器内部资源的使用情况:

通过命令进入容器:
docker run -it zendesk/maxwell bash

遗憾的是没有找到root 管理员的密码信息,无法安装系统软件,如curl,telnet等,无法进行常规网络排查;

后进行宿主机的网络网段情况:
正常机器情况:

当前异常机器情况:
 

对比发现,异常的机器缺少一个虚拟网卡 ,br-xxx 开头的;

好了,到这里大概比较清楚了:虚拟网络网段的问题,添加配置网段即可:
 

docker run -it --network host 

核心是:--network host 

 Done! 收工

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐