etcd3 on Compose

etcd is a distributed key/value store with an emphasis on consistency. Using the RAFT consensus algorithm to coordinate all the nodes, queries to etcd are assured to get the correct answer. etcd version 3 uses gRPC for communications, leases for key expiry, transactions for ACID like operations and scalable watch monitoring, this emphasis on correctness has made etcd a leader in configuration management databases.

📘

etcd v3 and v2

There are two major versions of etcd, v2 and v3, which have different APIs and different capabilities. The current Compose default is v3 and you are reading the documentation for that now. The now deprecated version, v2, is documented separately for clarity.

etcd for All is a general introduction to etcd on Compose.

Are you wondering what you'll get, or can get, with a Compose etcd deployment? Want to know what you'll need to do to manage it? Check out some of the implementation features and details down in etcd for Ops and Admins.

Just deployed etcd and want to get coding with it? Developing an application or want to try a new stack? Then see the etcd for Developers section for resources on how to connect from different languages, command line tools and more information to get you started.

etcd for All

When deployed on Compose, etcd has comes with these standard Compose features.

Compose deployments of etcd also come with a number of etcd specific features:

  • Data Browser For etcd3.
  • An optional add-on for real-time log access.
  • Start with 256MB for $28.50 - as you grow each additional 256MB unit costs $19.50.

Compose Configuration

An etcd deployment starts with three etcd data members; each member with 256MB memory and 256MB storage. Also included are two HAProxy portals to manage connections and high-availability at 64MB memory each.

Expansion Options

etcd deployments may be vertically scaled with additional storage and memory added to each node. The HAProxy portals may also be scaled with more memory.

Datacenter Availability

See Compose Datacenter Availability for current location availability.

Billing and Costs

Compose deployments are billed based on disk usage and your etcd deployment usage is measured hourly. It is then grouped into a single monthly billing cycle. This means that any scaling or add-on usage will be charged from when the new resource was provisioned; not just for the month. You can see your deployment's usage in the Overview panel, under Current Usage.

For Ops and Admins

High-availability and Failover Details

In an etcd cluster each member knows about every other member and relies on a distributed consensus protocol to determine the leader. The leader send out information about its leader status at a set interval. The followers, if nothing has been heard from the leader, all have their own interval after which they will attempt to become a leader. The two haproxy portals will automatically handle incoming connections regardless of which member of the cluster is leader and should one haproxy go down your application can fail-over to the other portal.

Backups

Etcd3 backups use the snapshot command on your running database cluster to backup your entire deployment. You can both download your backups for local use, or restore them directly into a new Compose deployment. More information, details, and instructions for using your backups can be found on the Backups for etcd3 page.

General information on backup schedules and downloading your backups can be found on the Backups page.

High Resolution Scaling

With etcd, the autoscaling system samples the resource consumption of deployments sixty times faster (once a minute) than standard Compose autoscaling.This makes it extra-responsive to the demands a predominantly memory-based database can place on resources.

For Developers

CLI Tools

The etcdctl is the command-line utility and is available through a local installation of etcd. It offers a full set of easy to use commands which map to the underlying etcd API.

Connecting to etcd

The Overview panel of the Compose UI provides the basic information you need to get connected to your databases. In the section Connection info you will find Credentials and Connection Strings for your application.

Our etcd deployments are SSL-enabled using Let's Encrypt certificates. More information on getting your applications connected is on the Connecting to etcd3 page.

Features for your etcd Application

Prefixes:
Keys are handled in a flat namespace and treated as strings. A directories can be emulated by naming keys with a directory structure and then using --prefix. The prefix option matches any key that starts with a particular string. You can query and watch keys that start with the value you enter.

Transactions:
etcd3 has the ability to group multiple operations into a single transaction using an If/Then/Else structure. The requested operations are dependent on the existing contents of the key/value store before execution is allowed to occur. The key can be checked as a comparison or series of comparisons as a single operation. If the comparison is successful then it executes the code in the 'success requests' block and if the comparison fails then it executes the code in the 'failure requests' block.

Watchers:
Watch a key for any changes. Behind the scenes, etcd3 combines all watchers on a single, bidirectional gRPC stream. The stream delivers events tagged with a watcher’s registered ID. Multiple watch streams can share a connection instead of opening a new one for every watcher, keeping memory overhead low.

Leases and Time-To-Live:
Issue leases for temporary keys with TTL expiration. Behind the scenes, this model reduces keep-alive traffic when multiple keys are attached to the same lease. The keep-alive connections are combined in a lease’s single gRPC stream.

Additional Resources and Related Articles

The full list of documentation for etcd is in the sidebar, in addition to all things Compose.

For more than just help docs, check out Compose Articles and our curated collection of etcd-related topics for more how-to's and information on etcd on Compose.


Still Need Help?

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