如何解决docker swarm join命令期间的连接错误?

问题描述

我正在使用两个服务器A和B。

两个服务器通过ssh连接连接。

我在服务器A上运行了以下命令:

> sudo docker swarm init --advertise-addr SERVER_A_IP

Swarm initialized: current node (i3ob4imfipqcfm6l713shaem4) is now a manager.

To add a worker to this swarm,run the following command:

    docker swarm join \
    --token SWMTKN-1-2ru3tokyxfyep1ifp8diir89x8i94o0py5fcoaue12ep43tvy3-dls3jomzc2bh2by2f2s02i7y5 \
    SERVER_A_IP:2377

To add a manager to this swarm,run 'docker swarm join-token manager' and follow the instructions.

然后在服务器B上执行以下命令:

> sudo docker swarm join     --token SWMTKN-1-4s757ln39s1lkeu7xy8ucmv7rweqte4odedb4xi7x4fettu8sh-0wskijh5rzh42zxzbjs1hxfjr     SERVER_A_IP:2377
Error response from daemon: rpc error: code = 14 desc = grpc: the connection is unavailable

此错误是什么意思?

Error response from daemon: rpc error: code = 14 desc = grpc: the connection is unavailable

我为两台服务器都设置了防火墙选项:

firewall-cmd --add-port=2376/tcp --permanent
firewall-cmd --add-port=2377/tcp --permanent
firewall-cmd --add-port=7946/tcp --permanent
firewall-cmd --add-port=7946/udp --permanent
firewall-cmd --add-port=4789/udp --permanent

我搜索了此错误,并在服务器A上尝试了另一个命令,但失败了:

> sudo docker swarm init --advertise-addr SERVER_A_IP --listen-addr SERVER_B_IP
Error response from daemon: failed to listen on remote API address: listen tcp SERVER_B_IP:2377: bind: cannot assign requested address

netstat命令的结果:

> netstat -tuplen
(No info could be read for "-p": geteuid()=11000 but you should be root.)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       User       Inode      PID/Program name
tcp        0      0 127.0.0.1:199           0.0.0.0:*               LISTEN      0          17082      -
tcp        0      0 0.0.0.0:873             0.0.0.0:*               LISTEN      0          16129      -
tcp        0      0 0.0.0.0:65130           0.0.0.0:*               LISTEN      0          19486      -
tcp        0      0 0.0.0.0:65131           0.0.0.0:*               LISTEN      0          18964      -
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      0          46782      -
tcp6       0      0 :::544                  :::*                    LISTEN      0          48400      -
tcp6       0      0 :::873                  :::*                    LISTEN      0          16130      -
tcp6       0      0 :::22                   :::*                    LISTEN      0          46791      -
tcp6       0      0 :::2105                 :::*                    LISTEN      0          48398      -
tcp6       0      0 :::543                  :::*                    LISTEN      0          48399      -
udp        0      0 0.0.0.0:60823           0.0.0.0:*                           0          17469      -
udp        0      0 0.0.0.0:37406           0.0.0.0:*                           0          48150      -
udp        0      0 0.0.0.0:68              0.0.0.0:*                           0          17486      -
udp        0      0 0.0.0.0:49238           0.0.0.0:*                           0          48323      -
udp        0      0 0.0.0.0:161             0.0.0.0:*                           0          17081      -
udp        0      0 127.0.0.1:323           0.0.0.0:*                           0          18058      -
udp6       0      0 :::1106                 :::*                                0          17470      -

任何想被感激的人:)

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...