This documentation is for a release that is no longer maintained
See documentation for the latest supported version 3 or the latest supported version 4.Questo contenuto non è disponibile nella lingua selezionata.
Chapter 39. Adding etcd nodes after restoring
After the first instance is running, you can add multiple etcd servers to your cluster.
Procedure
Get the etcd name for the instance in the
ETCD_NAME
variable:grep ETCD_NAME /etc/etcd/etcd.conf
# grep ETCD_NAME /etc/etcd/etcd.conf
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Get the IP address where etcd listens for peer communication:
grep ETCD_INITIAL_ADVERTISE_PEER_URLS /etc/etcd/etcd.conf
# grep ETCD_INITIAL_ADVERTISE_PEER_URLS /etc/etcd/etcd.conf
Copy to Clipboard Copied! Toggle word wrap Toggle overflow If the node was previously part of a etcd cluster, delete the previous etcd data:
rm -Rf /var/lib/etcd/*
# rm -Rf /var/lib/etcd/*
Copy to Clipboard Copied! Toggle word wrap Toggle overflow On the etcd host where etcd is properly running, add the new member:
If you use the v2 etcd api, run this command:
etcdctl2 member add <name> <advertise_peer_urls>
$ etcdctl2 member add <name> <advertise_peer_urls>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow If you use the v3 etcd api, run this command:
etcdctl3 member add *<name>* \ --peer-urls="*<advertise_peer_urls>*"
# etcdctl3 member add *<name>* \ --peer-urls="*<advertise_peer_urls>*"
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
The command outputs some variables. For example:
ETCD_NAME="master2" ETCD_INITIAL_CLUSTER="master-0.example.com=https://192.168.55.8:2380" ETCD_INITIAL_CLUSTER_STATE="existing"
ETCD_NAME="master2" ETCD_INITIAL_CLUSTER="master-0.example.com=https://192.168.55.8:2380" ETCD_INITIAL_CLUSTER_STATE="existing"
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Add the values from the previous command to the
/etc/etcd/etcd.conf
file of the new host:vi /etc/etc/etcd.conf
# vi /etc/etc/etcd.conf
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Start the etcd service in the node joining the cluster:
systemctl start etcd.service
# systemctl start etcd.service
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Check for error messages:
journalctl -fu etcd.service
$ journalctl -fu etcd.service
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Repeat the previous steps for every etcd node to be added.
Once you add all the nodes, verify the cluster status and cluster health:
If you use the v2 etcd api, run the following commands:
etcdctl2 member list
# etcdctl2 member list 5cd050b4d701: name=master1 peerURLs=https://10.0.0.7:2380 clientURLs=https://10.0.0.7:2379 isLeader=true d0c57659d8990cbd: name=master2 peerURLs=https://10.0.0.5:2380 clientURLs=https://10.0.0.5:2379 isLeader=false e4696d637de3eb2d: name=master3 peerURLs=https://10.0.0.6:2380 clientURLs=https://10.0.0.6:2379 isLeader=false
Copy to Clipboard Copied! Toggle word wrap Toggle overflow etcdctl2 cluster-health
# etcdctl2 cluster-health member 5cd050b4d701 is healthy: got healthy result from https://10.0.0.7:2379 member d0c57659d8990cbd is healthy: got healthy result from https://10.0.0.5:2379 member e4696d637de3eb2d is healthy: got healthy result from https://10.0.0.6:2379 cluster is healthy
Copy to Clipboard Copied! Toggle word wrap Toggle overflow If you use the v3 etcd api, run the following commands:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow