Search code examples
dockercoreosetcd

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


I am trying to add an additional etcd node to my CoreOS cluster with the command "etcdctl member add core2 http://172.31.12.183:2380" but this command leaves my new node as unstarted and my cluster is unhealthy because of this. How do I fix this or start my new node after I run the etcdctl member add command? Here is the output of when I run this command and the cluster status afterwards:

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

Solution

  • Simply to say, the steps you made to add member are wrong.
    As in the official docs, the steps to add a new member to a 1-node cluster which I assume is your scenario :

    1. start the first node
    2. run etcdctl member add
    3. start the second node with cluster related options

    So according to your case:

    before core2 started, run =>

    etcdctl member add core2 http://172.31.12.183:2380  
    

    then, start core2 with cluster related options =>

    ./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