服务器重启后如何将consul客户端重新加入服务器?

时间:2015-11-05 14:42:13

标签: consul

我已启动服务器(单节点)。 并加入了客户。

# consul members
Node                   Address             Status  Type    Build  Protocol  DC
v-ansible              172.16.10.11:8301   alive   server  0.5.2  2         dc1
v-php-cron             172.16.10.217:8301  alive   client  0.5.2  2         dc1

然后我重启服务器。 在服务器上我看到:

# consul members
Node                   Address            Status  Type    Build  Protocol  DC
v-ansible              172.16.10.11:8301  alive   server  0.5.2  2         dc1

在客户端:

# consul members
Node                   Address             Status  Type    Build  Protocol  DC
v-php-cron             172.16.10.217:8301  alive   client  0.5.2  2         dc1
v-ansible              172.16.10.11:8301   left    server  0.5.2  2         dc1

客户端日志:

2015/11/05 17:35:05 [INFO] consul: adding server v-ansible (Addr: 172.16.10.11:8300) (DC: dc1)
2015/11/05 17:38:14 [INFO] serf: EventMemberLeave: v-ansible 172.16.10.11
2015/11/05 17:38:14 [INFO] consul: removing server v-ansible (Addr: 172.16.10.11:8300) (DC: dc1)
2015/11/05 17:39:45 [ERR] agent: failed to sync remote state: No known Consul servers
2015/11/05 17:40:11 [ERR] agent: failed to sync remote state: No known Consul servers
2015/11/05 17:40:30 [ERR] agent: failed to sync remote state: No known Consul servers

为什么服务器保持在左侧状态? 如何自动将客户端重新加入服务器?

1 个答案:

答案 0 :(得分:0)

skip_leave_on_interrupt选项解决了我的问题。 如果skip_leave_on_interrupt = True(默认)

,则服务器在重启期间将LEAVE发送到群集