来自守护程序的错误响应:rpc错误:code = 2 desc = swarm没有领导者

时间:2017-07-27 08:44:36

标签: docker-machine docker-swarm

我使用Virtualboxdocker-machine创建了3个节点群集群集。这三个都在运行,我可以使用#docker-machine ssh'连接每一个。有一个问题,我重新启动物理机,集群似乎不起作用,为什么?以下是详细信息。感谢您的指导和建议。

   san-san-System-Product-Name:〜$ docker-machine ls

NAME     ACTIVE   DRIVER       STATE     URL                         
SWARM   DOCKER        ERRORS
first    -        virtualbox   Running   tcp://192.168.99.100:2376           
v17.06.0-ce   
second   -        virtualbox   Running   tcp://192.168.99.101:2376           
v17.06.0-ce   
third    -        virtualbox   Running   tcp://192.168.99.102:2376           
v17.06.0-ce
     

第一个是领导者,第二个是经理,而第三个是工人。我试图使用#docker-machine ssh第一个docker node ls'。

Error response from daemon:

`rpc error: code = 2 desc = The swarm does not have a leader`.

It's possible that too few managers are online. Make sure more than 
half of the managers are online.
exit status 1
san-System-Product-Name:〜$ docker-machine ssh first docker info

Containers: 2 
Running: 0  Paused: 0  Stopped: 2 
Images: 3 
Server Version: 17.06.0-ce 
Storage  Driver: aufs
  Root Dir: /mnt/sda1/var/lib/docker/aufs  
  Backing Filesystem: extfs
  Dirs: 17
  Dirperm1 Supported: true
Logging Driver: json-file 
Cgroup Driver: cgroupfs 
Plugins:  
  Volume: local  
  Network: bridge host macvlan null overlay 
  Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog 
Swarm: pending 
  NodeID: dowdk4pzfzm85zijbo23e6xs3 
  Error: rpc error: code = 2 desc = The swarm does not have a leader. It's possible that too few managers are online. Make sure more than half of the managers are online. 
  Is Manager: true  Node Address: 192.168.99.100 
  Manager Addresses:
  192.168.99.100:2375
  192.168.99.102:2377 
Runtimes: runc 
Default Runtime: runc 
Init Binary: docker-init 
containerd version: cfb82a876ecc11b5ca0977d1733adbe58599088a 
runc version: 2d41c047c83e09a6d61d464906feb2a2f3c52aa4 
init version: 949e6fa 
Security Options: 
   seccomp   
     Profile: default
Kernel Version:
   4.4.74-boot2docker
Operating System: Boot2Docker 17.06.0-ce (TCL 7.2); HEAD : 0672754 - Thu Jun 29 00:06:31 UTC 2017 
OSType: linux 
Architecture: x86_64
CPUs: 1
Total Memory: 995.8MiB 
Name: first
ID: ACGX:Z6QQ:5KOX:7W2O:OMMM:43PB:4QES:KKGJ:IXUC:J2SW:F4SJ:QMQ4 
Docker Root Dir: /mnt/sda1/var/lib/docker
Debug Mode (client): false 
Debug Mode (server): true  
 File Descriptors: 24 
 Goroutines: 76 
 System Time: 2017-07-28T01:57:37.410536525Z 
 EventsListeners: 0 
Registry: https://index.docker.io/v1/
Labels:  provider=virtualbox
Experimental: false 
Insecure Registries:
  127.0.0.0/8 
Live Restore Enabled: false
san @ san-System-Product-Name:〜$ docker-machine ssh first docker network ls

  NETWORK ID          NAME                DRIVER              SCOPE
    22e85840407d        bridge              bridge              local
    fc3c6786739c        docker_gwbridge     bridge              local
    e294dde63753        host                host                local
    55f8e340b794        none                null                local

我怎么能解决这个问题并使用

  

docker node ls

管理节点上的

非常感谢您的建议。

1 个答案:

答案 0 :(得分:4)

我遇到了同样的问题,但我不确定是什么原因造成的。我能够通过输入以下内容来修复它:

docker swarm init --force-new-cluster

一切都恢复了。我希望这也适合你