How to do it...

Presuming that our calculated pool size was 25, with a memory-imposed maximum of 350, follow these steps to properly configure PgBouncer:

  1. Execute this query as the postgres user while connected to any database within PostgreSQL:
        COPY ( 
            SELECT '"' || rolname || '" "' ||  
                   coalesce(rolpassword, '') || '"' 
              FROM pg_authid 
        ) 
        TO '/etc/pgbouncer/userlist.txt'; 
  1. Open the /etc/pgbouncer/pgbouncer.ini file as the postgres system user.
  2. Under the section labeled [databases], create the following entry:
        postgres = host=localhost 
  1. Under the section labeled [pgbouncer], find the listen_addr entry and change it to the following:
        listen_addr = * 
  1. Under the section labeled [pgbouncer], find the auth_type entry and change it to the following: ...

Get PostgreSQL High Availability Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.