使用“etcdctl成员添加”时,CoreOS成员节点不会启动
我试图用命令“etcdctl member add core2 http://172.31.12.183:2380 ”添加一个额外的etcd节点到我的CoreOS集群中,但是这个命令会让我的新节点不稳定,因此我的集群不健康。 如何解决这个问题或者在运行etcdctl成员添加命令之后启动我的新节点? 以下是我运行此命令时的输出以及之后的群集状态:
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
简单地说,你添加成员的步骤是错误的。
正如在官方文档中 ,向我假设的add a new member to a 1-node cluster
的步骤是您的scheme:
- 启动第一个节点
- 运行
etcdctl member add
- 启动与群集相关的选项的第二个节点
所以根据你的情况:
在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