Why etcd?

In order to build our stack, we will need a reliable message-passing layer. Some enterprising students at Stanford University came up with a consensus algorithm they named Raft. There's a lot of theory regarding how it works, but the end result is that a key/value pair stored within a Raft-based layer remains internally consistent across all servers.

This is crucially important because we will be using etcd to store the location of the primary Postgres server. Provided we have a service which can connect to etcd, any one of our Postgres servers will immediately know the location of the primary system. This makes it trivial to alter replication sources when the primary changes.

Get PostgreSQL High Availability Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.