When we explained how we do PostgreSQL High Availability back in January, we told you about the Governor. The Governor is our own HA software solution based around etcd. It lets us ensure our PostgreSQL clusters stay available without burying them in a complex management framework. We knew that a clean, simple and robust solution like that would be in demand and we had a plan for that. That plan was to open source Governor and we’ve now done that.
Actually we’ve gone a little further than that, so let’s introduce you to Governor – A Template for PosgreSQL HA with etcd – We aren’t delivering a pre-canned high availability kit in Governor. Every installation is different and, especially with HA solutions, making sure it fits perfectly is also making sure there’s no slackness in response. With that in mind we’ve made Governor into a set of templates for you to take and customize to fit your platform and applications.
To help understanding how it works, we have two new resources. This PDF Diagram lays out the processes by which the Governor ensures it’s keeping its applications available and how it selects a leader. And for those of you who would enjoy a full presentation, Chris Winslett, project lead on Governor is below talking at a recent CoreOS meetup about the platform
Getting the Governor going
It’s easy to get going with Governor and experiment with PostgreSQL High Availability. Start by downloading or cloning the Governor repository.
If you are on a Mac, you’ll first need to use
brew to install postgresql, etcd, haproxy and libyaml and
pip to install psycopg2 and pyyaml:
brew install postgresql etcd haproxy libyaml python pip install psycopg2 pyyaml
Then follow the Getting Started section of the documents, where you start up etcd, then separate instances of the Governor application. With it running you can experiment with killing processes in various scenarios and seeing how Governor reacts and expand the number of instances to see how it scales to larger configurations.
We’ll be enhancing Governor for our internal HA needs at Compose over the coming months and feeding back useful changes into the open source edition so others can benefit. We encourage others to do the same with Governor and we will be accepting pull requests too. We’ve licensed Governor with an MIT license though so you don’t have to feel obliged to feed back changes.