正文
本文的大概内容:
一、业务场景
之前配置好的zookeeper突然就连接不上了,在这之前我重置了服务器密码,服务器重启过一次,然后就发现连接不上了。参考之前的解决方案,成功解决问题。
跟我之前碰到过的一个docker配置对外端口的业务场景有点相像(事情是这样的,我们公司有三台服务器给我来运维,我在这三台服务器上面都配置过docker对外暴露的端口,但是后面运行了二三周的样子,服务器一台先后都出现了通过密钥文件无法登陆的情况,这三台服务器都是在腾讯云的,当时为了项目进度,就在腾讯云控制台重置了密码,咨询了腾讯云的客服人员,也没有给出明确的解决方案,对于docker对外暴露端口,给出了查看端口防火墙的意见,对于服务器为什么运行一段时间突然登陆不上,需要重置密码的情况未做出解答。后面我通过重新开放防火墙端口,解决了之前可以连接上docker对外暴露端口,后面重置密码却又不行的场景。)
二、错误日志
2021-11-15 13:29:22,928 [myid:] - INFO [Thread-8:NIOServerCnxn@1056] - Closed socket connection for client /80.82.77.33:42770 (no session established for client) 2021-11-15 14:02:26,042 [myid:] - INFO [PurgeTask:DatadirCleanupManager$PurgeTask@138] - Purge task started. 2021-11-15 14:02:26,042 [myid:] - INFO [PurgeTask:DatadirCleanupManager$PurgeTask@144] - Purge task completed. 2021-11-15 15:02:26,042 [myid:] - INFO [PurgeTask:DatadirCleanupManager$PurgeTask@138] - Purge task started. 2021-11-15 15:02:26,043 [myid:] - INFO [PurgeTask:DatadirCleanupManager$PurgeTask@144] - Purge task completed. 2021-11-15 16:02:26,042 [myid:] - INFO [PurgeTask:DatadirCleanupManager$PurgeTask@138] - Purge task started. 2021-11-15 16:02:26,043 [myid:] - INFO [PurgeTask:DatadirCleanupManager$PurgeTask@144] - Purge task completed. 2021-11-15 16:17:22,337 [myid:] - INFO [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxnFactory@215] - Accepted socket connection from /106.14.47.169:40846 2021-11-15 16:17:22,337 [myid:] - WARN [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxn@383] - Exception causing close of session 0x0: Len error 369295618 2021-11-15 16:17:22,337 [myid:] - INFO [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxn@1056] - Closed socket connection for client /106.14.47.169:40846 (no session established for client) 2021-11-15 16:17:22,342 [myid:] - INFO [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxnFactory@215] - Accepted socket connection from /106.14.47.169:40850 2021-11-15 16:17:22,342 [myid:] - WARN [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxn@383] - Exception causing close of session 0x0: Len error 1195725856 2021-11-15 16:17:22,342 [myid:] - INFO [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxn@1056] - Closed socket connection for client /106.14.47.169:40850 (no session established for client) 2021-11-15 16:17:22,349 [myid:] - INFO [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxnFactory@215] - Accepted socket connection from /106.14.47.169:40852 2021-11-15 16:17:22,349 [myid:] - WARN [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxn@383] - Exception causing close of session 0x0: Len error 369295618 2021-11-15 16:17:22,349 [myid:] - INFO [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxn@1056] - Closed socket connection for client /106.14.47.169:40852 (no session established for client) 2021-11-15 16:17:22,353 [myid:] - INFO [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxnFactory@215] - Accepted socket connection from /106.14.47.169:40856 2021-11-15 16:17:22,354 [myid:] - WARN [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxn@383] - Exception causing close of session 0x0: Len error 1195725856 2021-11-15 16:17:22,354 [myid:] - INFO [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxn@1056] - Closed socket connection for client /106.14.47.169:40856 (no session established for client) 2021-11-15 17:02:26,043 [myid:] - INFO [PurgeTask:DatadirCleanupManager$PurgeTask@138] - Purge task started. 2021-11-15 17:02:26,044 [myid:] - INFO [PurgeTask:DatadirCleanupManager$PurgeTask@144] - Purge task completed. 2021-11-15 18:02:26,042 [myid:] - INFO [PurgeTask:DatadirCleanupManager$PurgeTask@138] - Purge task started. 2021-11-15 18:02:26,042 [myid:] - INFO [PurgeTask:DatadirCleanupManager$PurgeTask@144] - Purge task completed. 2021-11-15 19:02:26,042 [myid:] - INFO [PurgeTask:DatadirCleanupManager$PurgeTask@138] - Purge task started. 2021-11-15 19:02:26,042 [myid:] - INFO [PurgeTask:DatadirCleanupManager$PurgeTask@144] - Purge task completed. 2021-11-15 20:02:26,042 [myid:] - INFO [PurgeTask:DatadirCleanupManager$PurgeTask@138] - Purge task started. 2021-11-15 20:02:26,043 [myid:] - INFO [PurgeTask:DatadirCleanupManager$PurgeTask@144] - Purge task completed. 2021-11-15 21:02:26,042 [myid:] - INFO [PurgeTask:DatadirCleanupManager$PurgeTask@138] - Purge task started. 2021-11-15 21:02:26,043 [myid:] - INFO [PurgeTask:DatadirCleanupManager$PurgeTask@144] - Purge task completed. 2021-11-15 22:02:26,042 [myid:] - INFO [PurgeTask:DatadirCleanupManager$PurgeTask@138] - Purge task started. 2021-11-15 22:02:26,042 [myid:] - INFO [PurgeTask:DatadirCleanupManager$PurgeTask@144] - Purge task completed. 2021-11-15 23:02:26,043 [myid:] - INFO [PurgeTask:DatadirCleanupManager$PurgeTask@138] - Purge task started. 2021-11-15 23:02:26,043 [myid:] - INFO [PurgeTask:DatadirCleanupManager$PurgeTask@144] - Purge task completed. 2021-11-16 00:02:26,042 [myid:] - INFO [PurgeTask:DatadirCleanupManager$PurgeTask@138] - Purge task started. 2021-11-16 00:02:26,043 [myid:] - INFO [PurgeTask:DatadirCleanupManager$PurgeTask@144] - Purge task completed. 2021-11-16 01:02:26,042 [myid:] - INFO [PurgeTask:DatadirCleanupManager$PurgeTask@138] - Purge task started. 2021-11-16 01:02:26,042 [myid:] - INFO [PurgeTask:DatadirCleanupManager$PurgeTask@144] - Purge task completed. 2021-11-16 01:22:43,512 [myid:] - INFO [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxnFactory@215] - Accepted socket connection from /223.71.167.164:34777 2021-11-16 01:22:43,512 [myid:] - INFO [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxn@908] - Processing envi command from /223.71.167.164:34777 2021-11-16 01:22:43,514 [myid:] - INFO [Thread-9:NIOServerCnxn@1056] - Closed socket connection for client /223.71.167.164:34777 (no session established for client) 2021-11-16 01:22:43,573 [myid:] - INFO [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxnFactory@215] - Accepted socket connection from /223.71.167.164:34847 2021-11-16 01:22:43,573 [myid:] - WARN [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxn@383] - Exception causing close of session 0x0: Len error 1195725856 2021-11-16 01:22:43,573 [myid:] - INFO [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxn@1056] - Closed socket connection for client /223.71.167.164:34847 (no session established for client) 2021-11-16 01:22:43,675 [myid:] - INFO [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxnFactory@215] - Accepted socket connection from /223.71.167.164:47972 2021-11-16 01:22:43,675 [myid:] - WARN [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxn@383] - Exception causing close of session 0x0: Len error 369295618 2021-11-16 01:22:43,676 [myid:] - INFO [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxn@1056] - Closed socket connection for client /223.71.167.164:47972 (no session established for client) 2021-11-16 02:02:26,042 [myid:] - INFO [PurgeTask:DatadirCleanupManager$PurgeTask@138] - Purge task started. 2021-11-16 02:02:26,042 [myid:] - INFO [PurgeTask:DatadirCleanupManager$PurgeTask@144] - Purge task completed. 2021-11-16 03:02:26,042 [myid:] - INFO [PurgeTask:DatadirCleanupManager$PurgeTask@138] - Purge task started. 2021-11-16 03:02:26,043 [myid:] - INFO [PurgeTask:DatadirCleanupManager$PurgeTask@144] - Purge task completed. 2021-11-16 03:14:56,209 [myid:] - INFO [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxnFactory@215] - Accepted socket connection from /119.23.138.247:49358 2021-11-16 03:14:56,260 [myid:] - INFO [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxn@908] - Processing stat command from /119.23.138.247:49358 2021-11-16 03:14:56,261 [myid:] - INFO [Thread-10:NIOServerCnxn$StatCommand@687] - Stat command output 2021-11-16 03:14:56,261 [myid:] - INFO [Thread-10:NIOServerCnxn@1056] - Closed socket connection for client /119.23.138.247:49358 (no session established for client) 2021-11-16 04:02:26,042 [myid:] - INFO [PurgeTask:DatadirCleanupManager$PurgeTask@138] - Purge task started. 2021-11-16 04:02:26,043 [myid:] - INFO [PurgeTask:DatadirCleanupManager$PurgeTask@144] - Purge task completed. 2021-11-16 05:02:26,042 [myid:] - INFO [PurgeTask:DatadirCleanupManager$PurgeTask@138] - Purge task started. 2021-11-16 05:02:26,042 [myid:] - INFO [PurgeTask:DatadirCleanupManager$PurgeTask@144] - Purge task completed. 2021-11-16 06:02:26,042 [myid:] - INFO [PurgeTask:DatadirCleanupManager$PurgeTask@138] - Purge task started. 2021-11-16 06:02:26,042 [myid:] - INFO [PurgeTask:DatadirCleanupManager$PurgeTask@144] - Purge task completed. 2021-11-16 07:02:26,042 [myid:] - INFO [PurgeTask:DatadirCleanupManager$PurgeTask@138] - Purge task started. 2021-11-16 07:02:26,043 [myid:] - INFO [PurgeTask:DatadirCleanupManager$PurgeTask@144] - Purge task completed. 2021-11-16 08:02:26,042 [myid:] - INFO [PurgeTask:DatadirCleanupManager$PurgeTask@138] - Purge task started. 2021-11-16 08:02:26,043 [myid:] - INFO [PurgeTask:DatadirCleanupManager$PurgeTask@144] - Purge task completed. 2021-11-16 08:14:00,144 [myid:] - INFO [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxnFactory@215] - Accepted socket connection from /183.136.225.42:20194 2021-11-16 08:14:00,145 [myid:] - WARN [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxn@383] - Exception causing close of session 0x0: Len error 369295618 2021-11-16 08:14:00,145 [myid:] - INFO [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxn@1056] - Closed socket connection for client /183.136.225.42:20194 (no session established for client) 2021-11-16 09:02:26,042 [myid:] - INFO [PurgeTask:DatadirCleanupManager$PurgeTask@138] - Purge task started. 2021-11-16 09:02:26,042 [myid:] - INFO [PurgeTask:DatadirCleanupManager$PurgeTask@144] - Purge task completed. 2021-11-16 10:02:26,042 [myid:] - INFO [PurgeTask:DatadirCleanupManager$PurgeTask@138] - Purge task started. 2021-11-16 10:02:26,042 [myid:] - INFO [PurgeTask:DatadirCleanupManager$PurgeTask@144] - Purge task completed. 2021-11-16 10:03:55,688 [myid:] - INFO [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxnFactory@215] - Accepted socket connection from /39.103.162.230:53828 2021-11-16 10:04:07,858 [myid:] - INFO [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxn@908] - Processing stat command from /39.103.162.230:53828 2021-11-16 10:04:07,858 [myid:] - INFO [Thread-11:NIOServerCnxn$StatCommand@687] - Stat command output 2021-11-16 10:04:07,859 [myid:] - INFO [Thread-11:NIOServerCnxn@1056] - Closed socket connection for client /39.103.162.230:53828 (no session established for client) 2021-11-16 10:08:21,989 [myid:] - INFO [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxnFactory@215] - Accepted socket connection from /39.103.162.230:54176 2021-11-16 10:08:32,083 [myid:] - WARN [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxn@376] - Unable to read additional data from client sessionid 0x0, likely client has closed socket 2021-11-16 10:08:32,083 [myid:] - INFO [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxn@1056] - Closed socket connection for client /39.103.162.230:54176 (no session established for client) 2021-11-16 10:08:32,106 [myid:] - INFO [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxnFactory@215] - Accepted socket connection from /39.103.162.230:56100 2021-11-16 10:08:32,107 [myid:] - WARN [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxn@383] - Exception causing close of session 0x0: Len error 369295618 2021-11-16 10:08:32,107 [myid:] - INFO [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxn@1056] - Closed socket connection for client /39.103.162.230:56100 (no session established for client) 2021-11-16 11:02:26,042 [myid:] - INFO [PurgeTask:DatadirCleanupManager$PurgeTask@138] - Purge task started. 2021-11-16 11:02:26,043 [myid:] - INFO [PurgeTask:DatadirCleanupManager$PurgeTask@144] - Purge task completed. 2021-11-16 11:24:53,871 [myid:] - INFO [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxnFactory@215] - Accepted socket connection from /101.132.111.91:54778 2021-11-16 11:24:53,872 [myid:] - WARN [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxn@383] - Exception causing close of session 0x0: Len error 369296128 2021-11-16 11:24:53,872 [myid:] - INFO [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxn@1056] - Closed socket connection for client /101.132.111.91:54778 (no session established for client) 2021-11-16 12:02:26,042 [myid:] - INFO [PurgeTask:DatadirCleanupManager$PurgeTask@138] - Purge task started. 2021-11-16 12:02:26,043 [myid:] - INFO [PurgeTask:DatadirCleanupManager$PurgeTask@144] - Purge task completed. 2021-11-16 12:42:40,564 [myid:] - INFO [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxnFactory@215] - Accepted socket connection from /114.87.70.147:15797 2021-11-16 12:42:40,596 [myid:] - INFO [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:ZooKeeperServer@949] - Client attempting to establish new session at /114.87.70.147:15797 2021-11-16 12:42:40,599 [myid:] - INFO [SyncThread:0:ZooKeeperServer@694] - Established session 0x100016398e70002 with negotiated timeout 5000 for client /114.87.70.147:15797 2021-11-16 12:42:41,164 [myid:] - INFO [ProcessThread(sid:0 cport:2181)::PrepRequestProcessor@487] - Processed session termination for sessionid: 0x100016398e70002 2021-11-16 12:42:41,165 [myid:] - INFO [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxn@1056] - Closed socket connection for client /114.87.70.147:15797 which had sessionid 0x100016398e70002
通过查看日志发现好像也端口连接不上,我看了看端口的情况,发现连接是tc6不上tcp,虽然很奇怪,但是也没深入了解。
三、解决方案
通过重新开放端口,就重新连接上了
firewall-cmd --add-port=2181/tcp --permanent firewall-cmd --reload firewall-cmd --query-port=2181/tcp systemctl restart docker
总结
以上就是本篇博文要讲的内容,还希望各位读者大大能够在评论区积极参与讨论,给文章提出一些宝贵的意见或者建议,合理的内容,我会采纳更新博文,重新分享给大家。