The etcd is a strongly consistent, distributed key-value store that provides a reliable way to store data that needs to be accessed by a distributed system or cluster of machines. It gracefully handles leader elections during network partitions and can tolerate machine failure, even in the leader node.
|Number of VMs||3|
|Disk Size||20 GB SSD|
|Operating System||CentOS 7 x64|
|Privileges||ROOT access prefered|
|VM IPs||10.101.15.101 - 10.101.15.103|
3.1.1. Set server hostname.
3.1.2. Install prerequisites.
3.1.3. Synchronize server time with default NTP servers. If you have your own NTP servers, please make sure to update the /etc/chrony.conf
3.1.4. Start and enable chronyd service.
3.1.5. Display time synchronization status.
3.1.6. Disable File Access Time Logging and enable Combat Fragmentation to enhance XFS file system performance. Add
noatime,nodiratime,allocsize=64m to all XFS volumes under /etc/fstab.
3.1.7. Tweaking the system for high concurrency and security.
3.1.8. Reload all sysctl variables without rebooting the server.
3.1.9. Create Local DNS records.
3.1.10. The servers need to be restarted before continuing further.
3.2.1. Download and install the latest ETCD binary from GitHub.
You can download the latest ETCD binary from here.
3.2.2. Create ETCD service user.
3.2.3. Create ETCD directory structure and provide necessary permissions.
3.2.4. Copy the correct SSL certificate, SSL key and the CA certificate files under /etc/etcd/tls
- To generate a custom CA and CA signed SSL certificates, please follow this guide.
- Other than the *.cluster.local domain, you must have 'localhost' as a Subject Alternative Name (SAN) since etcdctl uses it for internal API calls.
3.2.5. Open necessary firewall ports.
3.2.6. Create ETCD Systemd service.
3.2.7. Restore SELinux context.
3.2.8. Reload systemd manager configurations.
3.3.1. Add the configurations under /etc/etcd/etcd.conf
3.3.2. Set correct permissions.
3.3.3. Start and enable etcd.service.
3.3.4. If there are any errors, please check systemd logs.
3.4.1. Add the configurations under /etc/etcd/etcd.conf
3.4.2. Set correct permissions.
3.4.3. Start and enable etcd.service.
3.4.4. If there are any errors, please check systemd logs.
3.5.1. Add the configurations under /etc/etcd/etcd.conf
3.5.2. Set correct permissions.
3.5.3. Start and enable etcd.service.
3.5.4. If there are any errors, please check systemd logs.
4.1.1. Checks the healthiness of endpoints.
4.1.2. Prints out the status of endpoints.
4.2.1. Create an ETCD snapshot.
Recovering a cluster first needs a snapshot of the keyspace from an etcd member.
A snapshot may either be taken from a live member with the etcdctl snapshot save command or by copying the member/snap/db file from an etcd data directory.
For example, the following command snapshots the keyspace to the file snapshot.db
4.2.2. Restore an ETCD Cluster.
To restore a cluster, all that is needed is a single snapshot db file. A cluster restore with etcdctl snapshot restore creates new etcd data directories; all members should restore using the same snapshot. Restoring overwrites some snapshot metadata (specifically, the member ID and cluster ID); the member loses its former identity. This metadata overwrite prevents the new member from inadvertently joining an existing cluster. Therefore in order to start a cluster from a snapshot, the restore must start a new logical cluster.
Snapshot integrity may be optionally verified at restore time. If the snapshot is taken with etcdctl snapshot save, it will have an integrity hash that is checked by etcdctl snapshot restore. If the snapshot is copied from the data directory, there is no integrity hash and it will only restore by using the configuration flag
A restore initializes a new member of a new cluster, with a fresh cluster configuration using etcd's cluster configuration flags, but preserves the contents of the etcd keyspace. Continuing from the previous example, the following creates new etcd data directories under /var/lib/etcd for a three member cluster.
Before you execute the following commands, please make sure to BACKUP /var/lib/etcd directory.
22.214.171.124. Stop ETCD service and remove /var/lib/etcd directory on ALL nodes.
126.96.36.199. Restore ETCD-1 node.
188.8.131.52. Restore ETCD-2 node.
184.108.40.206. Restore ETCD-3 node.
220.127.116.11. Set necessary permissions and SELinux context on ALL nodes.
18.104.22.168. Start ETCD service on ALL nodes.
22.214.171.124. If there are any errors, please check systemd logs.