Thread: PgBouncer - HA Mode
Team,
we are using PgBouncer for connection pooling, now all are application is connecting database via PgBouncer. However I need suggestion, if some how VM goes down or something goes wrong with PgBouncer, how can we handle that situation. We observe that currently its a single point of failure for all application if PgBouncer goes down.
Is there any kind of load balancer or replicate the PgBouncer ti manage the high availability?
Thanks in advance.
Regards,
Anjul TYAGI
ü Go Green
On 2020-02-17 11:42, Anjul Tyagi wrote: > we are using PgBouncer for connection pooling, now all are application > is connecting database via PgBouncer. However I need suggestion, if some > how VM goes down or something goes wrong with PgBouncer, how can we > handle that situation. We observe that currently its a single point of > failure for all application if PgBouncer goes down. > > Is there any kind of load balancer or replicate the PgBouncer ti manage > the high availability? A typical approach is to run several pgbouncer instances on separate hosts and use a TCP/IP-level load balancer (e.g., hardware load balancer or HAProxy) to route traffic. -- Peter Eisentraut http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
PgBouncer does not have internal failover-host configuration nor detection. It is possible via some external tools:
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.
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.
You can go for haproxy
Sent from my iPhone
On 17-Feb-2020, at 4:12 PM, Anjul Tyagi <anjul@ibosstech-us.com> wrote:
#x84de9e77b61549c #xf5dcd4e5bcaf4cd793556e604d1ae148 p.MsoNormal {font-size: 11pt; font-family: Calibri, sans-serif; margin: 0in 0in 0pt;} blockquote.cite { margin-left: 5px; margin-right: 0px; padding-left: 10px; padding-right:0px; border-left: 1px solid #cccccc } blockquote.cite2 {margin-left: 5px; margin-right: 0px; padding-left: 10px; padding-right:0px; border-left: 1px solid #cccccc; margin-top: 3px; padding-top: 0px; } a img { border: 0px; } li[style='text-align: center;'], li[style='text-align: right;'] { list-style-position: inside;} body { font-family: Calibri; font-size: 11pt; } Team,we are using PgBouncer for connection pooling, now all are application is connecting database via PgBouncer. However I need suggestion, if some how VM goes down or something goes wrong with PgBouncer, how can we handle that situation. We observe that currently its a single point of failure for all application if PgBouncer goes down.Is there any kind of load balancer or replicate the PgBouncer ti manage the high availability?Thanks in advance.Regards,
Anjul TYAGI
ü Go Green