Configuring PgBouncer v9
You must configure PgBouncer to work with the PEM database server.
Prerequisites
If you're running EDB Postgres Advanced Server, install EDB PgBouncer.
If you're running EDB Postgres Extended Server or PostgreSQL, install community PgBouncer.
EDB PgBouncer and PgBouncer installation considerations
The name and location of the directories and files in the configuration steps, as well as the user, depend on whether you installed the community version of PgBouncer or EDB PgBouncer. If you installed community PgBouncer (whether you install it from the community repo or the EDB repo), replace the names of the files and directories in the worked example with the values for PgBouncer.
Name | PgBouncer | EDB PgBouncer |
---|---|---|
PgBouncer directory | /etc/pgbouncer | /etc/edb/pgbouncer<1.x> |
ini file | pgbouncer.ini | edb-pgbouncer.ini |
HBA file | /etc/pgbouncer/hba_file | /etc/edb/pgbouncer<1.x>/hba_file |
Service file | pgbouncer | edb-pgbouncer-<1.x> |
User | postgres | enterprisedb |
Configuring PgBouncer
This example configures EDB PgBouncer with the enterprisedb system user.
If you're running community PgBouncer, replace the names of the directories, files, and user as explained in Location of PgBouncer directories.
Open a terminal window and navigate to the PgBouncer directory.
Change the owner of the
etc
directory for PgBouncer (whereedb-pgbouncer.ini
resides) toenterprisedb
, and change the directory permissions to0700
:Change the contents of the
edb-pgbouncer.ini
file:Note
For more information on
auth_user
see Authentication settings.Create an HBA file
(/etc/edb/pgbouncer<1.x>/hba_file)
for PgBouncer that contains the following content:Change the owner of the HBA file
(/etc/edb/pgbouncer<1.x>/hba_file)
toenterprisedb
, and change the directory permissions to0600
:Enable the PgBouncer service, and start the service: