Enhancing high availability for PostgreSQL at Compose


TL;DR: When you upgrade to the newly released PostgreSQL 9.6.5, 9.5.9 or 9.4.14, your database deployments will get a whole new high availability architecture.

Today, we're releasing minor updates to PostgreSQL deployments on Compose, delivering PostgreSQL 9.6.5, 9.5.9 or 9.4.14 to new deployments. Normally this wouldn't be a big event, but under the covers, we've got something big going on; a whole new high availability architecture which is also rather familiar.

When we released PostgreSQL on Compose, we created our own high availability solution - Governor and we open sourced it so the world could share in the idea of a simple high-availability solution for PostgreSQL. Now the time has come to replace Governor so we can further improve the reliability of PostgreSQL on Compose. The best part? We're replacing it with a fork of Governor; Patroni.

About Patroni

We talked to Oleksii Kliukin from Zalando, home of Patroni who told us "We are delighted to welcome Compose into a growing community of Patroni users". He explained how "the project is based on ideas from Compose Governor and has started from the Governor code base around two years ago by the database team at Zalando."

The purpose of the Patroni project is "to provide an easy-to-use high availability for PostgreSQL running in any environment, from bare metal to the cloud and Kubernetes." The team at Zalando added support for Consul or Zookeeper to the original etcd design for keeping the cluster state: At Compose, we're sticking with etcd for that.

The Zalando team also implemented manual and scheduled failovers through a REST API and master re-attachment with pg_rewind. Patroni is also able to dynamically reconfigure all the cluster members at once.

Kliukin pointed out the healthy state of the Patroni project which has received multiple contributions from developers all over the world. "They have added configurable methods to create replicas, support for watchdogs on Linux, a synchronous replication mode, and other improvements."

At Compose, we're pleased to be joining a community which demonstrates how open source is about sharing and solving common problems. To emphasize our commitment to Patroni as our ongoing and future HA platform for PostgreSQL, we're deprecating Governor; no more work will be done on it and our future HA development work will happen with the Patroni project.

Going Forward

For Compose users, this change won't be immediately visible but will be being made available to all users over the coming month. Initially, only new deployments of PostgreSQL 9.4.14, 9.5.9 and 9.5.6 will be guaranteed to have Patroni-based management. A "restore backup to new deployment" will create a new Patroni-based version of an existing database if a user selects one of these versions as a restore target.

For deployments running older versions, we are already in the process of adding the extra etcd capsules needed by Patroni to maintain availability while keeping the deployment using Governor. Patroni uses three rather than Governor's singular etcd. These additional capsules do not incur any extra cost. This work will continue for a number of weeks during which there will be a temporary hiatus on in-place upgrades of PostgreSQL.

Once complete, we will then able to allow users to migrate, in place and without any backup/restore process, to the latest PostgreSQL in their series. That is 9.4.x->9.4.14, 9.5.x->9.5.9 and 9.6.3->9.6.5. Doing that upgrade will also migrate the deployment to Patroni.

The new Patroni configurations will enable us to take new approaches to managing PostgreSQL on Compose too which should make the Compose PostgreSQL experience even smoother and even more reliable.

Read more articles about Compose databases - use our Curated Collections Guide for articles on each database type. If you have any feedback about this or any other Compose article, drop the Compose Articles team a line at articles@compose.com. We're happy to hear from you.

attribution Steve Berryman

Dj Walker-Morgan
Dj Walker-Morgan was Compose's resident Content Curator, and has been both a developer and writer since Apples came in II flavors and Commodores had Pets. Love this article? Head over to Dj Walker-Morgan’s author page to keep reading.

Conquer the Data Layer

Spend your time developing apps, not managing databases.