awsetcd

Create an etcd cluster

This section describes the creation of a etcd cluster with servers located on different hosts.

Create the cluster

Launch as many etcd instances as the number of nodes you wish to have in your cluster (in this example, three instances) and then perform the steps below on each node:

  • Edit the /opt/bitnami/conf/etcd.conf.yml file and modify it as shown below. Remember to replace IP_ADDRESS_OWN with the IP address of the current node and IP_ADDRESS_NODE_X with the corresponding IP addresses of the other nodes.

    advertise-client-urls: http://IP_ADDRESS_OWN:2379
    initial-advertise-peer-urls: http://IP_ADDRESS_OWN:2380
    initial-cluster=http://IP_ADDRESS_OWN:2380,http://IP_ADDRESS_MEMBER_1:2380,http://IP_ADDRESS_MEMBER_2:2380
    

The example configuration above assumes a three-node cluster; if your cluster has fewer or more nodes, add or remove additional IP addresses accordingly.

  • Restart etcd services:

    $ sudo /opt/bitnami/ctlscript.sh restart
    

Test the cluster

To check if the replication is working correctly in the cluster, try the following:

IMPORTANT: The etcdctl CLI requires user authentication. It is necessary to include the default username and password when execute commands in the etcdctl CLI. Replace the PASSWORD placeholder with your admin password in the commands below.

  • In the first server, create a key-value by executing the following:

    $ etcdctl -u root:PASSWORD set /message Hello
    Hello
    
  • Log in to any other server and use the get /message command to check the existing data. It should show the key-value created in the first server:

    $ etcdctl -u root:PASSWORD get /message
    Hello
    

Congratulations! You now have a etcd cluster running and ready to replicate the data through all the instances/nodes.

Last modification September 6, 2018