场景

在做keepalived+docker容器mysql 高可用时,今天出现了如下问题,mysql容器无法重启,使用docker restart mysqlA提示如下

docker restart mysql_backup_serverb
Error response from daemon: Cannot restart container mysql_backup_serverb: failed to listen to abstract unix socket "/containerd-shim/moby/998d52ef32c4c407c0c26c4c02fca694ac8f3264698b35d06dd9cb52ff1fba6e/shim.sock": listen unix /containerd-shim/moby/998d52ef32c4c407c0c26c4c02fca694ac8f3264698b35d06dd9cb52ff1fba6e/shim.sock: bind: address already in use: unknown

Error response from daemon: Cannot restart container mysql_backup_serverb: failed to listen to abstract unix socket "/containerd-shim/moby/998d52ef32c4c407c0c26c4c02fca694ac8f3264698b35d06dd9cb52ff1fba6e/shim.sock": listen unix /containerd-shim/moby/998d52ef32c4c407c0c26c4c02fca694ac8f3264698b35d06dd9cb52ff1fba6e/shim.sock: bind: address already in use: unknown

提示端口占用,因为是mysql 端口占用第一个想到的是3306被占用,但是通过netstat -lnp | grep 3306 没有信息

 

解决

先关闭keepalived 防止虚拟IP 在本机导致mysql无法正常使用,关闭keepalived 让虚拟IP漂移到可以用的宿主机上

systemctl stop keepalived

查看进程

netstat -lnp

发现

unix  2      [ ACC ]     STREAM     LISTENING     307644974 342442/docker-conta  @/containerd-shim/moby/17a95dce2f49bf6a9760ec9b3c00b0aaeb12065c6bc5ebc850213e41df22ae62/shim.sock

很眼熟,跟报错的sock是一样的,而且可以知道了pid 是342442

再利用 kill 342442 杀死进程

重启 docker start mysqlA 就成功了。

最后启动keepalived

systemctl start keepalived

希望对大家有所帮助!!

Logo

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

更多推荐