What does HackerNews think of patroni?

A template for PostgreSQL High Availability with Etcd, Consul, ZooKeeper, or Kubernetes

Language: Python

#6 in Kubernetes
#6 in PostgreSQL
one of the solutions which made it pretty simple for us to run postgresql in a ha environment (mostly in k8s, but works standalone as well) is zalandos patroni: https://github.com/zalando/patroni it's really solid and worked for us for a few years already. (it also comes with a haproxy config to have a single leader connection)

or for k8s their operator: https://github.com/zalando/postgres-operator (docker image: https://github.com/zalando/spilo) we've also tried other operators which were easier to get started, but they failed miserably (crunchyrolls operator is basically based on the zalando one)

If you use Oracle MySQL or Percona Server, I would recommend to try group replication[1], no third-party software required.

MariaDB can use something similar called Galera Cluster. Percona also has its own version, called Percona XtraCluster (PXC).

For more traditional MySQL/MariaDB replication typologies, Orchestrator[2] is a great tool.

For postgres, I have heard a lot of good words about Patroni[3], although I never used it myself.

[1]: https://dev.mysql.com/doc/refman/8.0/en/group-replication.ht...

[2]: https://github.com/openark/orchestrator

[3]: https://github.com/zalando/patroni

True, and you can go really far with postgresql alone, like zalado did (biggest german e-commerce platform):

https://github.com/zalando/patroni

> High availibility is a bit more complicated to set up with Postgres, and I don't have much experience with that part.

There is Patroni[0], which has a Docker-based setup template in Spilo[1]. I don't have expertise enough to say anything about these, except that I've been running an HA setup with Spilo for several months without issues so far.

Would be interesting to hear what more experienced postgres people have to say about it :)

Also we've opted to just use traefik (based on spilo service registration) rather than pgbouncer.

[0]: https://github.com/zalando/patroni

[1]: https://github.com/zalando/spilo

Or Patroni (https://github.com/zalando/patroni), a better option. But it is complex to setup, requires other external tools too (DNS, virtual IPs, Envoy proxy, etc) and none of that is included in Postgres.

Postgres HA is far from easy. I gave a talk 2 years ago about this (video and slides: https://aht.es/#talks-modern_postgresql_high_availability). This is an operational disadvantage.

It's not really about specific AMI, you can install postgresql on any system, and if you use one of these[1] you can enjoy official packages.

One of nice things about RDS is seamless replication and backups, this is not available out of the box, and you kind of need to set it up yourself, it is not that hard, especially if you have a CMS (such as salt, chef) helps a lot with it.

There is already RDS functionality available through open source, if you're on premises I would highly recommend repmgr[2] and barman[3] the former is making setting replication and failover easy, the later is performing streaming backups and PITR.

In AWS in place of barman, you could perhaps use WAL-E[4] or WAL-G[5] these basically do the same thing barman does, but instead of running an instance that keeps the backup WAL-E and WAL-G stores backups directly in S3.

There's also Patroni[6] which is an alternative to repmgr. I have used personally repmgr and barman, and there wasn't really much overhead maintaining it. Although in public cloud the other solutions might be more suited?

The nice thing for maintaining your own setup is greater control over the database, for example you have full control over what extensions you use or which version of PG you deploy. Many changes that in RDS require server restart, you can just restart the process and have lower downtime. In my company we also went with Aurora PG 9.6 there's already Aurora PG 10, but there's currently no upgrade path without taking everything down, backing up and restoring on another instance. Supposedly AWS is working on it, but they won't tell when it is available. Also there's no PG 11 or heh, 12. With own PG setup also major version upgrade is quite quick, I think it took 2 minutes, if you were sure you have backups and performed upgrade in place.

Honestly what RDS offers isn't something that isn't available outside, it's just that might require some prior investment, in our case was writing salt roles that set up and configured the nodes.

[1] https://www.postgresql.org/download/

[2] https://repmgr.org/

[3] https://www.pgbarman.org/index.html

[4] https://github.com/wal-e/wal-e

[5] https://github.com/wal-g/wal-g

[6] https://github.com/zalando/patroni

Also check out our Zalando Postgres Kubernetes Operator which is powered by Patroni: https://github.com/zalando/patroni/
Out of interest, have you tried https://github.com/zalando/patroni ? It seems to fill this niche.

I've been meaning to try it out for the HA postgres use case, but haven't gotten around to it.