Skip to content

Commit 065245b

Browse files
committed
faq update
1 parent 935a03e commit 065245b

File tree

1 file changed

+28
-15
lines changed

1 file changed

+28
-15
lines changed

faq.md

+28-15
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,43 @@ PgBouncer port.
1212

1313
## How to load-balance queries between several servers?
1414

15-
1. Use a TCP connection load-balancer. Either
15+
PgBouncer does not have internal multi-host configuration.
16+
It is possible via some external tools:
17+
18+
1. DNS round-robin. Use several IPs behind one DNS name. PgBouncer does
19+
not look up DNS each time new connection is launched. Instead it
20+
caches all IPs and does round-robin internally. Note: if there is
21+
more than 8 IPs behind one name, the DNS backend must support EDNS0
22+
protocol. See README for details.
23+
24+
2. Use a TCP connection load-balancer. Either
1625
[LVS](http://www.linuxvirtualserver.org/) or
1726
[HAProxy](http://www.haproxy.org/) seem to be good choices. On
1827
PgBouncer side it may be good idea to make `server_lifetime` smaller
1928
and also turn `server_round_robin` on - by default idle connections
2029
are reused by LIFO algorithm which may work not so well when
2130
load-balancing is needed.
2231

23-
2. DNS round-robin. Use several IPs behind one DNS name. PgBouncer does
24-
not look up DNS each time new connection is launched. Instead it
25-
caches all IPs and does round-robin internally. Note: if there is
26-
more than 8 IPs behind one name, the DNS backend must support EDNS0
27-
protocol. See README for details.
32+
## How to failover
33+
34+
PgBouncer does not have internal failover-host configuration nor detection.
35+
It is possible via some external tools:
36+
37+
1. DNS reconfiguration - when ip behind DNS name is reconfigured, pgbouncer
38+
will reconnect to new server. This behaviour can be tuned via 2
39+
config parameters - **dns_max_ttl** tunes lifetime for one hostname,
40+
and **dns_zone_check_period** tunes how often zone SOA will be
41+
queried for changes. If zone SOA record has changed, pgbouncer
42+
will re-query all hostnames under that zone.
43+
44+
2. Write new host to config and let PgBouncer reload it - send SIGHUP
45+
or use RELOAD; command on console. PgBouncer will detect changed
46+
host config and reconnect to new server.
2847

2948
## How to use SSL connections with PgBouncer?
3049

50+
[ TLS support will be in next version of PgBouncer. Build from GIT to get it. ]
51+
3152
Use [Stunnel](https://www.stunnel.org/). Since version 4.27 it supports
3253
PostgreSQL protocol for both client and server side. It is activated by
3354
setting `protocol=pgsql`.
@@ -51,15 +72,7 @@ client.
5172
### Disabling prepared statements in JDBC
5273

5374
The proper way to do it for JDBC is adding `prepareThreshold=0`
54-
parameter to connect string. But current JDBC code ignores the setting
55-
for BEGIN/COMMIT/ROLLBACK statements and still tries to cache their
56-
plans. This can be fixed with following patch:
57-
58-
[http://treehou.se/~omar/postgresql-jdbc-8.4-701-pgbouncer_txn.patch](http://treehou.se/~omar/postgresql-jdbc-8.4-701-pgbouncer_txn.patch)
59-
60-
described here:
61-
62-
[http://pgfoundry.org/pipermail/pgbouncer-general/2010-February/000507.html](http://pgfoundry.org/pipermail/pgbouncer-general/2010-February/000507.html)
75+
parameter to connect string.
6376

6477
### Disabling prepared statements in PHP/PDO
6578

0 commit comments

Comments
 (0)