1

I am new in using pgbouncer 1.7 and I want to configure it with master slave configuration.

I have configured postgres 9.3 streaming replication using repmgr and I want to use pgbouncer for load balancing and connection pooling so that it automatically switches to slave if master goes down . So how should I configure it for the same. I have both master and slave on diff servers and og bouncer on diff servers. Do i need to install pgbouncer on both master and slave servers also for it to work or just installing on a diff server will work .

I have tried many online tutorial for it but sadly didnt found any suggestions. Please if anyone can help.

Thanks in advance, Mohit

Vao Tsun
  • 47,234
  • 13
  • 100
  • 132
Mohitd23
  • 1,439
  • 2
  • 12
  • 10

1 Answers1

1

PgBouncer does not have automatic failover, propagation and ex-master rebuild handling. You can change IP for same hostname to failover though:

https://pgbouncer.github.io/faq.html

How to failover

PgBouncer does not have internal failover-host configuration nor detection. It is possible via some external tools:

  1. DNS reconfiguration - when ip behind DNS name is reconfigured, pgbouncer will reconnect to new server. This behaviour can be tuned via 2 config parameters - dns_max_ttl tunes lifetime for one hostname, and dns_zone_check_period tunes how often zone SOA will be queried for changes. If zone SOA record has changed, pgbouncer will re-query all hostnames under that zone.
  2. Write new host to config and let PgBouncer reload it - send SIGHUP or use RELOAD; command on console. PgBouncer will detect changed host config and reconnect to new server.

Pgpool has automatic failover if you wnat to try.

Community
  • 1
  • 1
Vao Tsun
  • 47,234
  • 13
  • 100
  • 132