News for hackers. Stuff that matters.
Re:PostgreSQL 11.3 and 10.8 by rooam-dev on Thursday May 09, 2019 @11:48AM (#19869311)
Question for PG happy users.

How do you manage failover and replication? At my previous job this was done by a consultant. Is this doable on a self hosted setup?

Thank you in advance.

Re:PostgreSQL 11.3 and 10.8 by combatentropy on Thursday May 09, 2019 @12:10PM (#19869510)
PostgreSQL has replication built in now. I set it up at work, and it replicates reliably, in a fraction of a second. I've never had to fail over, but it seems straightforward to do so. The only hard part was following Postgres's documentation in setting it all up. It seemed to me a bit scattered to me. I had to jump around to different sections before I put it all together in my mind.
Re:PostgreSQL 11.3 and 10.8 by throw0101a on Thursday May 09, 2019 @12:35PM (#19869743)
What do you use? Are there some instructions/articles that you'd recommend reading? Is it anything like Galera?

I know of BDR, but there hasn't much news about it lately, especially with more recent versions of Pg.

We like Galera for our simple needs: we use keepalived to do health checks, and if they pass the node participates in the VRRP cluster. If one node goes down/bad, another takes over.

Re:PostgreSQL 11.3 and 10.8 by duckehlabs on Thursday May 09, 2019 @01:09PM (#19870077)
If you want multi master in Postgres, I think BDR is going to be your best option, but the version for PG 10+ isn't open source so you'll have to pay for it. We're using the open source version on PG 9.4 currently in production, it's worked fine so far.

If you're just looking for a hot standby and dont need a multi master setup, you can set those up just with pg. https://www.postgresql.org/docs/9.4/hot-standby.html

Re:PostgreSQL 11.3 and 10.8 by truth_seeker on Thursday May 09, 2019 @12:07PM (#19869484)
Re:PostgreSQL 11.3 and 10.8 by cromantin on Thursday May 09, 2019 @11:55AM (#19869360)
We've been doing replication for 3+ years with zolando patroni. It works great. We run pg in docker and patroni too. First it was patroni with consul and right now its patroni with kubernes store (it store leader in endpoint). Highly recommend. There are other popular tools for this, it just a preference.
Re:PostgreSQL 11.3 and 10.8 by htn on Thursday May 09, 2019 @02:11PM (#19870658)
One option for automated health monitoring and failover is pglookout: https://github.com/aiven/pglookout
Re:PostgreSQL 11.3 and 10.8 by Izkata on Thursday May 09, 2019 @05:40PM (#19872704)
We use this, pgbouncer, and a bash script to link the two, for completely automated failover.

Queries done through pgbouncer just pause as if the query is really really slow when the db goes down, then when pglookout does the failover, the bash script switches pgbouncer's config and those pending queries are sent immediately.