Configuring PgBouncer v9
You must configure PgBouncer to work with the PEM database server.
The name and location of the directories and files in the configuration steps depend on whether you installed the community version of PgBouncer or EDB PgBouncer. The instructions assume you are using EDB PgBouncer. If you have installed PgBouncer from the community repo, replace the names of the files and directories in the example with the PgBouncer values.
Name | PgBouncer | EDB PgBouncer |
---|---|---|
PgBouncer directory | /etc/pgbouncer<1.x> | /etc/edb/pgbouncer<1.x> |
ini file | pgbouncer.ini | edb-pgbouncer.ini |
userlist file | /etc/pgbouncer<1.x>/userlist.txt | /etc/edb/pgbouncer<1.x>/userlist.txt |
HBA file | (/etc/pgbouncer<1.x>/hba_file) | (/etc/edb/pgbouncer<1.x>/hba_file) |
Service file | pgbouncer-<1.x> | edb-pgbouncer-<1.x> |
This example runs PgBouncer as the enterprisedb system user and outlines the process of configuring PgBouncer.
Open a terminal window and navigate to the PgBouncer directory.
Change the owner of the
etc
directory for PgBouncer (wherepgbouncer.ini
resides) toenterprisedb
, and change the directory permissions to0700
:Change the contents of the
pgbouncer.ini
oredb-pgbouncer.ini
file:
Note
For more information on auth_user
see Authentication settings.
Create and update the
/etc/edb/pgbouncer<1.x>/userlist.txt
authentication file for PgBouncer:This creates
/etc/edb/pgbouncer<1.x>/userlist.txt
file and adds the username and password list.Note
If the pem_admin user is a superuser, you must add the password to the authentication file (
enterprisedb
in the example). This allows the pem_admin user to invoke the PEM authentication query functionpem.get_proxy_auth(text)
.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: