Presented by:

Sm9a1767 alex

Alexey Klyukin

Adjust GbmH

Alexey started with PostgreSQL at 2003 as a C programmer. He learned how to debug the backend code before learning SQL, but caught up on the latter pretty quickly. He is now using both of those skills and years of experience as a database consultant to help his employer manage a growing number of PostgreSQL database clusters and deal with terabytes of analytical data. Oleksii is based in Berlin and works as a PostgreSQL Engineer at Adjust GbmH. Over the years, he contributed code and documentation to the PostgreSQL project, as well as promoted Postgres by starting PostgreSQL User Group Berlin in 2015.


Alexander Kukushkin

Zalando SE

During his professional career, Alexander touched PostgreSQL from all possible sides: as Web Developer, as System Administrator, and as a Database Engineer now. About four years ago he started working on Patroni project and achieved quite a big success with it. Periodically he reports bugs and contributes patches to PostgreSQL and some other open source projects (usually postgres related). He is a regular speaker at different postgres events.

No video of the event yet, sorry!
Download the Slides

PostgreSQL has built-in support for creating hot standby nodes and keeping them up-to-date with streaming replication; alas, there is no out-of-box failover. Patroni is a small Python daemon to fill that niche, enabling anyone in a few simple steps to create high availability PostgreSQL clusters based on hot standby and streaming replication. It manages the PostgreSQL database instance and utilises an external consistency layer (based on either Etcd, Consul, Zookeeper or Kubernetes) for cluster-wide information, such as the list of members and the leader key. Patroni supports on-the-fly addition of new replicas to the existing cluster, can dynamically change the PostgreSQL configuration on all cluster nodes at once, implements both automatic failovers and controlled switchovers (both immediate and scheduled ones). It provides a lot of useful features, such as support for synchronous replication, custom actions fired during the leader switch, reporting and managing of the state of the instance via the REST API, running user-supplied scripts for replica imaging and custom bootstrap of the first node in the cluster, Kubernetes-native mode and much more. We'll go through the architecture of Patroni, provide in-detailed instructions how to configure HA PostgreSQL clusters based on it and describe many additional features. Participants will get hands-on experience in setting up HA PostgreSQL, diagnosing and troubleshooting most common issues happening during that process. We expect to cover the following topics:

  • architecture overview
  • hands-on: creating your first HA cluster
  • using patronictl to change the PostgreSQL configuration dynamically
  • REST API-based monitoring
  • approaches to forwarding clients to the master node
  • additional features: switchovers, scheduled actions, pause mode
  • setting up synchronous replication
  • using tags for cascading replication and bootstrapping from replicas
  • extending Patroni with custom scripts
  • diagnosing and troubleshooting common errors

Slides are available at

3 h
PostgresConf US 2018
Operations and Administration
Requires Registration:
Yes (Registered: 28/35)