Connecting to etcd3

Compose etcd deployments use Let's Encrypt certificates to secure traffic to and from your deployment.

To connect using the https connection strings found on the Overview page under Connection info you will need to have the Let's Encrypt certificate as part of the certificate store for your OS or runtime environment.

About etcd v3 communications and APIs

The etcd v3 API uses gRPC as its communication layer. This gives much better performance and many features which clients can use for more interaction with the etcd servers. The APIs have been re-crafted around this gRPC communications layer too and, in combination with changes in how many etcd features are implemented, this means that there are new drivers, a new version of etcdctl and new API elements to learn.


etcd2 notes

The changes made in etcd v3 mean that communicating with the server using the curl command, as in v2, is no longer available.

Connection credentials

The etcd connection information is presented in the form of an etcdctl command in the Compose console overview for an etcd3 database.


etcd v3 connection info

Command line connections

You will need the etcdctl command to connect with the given command line.


Getting etcdctl

The etcdctl command is available in the etcd distribution which can be downloaded from the coreos/etcd repository. If you are a Mac user, you may find it easier to install Homebrew and then run brew install etcd. Either method should give you a binary etcdctl command.

On any etcd3 deployment you have, if you reveal the password, then copy and paste the command line, the command will execute and show a list of member nodes:

$ ETCDCTL_API=3 etcdctl --endpoints=, --user=root:password member list -w table
|        ID        | STATUS  |                  NAME                   |       PEER ADDRS       |      CLIENT ADDRS      |
| 4c100a12c5f6b382 | started | | | |
| cc55df8ccbdcee39 | started | | | |
| e2b3a3023c19e1d4 | started | | | |

The command line is composed of the following

  • ETCDCTL_API=3 : This sets the API version environment variable for the etcdctl command. The binary for etcdctl actually supports both version 2 and 3 of the API. By default, it uses version 2. Setting this environment variable overrides that. If you are only talking to etcd v3 deployments, you may wish to set this more permanently in your shell environment. Note also that the switch between APIs also changes all of etcdctl's commands.
  • etcdctl : This is the command itself.
  • --endpoints=... : This parameter specifies the endpoints where the etcdctl command will connect. It's comprised of HTTPS protocol URLs and includes a port number.
  • --user=... : This parameter is for the username and password, separated by a colon, to be used as credentials to log in to the etcd deployment.
  • member list : This is an etcdctl command to list the database members of the etcd deployment. Without any other parameters, the result is produced as a list comma separated values.
  • -w table : This is a modifier for the output of member list which reformats it as a table with headings.

You can find out more about working with etcd3 and etcdctl in Using etcd3 Features .

Programming with etcd3

We have a guide on how to get started with Go and etcd3.

Still Need Help?

If this article didn't solve things, summon a human and get some help!