I'm not having a problem yet, just searching for advise

I want to build installation of PostgreSQL on 3 nodes using patroni: master and 2 standbys (for failover only). There are PostgreSQL and pgbouncer on each node with same configuration. All applications connect to PostgreSQL via pgbouncer

If PostgreSQL becomes dead, patroni automatically promotes on of the standbys as new master and everything just works fine. But if pgbouncer becomes dead nothing will happen

Is there any good way to make patroni watch pgbouncer (like it is doing for PostgreSQL) or I shouldn't use patroni for this case? What should I use?

I'm really not sure that it is what I want (cause pgbouncer is pretty stable), but here is my considerations: - If pgbouncer becomes dead, entire node becomes useless for applications. So from application point of view it is the same as PostgreSQL becomes dead - I don't really care about type of failure, even if pgbouncer restart could fix everything, so standby promotions suits me well

How do I suppose to solve problems like this?

  • Configuring systemd to restart pgbouncer might be the easiest option.... Restart=on-failure in the .service file. Commented Feb 16, 2023 at 16:37

1 Answer 1


Yes, you can use Consul templates for this. https://github.com/hashicorp/consul-template This will notify pgbouncer that Patroni has elected a new master. Cheers, Dave

  • This answer might be improved by a "how-to" based on what's in the link. Link-only answers are not really considered the best form of answer here.
    – Vérace
    Commented May 2, 2019 at 16:52
  • Sure, I'll get an example up here soon..
    – Dave Cook
    Commented May 6, 2019 at 1:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.