Database Reference
In-Depth Information
Set up a Connection Pool
A Connection Pool is the term used for a collection of already connected sessions that can be
used to reduce the overhead of connection and reconnection.
There are various ways that connection pools can be provided, depending upon the software
stack in use. Probably the best option is to look at "server side" connection pool software,
because that works for all connection types, not just within a single software stack.
Here we're going to look at pgbouncer, which is designed as a very lightweight connection
pool. The name comes from the idea that the pool can be paused/resumed to allow the
server to be restarted or bounced.
Getting ready
First of all, decide where you're going to store the pgbouncer parameter files, log files,
and pid files.
pgbouncer can manage more than one database server's connections at same time, though
that probably isn't wise. If you keep pgbouncer files associated with the database server, then
it should be easy to manage.
How to do it...
Carry out the following steps to configure pgbouncer:
1. Create a pgbouncer.ini file
;
; pgbouncer configuration example
;
[databases]
postgres = port=5432 dbname=postgres
[pgbouncer]
listen_port = 6543
listen_addr = 127.0.0.1
admin_users = postgres
;stats_users = monitoring userid
auth_type = trust
; put these files somewhere sensible
auth_file = users.txt
logfile = pgbouncer.log
pidfile = pgbouncer.pid
; required for 9.0
ignore_startup_parameters = application_name
 
Search WWH ::




Custom Search