使用 "etcdctl member add" 时 CoreOS 成员节点不会启动

CoreOS member node will not start when using "etcdctl member add"

我正在尝试使用命令 "etcdctl member add core2 http://172.31.12.183:2380" 向我的 CoreOS 集群添加一个额外的 etcd 节点,但此命令使我的新节点处于未启动状态,因此我的集群不健康。在我 运行 etcdctl member add 命令后,如何解决这个问题或启动我的新节点?这是我 运行 此命令的输出以及之后的集群状态:

core@ip-172-31-12-183 ~ $ etcdctl member add core2 http://172.31.12.183:2380
Added member named core2 with ID 4d14f3cb088a2f54 to cluster

ETCD_NAME="core2"
ETCD_INITIAL_CLUSTER="core2=http://172.31.12.183:2380,ec2c8c9d2cf141cf9657e98b260895a5=http://172.31.12.182:2380"
ETCD_INITIAL_CLUSTER_STATE="existing"
core@ip-172-31-12-183 ~ $ etcdctl member list
4d14f3cb088a2f54[unstarted]: peerURLs=http://172.31.12.183:2380
aedf0a441a723d8a: name=ec2c8c9d2cf141cf9657e98b260895a5 peerURLs=http://172.31.12.182:2380 clientURLs=http://172.31.12.182:2379,http://172.31.12.182:4001
core@ip-172-31-12-183 ~ $ etcdctl cluster-health
member 4d14f3cb088a2f54 is unreachable: no available published client urls
member aedf0a441a723d8a is unhealthy: got unhealthy result from http://172.31.12.182:2379
cluster is unhealthy

简单的说,你添加会员的步骤是错误的
与官方 docs 一样,add a new member to a 1-node cluster 的步骤我假设是您的情况:

  1. 启动第一个节点
  2. 运行 etcdctl member add
  3. 使用集群相关选项启动第二个节点

所以根据你的情况:

core2 开始之前,运行 =>

etcdctl member add core2 http://172.31.12.183:2380  

然后,使用集群相关选项启动 core2 =>

./etcd --name core2 --initial-advertise-peer-urls http://172.31.12.183:2380 \
  --listen-peer-urls http://172.31.12.183:2380 \
  --listen-client-urls http://172.31.12.183:2379 \
  --advertise-client-urls http://172.31.12.183:2379 \
  --initial-cluster core2=http://172.31.12.183:2380,ec2c8c9d2cf141cf9657e98b260895a5=http://172.31.12.182:2380 \
  --initial-cluster-state existing