1PGBOUNCER.INI(5)                   Databases                  PGBOUNCER.INI(5)
2
3
4

NAME

6       pgbouncer.ini - configuration file for pgbouncer
7

DESCRIPTION

9       The  configuration  file is in “ini” format.  Section names are between
10       “[" and "]”.  Lines starting with “;” or “#” are taken as comments  and
11       ignored.  The characters “;” and “#” are not recognized as special when
12       they appear later in the line.
13

GENERIC SETTINGS

15   logfile
16       Specifies the log file.  For daemonization (-d), either this or  syslog
17       need to be set.
18
19       The  log  file is kept open, so after rotation, kill -HUP or on console
20       RELOAD; should be done.  On Windows, the service must  be  stopped  and
21       started.
22
23       Note  that  setting  logfile  does  not  by  itself turn off logging to
24       stderr.  Use the command-line option -q or -d for that.
25
26       Default: not set
27
28   pidfile
29       Specifies the PID file.  Without pidfile set, daemonization (-d) is not
30       allowed.
31
32       Default: not set
33
34   listen_addr
35       Specifies a list (comma-separated) of addresses where to listen for TCP
36       connections.  You may also use * meaning  “listen  on  all  addresses”.
37       When not set, only Unix socket connections are accepted.
38
39       Addresses can be specified numerically (IPv4/IPv6) or by name.
40
41       Default: not set
42
43   listen_port
44       Which port to listen on.  Applies to both TCP and Unix sockets.
45
46       Default: 6432
47
48   unix_socket_dir
49       Specifies the location for Unix sockets.  Applies to both the listening
50       socket and to server connections.  If set  to  an  empty  string,  Unix
51       sockets are disabled.  A value that starts with @ specifies that a Unix
52       socket in the abstract namespace should be created (currently supported
53       on Linux and Windows).
54
55       For  online  reboot (-R) to work, a Unix socket needs to be configured,
56       and it needs to be in the file-system namespace.
57
58       Default: /tmp (empty on Windows)
59
60   unix_socket_mode
61       File system mode for Unix socket.  Ignored for sockets in the  abstract
62       namespace.  Not supported on Windows.
63
64       Default: 0777
65
66   unix_socket_group
67       Group name to use for Unix socket.  Ignored for sockets in the abstract
68       namespace.  Not supported on Windows.
69
70       Default: not set
71
72   user
73       If set, specifies the Unix user to change to after startup.  Works only
74       if PgBouncer is started as root or if it’s already running as the given
75       user.  Not supported on Windows.
76
77       Default: not set
78
79   pool_mode
80       Specifies when a server connection can be reused by other clients.
81
82       session
83              Server is released back to pool after client  disconnects.   De‐
84              fault.
85
86       transaction
87              Server is released back to pool after transaction finishes.
88
89       statement
90              Server  is released back to pool after query finishes.  Transac‐
91              tions spanning multiple statements are disallowed in this mode.
92
93   max_client_conn
94       Maximum number of client connections allowed.
95
96       When this setting is increased, then the file descriptor limits in  the
97       operating system might also have to be increased.  Note that the number
98       of file descriptors potentially used is more than max_client_conn.   If
99       each user connects under its own user name to the server, the theoreti‐
100       cal maximum used is:
101
102              max_client_conn + (max pool_size * total databases * total users)
103
104       If a database user is specified in the  connection  string  (all  users
105       connect under the same user name), the theoretical maximum is:
106
107              max_client_conn + (max pool_size * total databases)
108
109       The theoretical maximum should never be reached, unless somebody delib‐
110       erately crafts a special load for it.  Still, it means you  should  set
111       the number of file descriptors to a safely high number.
112
113       Search  for  ulimit in your favorite shell man page.  Note: ulimit does
114       not apply in a Windows environment.
115
116       Default: 100
117
118   default_pool_size
119       How many server connections to allow per user/database  pair.   Can  be
120       overridden in the per-database configuration.
121
122       Default: 20
123
124   min_pool_size
125       Add more server connections to pool if below this number.  Improves be‐
126       havior when the normal load suddenly comes back after a period of total
127       inactivity.  The value is effectively capped at the pool size.
128
129       Only enforced for pools where at least one of the following is true:
130
131       • the  entry in the [database] section for the pool has a value set for
132         the user key (aka forced user)
133
134       • there is at least one client connected to the pool
135
136       Default: 0 (disabled)
137
138   reserve_pool_size
139       How  many  additional  connections  to  allow  to  a  pool   (see   re‐
140       serve_pool_timeout).  0 disables.
141
142       Default: 0 (disabled)
143
144   reserve_pool_timeout
145       If  a client has not been serviced in this time, use additional connec‐
146       tions from the reserve pool.  0 disables.  [seconds]
147
148       Default: 5.0
149
150   max_db_connections
151       Do not allow more than this many server connections per  database  (re‐
152       gardless  of  user).   This  considers  the PgBouncer database that the
153       client has connected to, not the PostgreSQL database  of  the  outgoing
154       connection.
155
156       This can also be set per database in the [databases] section.
157
158       Note  that  when  you hit the limit, closing a client connection to one
159       pool will not immediately allow a server connection to  be  established
160       for  another  pool, because the server connection for the first pool is
161       still open.  Once the server connection closes (due to idle timeout), a
162       new server connection will immediately be opened for the waiting pool.
163
164       Default: 0 (unlimited)
165
166   max_user_connections
167       Do  not  allow more than this many server connections per user (regard‐
168       less of database).  This considers the PgBouncer user that is associat‐
169       ed  with a pool, which is either the user specified for the server con‐
170       nection or in absence of that the user the client has connected as.
171
172       This can also be set per user in the [users] section.
173
174       Note that when you hit the limit, closing a client  connection  to  one
175       pool  will  not immediately allow a server connection to be established
176       for another pool, because the server connection for the first  pool  is
177       still open.  Once the server connection closes (due to idle timeout), a
178       new server connection will immediately be opened for the waiting pool.
179
180       Default: 0 (unlimited)
181
182   server_round_robin
183       By default, PgBouncer  reuses  server  connections  in  LIFO  (last-in,
184       first-out)  manner,  so  that  few connections get the most load.  This
185       gives best performance if you have a single server serving a  database.
186       But  if  there  is a round-robin system behind a database address (TCP,
187       DNS, or host list), then it is better if PgBouncer  also  uses  connec‐
188       tions in that manner, thus achieving uniform load.
189
190       Default: 0
191
192   track_extra_parameters
193       By  default,  PgBouncer  tracks  client_encoding,  datestyle, timezone,
194       standard_conforming_strings and application_name parameters per client.
195       To allow other parameters to be tracked, they can be specified here, so
196       that PgBouncer knows that they should be maintained in the client vari‐
197       able  cache  and restored in the server whenever the client becomes ac‐
198       tive.
199
200       If you need to specify multiple  values,  use  a  comma-separated  list
201       (e.g.  default_transaction_readonly, IntervalStyle)
202
203       Note:  Most parameters cannot be tracked this way.  The only parameters
204       that can be tracked are ones  that  Postgres  reports  to  the  client.
205       Postgres  has  an  official  list  of parameters that it reports to the
206       client (https://www.postgresql.org/docs/15/protocol-flow.html#PROTOCOL-
207       ASYNC).   Postgres extensions can change this list though, they can add
208       parameters themselves that they also report, and they can start report‐
209       ing already existing parameters that Postgres does not report.  Notably
210       Citus 12.0+ causes Postgres to also report search_path.
211
212       The Postgres protocol allows specifying parameters settings,  both  di‐
213       rectly  as  a  parameter  in  the startup packet, or inside the options
214       startup   packet    (https://www.postgresql.org/docs/current/libpq-con
215       nect.html#LIBPQ-CONNECT-OPTIONS).   Parameters  specified using both of
216       these methods are supported by track_extra_parameters.   However,  it’s
217       not  possible to include options itself in track_extra_parameters, only
218       the parameters contained in options.
219
220       Default: IntervalStyle
221
222   ignore_startup_parameters
223       By default, PgBouncer allows only parameters it can keep  track  of  in
224       startup packets: client_encoding, datestyle, timezone and standard_con‐
225       forming_strings.  All others parameters will raise an error.  To  allow
226       others  parameters, they can be specified here, so that PgBouncer knows
227       that they are handled by the admin and it can ignore them.
228
229       If you need to specify multiple  values,  use  a  comma-separated  list
230       (e.g.  options,extra_float_digits)
231
232       The  Postgres  protocol allows specifying parameters settings, both di‐
233       rectly as a parameter in the startup  packet,  or  inside  the  options
234       startup    packet   (https://www.postgresql.org/docs/current/libpq-con
235       nect.html#LIBPQ-CONNECT-OPTIONS).  Parameters specified using  both  of
236       these  methods  are  supported by ignore_startup_parameters.  It’s even
237       possible to include options itself in track_extra_parameters, which re‐
238       sults in any unknown parameters contained inside options to be ignored.
239
240       Default: empty
241
242   peer_id
243       The  peer  id used to identify this PgBouncer process in a group of Pg‐
244       Bouncer processes that are peered together.  The peer_id  value  should
245       be  unique within a group of peered PgBouncer processes.  When set to 0
246       pgbouncer peering is disabled.  See the docs for  the  [peers]  section
247       for  more  information.   The  maximum  value  that can be used for the
248       peer_id is 16383.
249
250       Default: 0
251
252   disable_pqexec
253       Disable the Simple Query protocol (PQexec).  Unlike the Extended  Query
254       protocol, Simple Query allows multiple queries in one packet, which al‐
255       lows some classes of SQL-injection attacks.  Disabling it  can  improve
256       security.   Obviously, this means only clients that exclusively use the
257       Extended Query protocol will stay working.
258
259       Default: 0
260
261   application_name_add_host
262       Add the client host address and port to the  application  name  setting
263       set  on  connection start.  This helps in identifying the source of bad
264       queries etc.  This logic applies only at the start of a connection.  If
265       application_name  is  later changed with SET, PgBouncer does not change
266       it again.
267
268       Default: 0
269
270   conffile
271       Show location of current config file.  Changing it will make  PgBouncer
272       use another config file for next RELOAD / SIGHUP.
273
274       Default: file from command line
275
276   service_name
277       Used on win32 service registration.
278
279       Default: pgbouncer
280
281   job_name
282       Alias for service_name.
283
284   stats_period
285       Sets  how often the averages shown in various SHOW commands are updated
286       and how often aggregated statistics are written to  the  log  (but  see
287       log_stats).  [seconds]
288
289       Default: 60
290
291   max_prepared_statements
292       When  this  is  set to a non-zero value PgBouncer tracks protocol-level
293       named prepared statements related commands sent by the client in trans‐
294       action  and  statement  pooling  mode.   PgBouncer  makes sure that any
295       statement prepared by a client is available on the backing server  con‐
296       nection.   Even  when  the statement was originally prepared on another
297       server connection.
298
299       PgBouncer internally examines all the queries that are sent as  a  pre‐
300       pared statement by clients and gives each unique query string an inter‐
301       nal name with the format  PGBOUNCER_{unique_id}.   Prepared  statements
302       are only prepared using this name on the corresponding PostgreSQL serv‐
303       er.  PgBouncer keeps track of the name that the  client  gave  to  each
304       prepared  statement.   It  rewrites  each  command that uses a prepared
305       statement to use the matching internal name (e.g.   PGBOUNCER_123)  be‐
306       fore  forwarding  that command to the server.  More importantly, if the
307       prepared statement that the client wants to use is not prepared on  the
308       server  yet, it automatically prepares that statement before forwarding
309       the command that the client sent.
310
311       Note: This tracking and rewriting of prepared statement  commands  does
312       not work for SQL-level prepared statement commands such as PREPARE, EX‐
313       ECUTE, DEALLOCATE, DEALLOCATE ALL and DISCARD ALL.  Running  DEALLOCATE
314       ALL and DISCARD ALL is especially problematic, since those commands ap‐
315       pear to run successfully, but they mess up with the state of the server
316       connection  significantly  without  PgBouncer  noticing.  Which in turn
317       will very likely break the execution of any further prepared statements
318       on that server connection.
319
320       The actual value of this setting controls the number of prepared state‐
321       ments kept active on a single server connection.  When the  setting  is
322       set to 0 prepared statement support for transaction and statement pool‐
323       ing is disabled.  To get the best performance you should  try  to  make
324       sure  that this setting is larger than the amount of commonly used pre‐
325       pared statements in your application.  Keep in  mind  that  the  higher
326       this  value,  the larger the memory footprint of each PgBouncer connec‐
327       tion will be on your PostgreSQL  server,  because  it  will  keep  more
328       queries  prepared  on  those connections.  It also increases the memory
329       footprint of PgBouncer itself, because it now needs to  keep  track  of
330       query strings.
331
332       The  impact  on  PgBouncer  memory usage is not that big though: - Each
333       unique query is stored once in a global query  cache.   -  Each  client
334       connection  keeps a buffer that it uses to rewrite packets.  This is at
335       most 4 times the size of pkt_buf.  This  limit  is  often  not  reached
336       though,  it  only  happens when the queries in your prepared statements
337       are between 2 and 4 times the size of pkt_buf.
338
339       So if you consider the following as an example scenario:  -  There  are
340       1000  active clients - The clients prepare 200 unique queries - The av‐
341       erage size of a query is 5kB - pkt_buf parameter is set to the  default
342       of 4096 (4kB)
343
344       Then  PgBouncer  needs at most the following amount of memory to handle
345       these prepared statements:
346
347       200 x 5kB + 1000 x 4 x 4kB = ~17MB of memory.
348
349       Tracking prepared statements does not only come with a memory cost, but
350       also  with  increased CPU usage, because PgBouncer needs to inspect and
351       rewrite the queries.  Multiple PgBouncer instances can  listen  on  the
352       same  port to use more than one core for processing, see the documenta‐
353       tion for the so_reuseport option for details.
354
355       But of course there are also performance benefits  to  prepared  state‐
356       ments.   Just as when connecting to PostgreSQL directly, by preparing a
357       query that is executed many times, it reduces the total amount of pars‐
358       ing  and planning that needs to be done.  The way that PgBouncer tracks
359       prepared statements is especially beneficial to performance when multi‐
360       ple clients prepare the same queries.  Because client connections auto‐
361       matically reuse a prepared statement on a server connection even if  it
362       was  prepared by another client.  As an example if you have a pool_size
363       of 20 and you have 100 clients that all prepare the exact  same  query,
364       then the query is prepared (and thus parsed) only 20 times on the Post‐
365       greSQL server.
366
367       The reuse of prepared statements has one downside.  If  the  return  or
368       argument  types  of a prepared statement changes across executions then
369       PostgreSQL currently throws an error such as:
370
371              ERROR:  cached plan must not change result type
372
373       You can avoid such errors by not having multiple clients that  use  the
374       exact  same query string in a prepared statement, but expecting differ‐
375       ent argument or result types.  One of the most common ways  of  running
376       into this issue is during a DDL migration where you add a new column or
377       change a column type on an existing table.  In those cases you can  run
378       RECONNECT  on  the PgBouncer admin console after doing the migration to
379       force a re-prepare of the query and make the error goes away.
380
381       Default: 0
382

AUTHENTICATION SETTINGS

384       PgBouncer handles its own client authentication and has its  own  data‐
385       base of users.  These settings control this.
386
387   auth_type
388       How to authenticate users.
389
390       cert   Client must connect over TLS connection with a valid client cer‐
391              tificate.  The user name is then taken from the CommonName field
392              from the certificate.
393
394       md5    Use  MD5-based  password check.  This is the default authentica‐
395              tion method.   auth_file  may  contain  both  MD5-encrypted  and
396              plain-text  passwords.   If  md5  is configured and a user has a
397              SCRAM secret, then SCRAM authentication  is  used  automatically
398              instead.
399
400       scram-sha-256
401              Use password check with SCRAM-SHA-256.  auth_file has to contain
402              SCRAM secrets or plain-text passwords.
403
404       plain  The clear-text password is sent over the wire.  Deprecated.
405
406       trust  No authentication is done.  The user name must  still  exist  in
407              auth_file.
408
409       any    Like  the trust method, but the user name given is ignored.  Re‐
410              quires that all databases are configured to log in as a specific
411              user.  Additionally, the console database allows any user to log
412              in as admin.
413
414       hba    The actual authentication type  is  loaded  from  auth_hba_file.
415              This  allows  different authentication methods for different ac‐
416              cess paths, for example: connections over Unix  socket  use  the
417              peer auth method, connections over TCP must use TLS.
418
419       pam    PAM  is  used to authenticate users, auth_file is ignored.  This
420              method is not compatible with databases using the auth_user  op‐
421              tion.   The service name reported to PAM is “pgbouncer”.  pam is
422              not supported in the HBA configuration file.
423
424   auth_hba_file
425       HBA configuration file to use when auth_type is hba.
426
427       Default: not set
428
429   auth_file
430       The name of the file to load user names and passwords from.   See  sec‐
431       tion Authentication file format below about details.
432
433       Most  authentication types (see above) require that either auth_file or
434       auth_user be set; otherwise there would be no users defined.
435
436       Default: not set
437
438   auth_user
439       If auth_user is set, then any user not specified in auth_file  will  be
440       queried  through  the  auth_query query from pg_shadow in the database,
441       using  auth_user.   The  password  of  auth_user  will  be  taken  from
442       auth_file.   (If the auth_user does not require a password then it does
443       not need to be defined in auth_file.)
444
445       Direct access to pg_shadow requires admin rights.  It’s  preferable  to
446       use a non-superuser that calls a SECURITY DEFINER function instead.
447
448       Default: not set
449
450   auth_query
451       Query to load user’s password from database.
452
453       Direct  access  to pg_shadow requires admin rights.  It’s preferable to
454       use a non-superuser that calls a SECURITY DEFINER function instead.
455
456       Note that the query is run inside the target database.  So if  a  func‐
457       tion is used, it needs to be installed into each database.
458
459       Default: SELECT usename, passwd FROM pg_shadow WHERE usename=$1
460
461   auth_dbname
462       Database  name  in the [database] section to be used for authentication
463       purposes.  This option can be either global or overridden in  the  con‐
464       nection string if this parameter is specified.
465

LOG SETTINGS

467   syslog
468       Toggles syslog on/off.  On Windows, the event log is used instead.
469
470       Default: 0
471
472   syslog_ident
473       Under what name to send logs to syslog.
474
475       Default: pgbouncer (program name)
476
477   syslog_facility
478       Under what facility to send logs to syslog.  Possibilities: auth, auth‐
479       priv, daemon, user, local0-7.
480
481       Default: daemon
482
483   log_connections
484       Log successful logins.
485
486       Default: 1
487
488   log_disconnections
489       Log disconnections with reasons.
490
491       Default: 1
492
493   log_pooler_errors
494       Log error messages the pooler sends to clients.
495
496       Default: 1
497
498   log_stats
499       Write aggregated statistics into the log, every stats_period.  This can
500       be disabled if external monitoring tools are used to grab the same data
501       from SHOW commands.
502
503       Default: 1
504
505   verbose
506       Increase verbosity.  Mirrors the “-v” switch on the command line.   For
507       example, using “-v -v” on the command line is the same as verbose=2.
508
509       Default: 0
510

CONSOLE ACCESS CONTROL

512   admin_users
513       Comma-separated  list of database users that are allowed to connect and
514       run all commands on the console.  Ignored when  auth_type  is  any,  in
515       which case any user name is allowed in as admin.
516
517       Default: empty
518
519   stats_users
520       Comma-separated  list of database users that are allowed to connect and
521       run read-only queries on the console.  That means all SHOW commands ex‐
522       cept SHOW FDS.
523
524       Default: empty
525

CONNECTION SANITY CHECKS, TIMEOUTS

527   server_reset_query
528       Query  sent to server on connection release, before making it available
529       to other clients.  At that moment no transaction is in progress, so the
530       value should not include ABORT or ROLLBACK.
531
532       The query is supposed to clean any changes made to the database session
533       so that the next client gets the connection in  a  well-defined  state.
534       The  default  is  DISCARD ALL, which cleans everything, but that leaves
535       the next client no pre-cached state.  It can be made lighter,  e.g. DE‐
536       ALLOCATE  ALL to just drop prepared statements, if the application does
537       not break when some state is kept around.
538
539       When transaction pooling is used, the server_reset_query is  not  used,
540       because  in that mode, clients must not use any session-based features,
541       since each transaction ends up in a different connection and thus  gets
542       a different session state.
543
544       Default: DISCARD ALL
545
546   server_reset_query_always
547       Whether  server_reset_query  should  be run in all pooling modes.  When
548       this setting is off (default), the server_reset_query will be run  only
549       in  pools  that  are in sessions-pooling mode.  Connections in transac‐
550       tion-pooling mode should not have any need for a reset query.
551
552       This setting is for working around broken setups that run  applications
553       that  use  session  features  over  a transaction-pooled PgBouncer.  It
554       changes non-deterministic breakage to deterministic  breakage:  Clients
555       always lose their state after each transaction.
556
557       Default: 0
558
559   server_check_delay
560       How  long  to keep released connections available for immediate re-use,
561       without running server_check_query on it.  If 0 then the check  is  al‐
562       ways run.
563
564       Default: 30.0
565
566   server_check_query
567       Simple do-nothing query to check if the server connection is alive.
568
569       If an empty string, then sanity checking is disabled.
570
571       Default: select 1
572
573   server_fast_close
574       Disconnect  a  server  in session pooling mode immediately or after the
575       end of the current transaction if it is in “close_needed” mode (set  by
576       RECONNECT,  RELOAD  that  changes  connection settings, or DNS change),
577       rather than waiting for the session end.  In statement  or  transaction
578       pooling  mode,  this  has  no effect since that is the default behavior
579       there.
580
581       If because of this setting a server connection is closed before the end
582       of  the client session, the client connection is also closed.  This en‐
583       sures that the client notices that the session has been interrupted.
584
585       This setting makes connection configuration changes take effect  sooner
586       if session pooling and long-running sessions are used.  The downside is
587       that client sessions are liable to be interrupted  by  a  configuration
588       change,  so  client  applications  will  need  logic  to  reconnect and
589       reestablish session state.  But note that no transactions will be lost,
590       because running transactions are not interrupted, only idle sessions.
591
592       Default: 0
593
594   server_lifetime
595       The  pooler  will  close  an unused (not currently linked to any client
596       connection) server connection that has been connected longer than this.
597       Setting  it  to  0  means  the connection is to be used only once, then
598       closed.  [seconds]
599
600       Default: 3600.0
601
602   server_idle_timeout
603       If a server connection has been idle more than  this  many  seconds  it
604       will be closed.  If 0 then this timeout is disabled.  [seconds]
605
606       Default: 600.0
607
608   server_connect_timeout
609       If  connection  and login don’t finish in this amount of time, the con‐
610       nection will be closed.  [seconds]
611
612       Default: 15.0
613
614   server_login_retry
615       If login to the server failed, because of failure to  connect  or  from
616       authentication,  the pooler waits this much before retrying to connect.
617       During the waiting interval, new clients trying to connect to the fail‐
618       ing server will get an error immediately without another connection at‐
619       tempt.  [seconds]
620
621       The purpose of this behavior is that clients don’t unnecessarily  queue
622       up waiting for a server connection to become available if the server is
623       not working.  However, it also means that if a  server  is  momentarily
624       failing, for example during a restart or if the configuration was erro‐
625       neous, then it will take at least this long until the pooler will  con‐
626       sider  connecting  to it again.  Planned events such as restarts should
627       normally be managed using the PAUSE command to avoid this.
628
629       Default: 15.0
630
631   client_login_timeout
632       If a client connects but does not manage to log in in  this  amount  of
633       time, it will be disconnected.  Mainly needed to avoid dead connections
634       stalling SUSPEND and thus online restart.  [seconds]
635
636       Default: 60.0
637
638   autodb_idle_timeout
639       If the automatically created (via "*") database pools have been  unused
640       this many seconds, they are freed.  The negative aspect of that is that
641       their statistics are also forgotten.  [seconds]
642
643       Default: 3600.0
644
645   dns_max_ttl
646       How long DNS lookups can be cached.  The actual  DNS  TTL  is  ignored.
647       [seconds]
648
649       Default: 15.0
650
651   dns_nxdomain_ttl
652       How long DNS errors and NXDOMAIN DNS lookups can be cached.  [seconds]
653
654       Default: 15.0
655
656   dns_zone_check_period
657       Period to check if a zone serial has changed.
658
659       PgBouncer can collect DNS zones from host names (everything after first
660       dot) and then periodically check if the zone serial changes.  If it no‐
661       tices  changes, all host names under that zone are looked up again.  If
662       any host IP changes, its connections are invalidated.
663
664       Works only with c-ares backend (configure option --with-cares).
665
666       Default: 0.0 (disabled)
667
668   resolv_conf
669       The location of a custom resolv.conf file.  This is to allow specifying
670       custom  DNS servers and perhaps other name resolution options, indepen‐
671       dent of the global operating system configuration.
672
673       Requires evdns (>= 2.0.3) or c-ares (>= 1.15.0) backend.
674
675       The parsing of the file is done by the DNS  backend  library,  not  Pg‐
676       Bouncer, so see the library’s documentation for details on allowed syn‐
677       tax and directives.
678
679       Default: empty (use operating system defaults)
680

TLS SETTINGS

682   client_tls_sslmode
683       TLS mode to use for connections from clients.  TLS connections are dis‐
684       abled    by    default.     When   enabled,   client_tls_key_file   and
685       client_tls_cert_file must be also configured to set up the key and cer‐
686       tificate PgBouncer uses to accept client connections.
687
688       disable
689              Plain TCP.  If client requests TLS, it’s ignored.  Default.
690
691       allow  If  client requests TLS, it is used.  If not, plain TCP is used.
692              If the client presents a client certificate, it is not  validat‐
693              ed.
694
695       prefer Same as allow.
696
697       require
698              Client must use TLS.  If not, the client connection is rejected.
699              If the client presents a client certificate, it is not  validat‐
700              ed.
701
702       verify-ca
703              Client must use TLS with valid client certificate.
704
705       verify-full
706              Same as verify-ca.
707
708   client_tls_key_file
709       Private key for PgBouncer to accept client connections.
710
711       Default: not set
712
713   client_tls_cert_file
714       Certificate for private key.  Clients can validate it.
715
716       Default: not set
717
718   client_tls_ca_file
719       Root certificate file to validate client certificates.
720
721       Default: not set
722
723   client_tls_protocols
724       Which  TLS  protocol  versions  are  allowed.  Allowed values: tlsv1.0,
725       tlsv1.1,        tlsv1.2,        tlsv1.3.         Shortcuts:         all
726       (tlsv1.0,tlsv1.1,tlsv1.2,tlsv1.3),   secure  (tlsv1.2,tlsv1.3),  legacy
727       (all).
728
729       Default: secure
730
731   client_tls_ciphers
732       Allowed TLS ciphers, in OpenSSL syntax.  Shortcuts:
733
734       • default/secure/fast/normal (these all use  system  wide  OpenSSL  de‐
735         faults)
736
737       • all (enables all ciphers, not recommended)
738
739       Only  connections  using TLS version 1.2 and lower are affected.  There
740       is currently no setting that controls the cipher choices  used  by  TLS
741       version 1.3 connections.
742
743       Default: default
744
745   client_tls_ecdhcurve
746       Elliptic Curve name to use for ECDH key exchanges.
747
748       Allowed values: none (DH is disabled), auto (256-bit ECDH), curve name
749
750       Default: auto
751
752   client_tls_dheparams
753       DHE key exchange type.
754
755       Allowed  values:  none  (DH  is  disabled),  auto (2048-bit DH), legacy
756       (1024-bit DH)
757
758       Default: auto
759
760   server_tls_sslmode
761       TLS mode to use for connections to  PostgreSQL  servers.   The  default
762       mode is prefer.
763
764       disable
765              Plain TCP.  TLS is not even requested from the server.
766
767       allow  FIXME: if server rejects plain, try TLS?
768
769       prefer TLS  connection  is  always requested first from PostgreSQL.  If
770              refused, the connection will  be  established  over  plain  TCP.
771              Server certificate is not validated.  Default
772
773       require
774              Connection must go over TLS.  If server rejects it, plain TCP is
775              not attempted.  Server certificate is not validated.
776
777       verify-ca
778              Connection must go over TLS and server certificate must be valid
779              according  to  server_tls_ca_file.   Server  host  name  is  not
780              checked against certificate.
781
782       verify-full
783              Connection must go over TLS and server certificate must be valid
784              according  to  server_tls_ca_file.   Server host name must match
785              certificate information.
786
787   server_tls_ca_file
788       Root certificate file to validate PostgreSQL server certificates.
789
790       Default: not set
791
792   server_tls_key_file
793       Private key for PgBouncer to authenticate against PostgreSQL server.
794
795       Default: not set
796
797   server_tls_cert_file
798       Certificate for private key.  PostgreSQL server can validate it.
799
800       Default: not set
801
802   server_tls_protocols
803       Which TLS protocol versions  are  allowed.   Allowed  values:  tlsv1.0,
804       tlsv1.1,         tlsv1.2,        tlsv1.3.         Shortcuts:        all
805       (tlsv1.0,tlsv1.1,tlsv1.2,tlsv1.3),  secure  (tlsv1.2,tlsv1.3),   legacy
806       (all).
807
808       Default: secure
809
810   server_tls_ciphers
811       Allowed TLS ciphers, in OpenSSL syntax.  Shortcuts:
812
813       • default/secure/fast/normal  (these  all  use  system wide OpenSSL de‐
814         faults)
815
816       • all (enables all ciphers, not recommended)
817
818       Only connections using TLS version 1.2 and lower are  affected.   There
819       is  currently  no  setting that controls the cipher choices used by TLS
820       version 1.3 connections.
821
822       Default: default
823

DANGEROUS TIMEOUTS

825       Setting the following timeouts can cause unexpected errors.
826
827   query_timeout
828       Queries running longer than that are canceled.  This should be used on‐
829       ly with a slightly smaller server-side statement_timeout, to apply only
830       for network problems.  [seconds]
831
832       Default: 0.0 (disabled)
833
834   query_wait_timeout
835       Maximum time queries are allowed to spend waiting  for  execution.   If
836       the  query  is not assigned to a server during that time, the client is
837       disconnected.  0 disables.  If this is disabled, clients will be queued
838       indefinitely.  [seconds]
839
840       This  setting  is used to prevent unresponsive servers from grabbing up
841       connections.  It also helps when the server is down or rejects  connec‐
842       tions for any reason.
843
844       Default: 120.0
845
846   cancel_wait_timeout
847       Maximum time cancellation requests are allowed to spend waiting for ex‐
848       ecution.  If the cancel request is not assigned to a server during that
849       time,  the  client  is disconnected.  0 disables.  If this is disabled,
850       cancel requests will be queued indefinitely.  [seconds]
851
852       This setting is used to prevent a client locking up when a cancel  can‐
853       not be forwarded due to the server being down.
854
855       Default: 10.0
856
857   client_idle_timeout
858       Client  connections  idling  longer  than this many seconds are closed.
859       This should be larger than the  client-side  connection  lifetime  set‐
860       tings, and only used for network problems.  [seconds]
861
862       Default: 0.0 (disabled)
863
864   idle_transaction_timeout
865       If  a client has been in “idle in transaction” state longer, it will be
866       disconnected.  [seconds]
867
868       Default: 0.0 (disabled)
869
870   suspend_timeout
871       How long to wait for buffer flush during SUSPEND  or  reboot  (-R).   A
872       connection is dropped if the flush does not succeed.  [seconds]
873
874       Default: 10
875

LOW-LEVEL NETWORK SETTINGS

877   pkt_buf
878       Internal buffer size for packets.  Affects size of TCP packets sent and
879       general memory usage.  Actual libpq packets can be larger than this, so
880       no need to set it large.
881
882       Default: 4096
883
884   max_packet_size
885       Maximum size for PostgreSQL packets that PgBouncer allows through.  One
886       packet is either one query or one result set row.  The full result  set
887       can be larger.
888
889       Default: 2147483647
890
891   listen_backlog
892       Backlog  argument  for  listen(2).   Determines how many new unanswered
893       connection attempts are kept in the queue.  When  the  queue  is  full,
894       further new connections are dropped.
895
896       Default: 128
897
898   sbuf_loopcnt
899       How  many  times  to process data on one connection, before proceeding.
900       Without this limit, one connection with a big result set can stall  Pg‐
901       Bouncer  for a long time.  One loop processes one pkt_buf amount of da‐
902       ta.  0 means no limit.
903
904       Default: 5
905
906   so_reuseport
907       Specifies whether to set the socket option SO_REUSEPORT on TCP  listen‐
908       ing  sockets.   On some operating systems, this allows running multiple
909       PgBouncer instances on the same host listening on  the  same  port  and
910       having  the  kernel distribute the connections automatically.  This op‐
911       tion is a way to get PgBouncer to use more CPU  cores.   (PgBouncer  is
912       single-threaded and uses one CPU core per instance.)
913
914       The  behavior  in detail depends on the operating system kernel.  As of
915       this writing, this setting has the desired effect on (sufficiently  re‐
916       cent  versions  of)  Linux, DragonFlyBSD, and FreeBSD.  (On FreeBSD, it
917       applies the socket option SO_REUSEPORT_LB instead.) Some other  operat‐
918       ing systems support the socket option but it won’t have the desired ef‐
919       fect: It will allow multiple processes to bind to the same port but on‐
920       ly  one  of them will get the connections.  See your operating system’s
921       setsockopt() documentation for details.
922
923       On systems that don’t support the socket option at  all,  turning  this
924       setting on will result in an error.
925
926       Each  PgBouncer  instance on the same host needs different settings for
927       at least unix_socket_dir and pidfile, as well as  logfile  if  that  is
928       used.  Also note that if you make use of this option, you can no longer
929       connect to a specific PgBouncer instance via TCP/IP, which  might  have
930       implications for monitoring and metrics collection.
931
932       To  make  sure  query cancellations keep working, you should set up Pg‐
933       Bouncer peering between the different PgBouncer processes.  For details
934       look at docs for the peer_id configuration option and the peers config‐
935       uration section.   There’s  also  an  example  that  uses  peering  and
936       so_reuseport in the example section of these docs.
937
938       Default: 0
939
940   tcp_defer_accept
941       Sets  the  TCP_DEFER_ACCEPT  socket  option; see man 7 tcp for details.
942       (This is a Boolean option: 1 means enabled.  The actual  value  set  if
943       enabled is currently hardcoded to 45 seconds.)
944
945       This is currently only supported on Linux.
946
947       Default: 1 on Linux, otherwise 0
948
949   tcp_socket_buffer
950       Default: not set
951
952   tcp_keepalive
953       Turns on basic keepalive with OS defaults.
954
955       On  Linux, the system defaults are tcp_keepidle=7200, tcp_keepintvl=75,
956       tcp_keepcnt=9.  They are probably similar on other operating systems.
957
958       Default: 1
959
960   tcp_keepcnt
961       Default: not set
962
963   tcp_keepidle
964       Default: not set
965
966   tcp_keepintvl
967       Default: not set
968
969   tcp_user_timeout
970       Sets the TCP_USER_TIMEOUT socket option.  This  specifies  the  maximum
971       amount  of  time in milliseconds that transmitted data may remain unac‐
972       knowledged before the TCP connection is forcibly closed.  If set to  0,
973       then operating system’s default is used.
974
975       This is currently only supported on Linux.
976
977       Default: 0
978

SECTION [DATABASES]

980       The section [databases] defines the names of the databases that clients
981       of PgBouncer can connect to and specifies where those connections  will
982       be routed.  The section contains key=value lines like
983
984              dbname = connection string
985
986       where  the key will be taken as a database name and the value as a con‐
987       nection string, consisting of key=value pairs of connection parameters,
988       described below (similar to libpq, but the actual libpq is not used and
989       the set of available features is different).  Example:
990
991              foodb = host=host1.example.com port=5432
992              bardb = host=localhost dbname=bazdb
993
994       The database name can contain characters  _0-9A-Za-z  without  quoting.
995       Names that contain other characters need to be quoted with standard SQL
996       identifier quoting: double quotes, with "" for a single instance  of  a
997       double quote.
998
999       The  database  name  “pgbouncer”  is reserved for the admin console and
1000       cannot be used as a key here.
1001
1002       "*" acts as a fallback database: If the exact name does not exist,  its
1003       value  is  taken  as connection string for the requested database.  For
1004       example, if there is an entry (and no other overriding entries)
1005
1006              * = host=foo
1007
1008       then a connection to PgBouncer specifying a database “bar” will  effec‐
1009       tively behave as if an entry
1010
1011              bar = host=foo dbname=bar
1012
1013       exists  (taking  advantage  of the default for dbname being the client-
1014       side database name; see below).
1015
1016       Such automatically created database entries are cleaned up if they stay
1017       idle  longer than the time specified by the autodb_idle_timeout parame‐
1018       ter.
1019
1020   dbname
1021       Destination database name.
1022
1023       Default: same as client-side database name
1024
1025   host
1026       Host name or IP address to connect to.  Host names are resolved at con‐
1027       nection  time,  the result is cached per dns_max_ttl parameter.  When a
1028       host name’s resolution changes, existing server connections  are  auto‐
1029       matically  closed  when  they  are  released  (according to the pooling
1030       mode), and new server connections immediately use the  new  resolution.
1031       If DNS returns several results, they are used in a round-robin manner.
1032
1033       If the value begins with /, then a Unix socket in the file-system name‐
1034       space is used.  If the value begins with @, then a Unix socket  in  the
1035       abstract namespace is used.
1036
1037       A comma-separated list of host names or addresses can be specified.  In
1038       that case, connections are made in a round-robin manner.   (If  a  host
1039       list  contains  host names that in turn resolve via DNS to multiple ad‐
1040       dresses, the round-robin systems operate independently.  This is an im‐
1041       plementation  dependency  that  is  subject  to change.) Note that in a
1042       list, all hosts must be available at all times: There are no mechanisms
1043       to skip unreachable hosts or to select only available hosts from a list
1044       or similar.  (This is different from what a host list in libpq  means.)
1045       Also  note  that  this only affects how the destinations of new connec‐
1046       tions are chosen.  See also  the  setting  server_round_robin  for  how
1047       clients are assigned to already established server connections.
1048
1049       Examples:
1050
1051              host=localhost
1052              host=127.0.0.1
1053              host=2001:0db8:85a3:0000:0000:8a2e:0370:7334
1054              host=/var/run/postgresql
1055              host=192.168.0.1,192.168.0.2,192.168.0.3
1056
1057       Default: not set, meaning to use a Unix socket
1058
1059   port
1060       Default: 5432
1061
1062   user
1063       If  user=  is  set, all connections to the destination database will be
1064       done with the specified user, meaning that there will be only one  pool
1065       for this database.
1066
1067       Otherwise, PgBouncer logs into the destination database with the client
1068       user name, meaning that there will be one pool per user.
1069
1070   password
1071       If no password is specified here, the password from  the  auth_file  or
1072       auth_query will be used.
1073
1074   auth_user
1075       Override of the global auth_user setting, if specified.
1076
1077   pool_size
1078       Set  the  maximum size of pools for this database.  If not set, the de‐
1079       fault_pool_size is used.
1080
1081   min_pool_size
1082       Set the minimum pool size for this database.  If not  set,  the  global
1083       min_pool_size is used.
1084
1085       Only enforced if at least one of the following is true:
1086
1087       • this entry in the [database] section has a value set for the user key
1088         (aka forced user)
1089
1090       • there is at least one client connected to the pool
1091
1092   reserve_pool
1093       Set  additional  connections  for  this  database.   If  not  set,  re‐
1094       serve_pool_size is used.
1095
1096   connect_query
1097       Query  to be executed after a connection is established, but before al‐
1098       lowing the connection to be used by any clients.  If the  query  raises
1099       errors, they are logged but ignored otherwise.
1100
1101   pool_mode
1102       Set  the  pool mode specific to this database.  If not set, the default
1103       pool_mode is used.
1104
1105   max_db_connections
1106       Configure a database-wide maximum (i.e. all pools within  the  database
1107       will not have more than this many server connections).
1108
1109   client_encoding
1110       Ask specific client_encoding from server.
1111
1112   datestyle
1113       Ask specific datestyle from server.
1114
1115   timezone
1116       Ask specific timezone from server.
1117

SECTION [USERS]

1119       This section contains key=value lines like
1120
1121              user1 = settings
1122
1123       where  the  key will be taken as a user name and the value as a list of
1124       key=value pairs of configuration settings specific for this user.   Ex‐
1125       ample:
1126
1127              user1 = pool_mode=session
1128
1129       Only a few settings are available here.
1130
1131   pool_mode
1132       Set  the  pool  mode to be used for all connections from this user.  If
1133       not set, the database or default pool_mode is used.
1134
1135   max_user_connections
1136       Configure a maximum for the user (i.e. all pools with the user will not
1137       have more than this many server connections).
1138

SECTION [PEERS]

1140       The  section  [peers] defines the peers that PgBouncer can forward can‐
1141       cellation requests to and where those  cancellation  requests  will  be
1142       routed.
1143
1144       PgBouncer  processes  can  be  peered together in a group by defining a
1145       peer_id value and a [peers] section in the configs of all the PgBouncer
1146       processes.   These  PgBouncer  processes can then forward cancellations
1147       requests to the process that it originated from.   This  is  needed  to
1148       make  cancellations work when multiple PgBouncer processes (possibly on
1149       different servers) are behind the same TCP load balancer.  Cancellation
1150       requests  are  sent  over different TCP connections than the query they
1151       are cancelling, so a TCP load balancer might send the cancellation  re‐
1152       quest  connection to a different process than the one that it was meant
1153       for.  By peering them these cancellation requests eventually end up  at
1154       the  right  process.   A  more in-depth explanation is provided in this
1155       recording of a conference talk (https://www.youtube.com/watch?v=M585Ff
1156       bboNA).
1157
1158       The section contains key=value lines like
1159
1160              peer_id = connection string
1161
1162       Where  the key will be taken as a peer_id and the value as a connection
1163       string, consisting of key=value pairs  of  connection  parameters,  de‐
1164       scribed  below  (similar to libpq, but the actual libpq is not used and
1165       the set of available features is different).  Example:
1166
1167              1 = host=host1.example.com
1168              2 = host=/tmp/pgbouncer-2  port=5555
1169
1170       Note 1: For peering to work, the peer_id of each PgBouncer  process  in
1171       the group must be unique within the peered group.  And the [peers] sec‐
1172       tion should contain entries for each of those peer ids.  An example can
1173       be found in the examples section of these docs.  It is allowed, but not
1174       necessary, for the [peers] section to contain the peer_id  of  the  Pg‐
1175       Bouncer  that the config is for.  Such an entry will be ignored, but it
1176       is allowed to config management easy.  Because it allows using the  ex‐
1177       act same [peers] section for multiple configs.
1178
1179       Note  2: Cross-version peering is supported as long as all peers are on
1180       the same side of the v1.21.0 version boundary.  In v1.21.0 some  break‐
1181       ing  changes  were  made  in how we encode the cancellation tokens that
1182       made them incompatible with the ones created by earlier versions.
1183
1184   host
1185       Host name or IP address to connect to.  Host names are resolved at con‐
1186       nection  time,  the result is cached per dns_max_ttl parameter.  If DNS
1187       returns several results, they are used in a round-robin manner.  But in
1188       general  it’s not recommended to use a hostname that resolves to multi‐
1189       ple IPs, because then the cancel request might still  be  forwarded  to
1190       the  wrong  node and it would need to be forwarded again (which is only
1191       allowed up to three times).
1192
1193       If the value begins with /, then a Unix socket in the file-system name‐
1194       space  is  used.  If the value begins with @, then a Unix socket in the
1195       abstract namespace is used.
1196
1197       Examples:
1198
1199              host=localhost
1200              host=127.0.0.1
1201              host=2001:0db8:85a3:0000:0000:8a2e:0370:7334
1202              host=/var/run/pgbouncer-1
1203
1204   port
1205       Default: 6432
1206
1207   pool_size
1208       Set the maximum number of cancel requests that can be in flight to  the
1209       peer at the same time.  It’s quite normal for cancel requests to arrive
1210       in bursts, e.g.  when the backing Postgres server  slow  or  down.   So
1211       it’s  important  for  pool_size  to not be so low that it cannot handle
1212       these bursts.
1213
1214       If not set, the default_pool_size is used.
1215

INCLUDE DIRECTIVE

1217       The PgBouncer configuration file can contain include directives,  which
1218       specify  another  configuration  file to read and process.  This allows
1219       splitting the configuration file into physically separate  parts.   The
1220       include directives look like this:
1221
1222              %include filename
1223
1224       If  the  file  name is not an absolute path, it is taken as relative to
1225       the current working directory.
1226

AUTHENTICATION FILE FORMAT

1228       This section  describes  the  format  of  the  file  specified  by  the
1229       auth_file setting.  It is a text file in the following format:
1230
1231              "username1" "password" ...
1232              "username2" "md5abcdef012342345" ...
1233              "username2" "SCRAM-SHA-256$<iterations>:<salt>$<storedkey>:<serverkey>"
1234
1235       There  should  be  at least 2 fields, surrounded by double quotes.  The
1236       first field is the user name and the second is either a  plain-text,  a
1237       MD5-hashed  password, or a SCRAM secret.  PgBouncer ignores the rest of
1238       the line.  Double quotes in a field value can be escaped by writing two
1239       double quotes.
1240
1241       PostgreSQL MD5-hashed password format:
1242
1243              "md5" + md5(password + username)
1244
1245       So  user  admin  with  password  1234  will  have  MD5-hashed  password
1246       md545f2603610af569b6155c45067268c6b.
1247
1248       PostgreSQL SCRAM secret format:
1249
1250              SCRAM-SHA-256$<iterations>:<salt>$<storedkey>:<serverkey>
1251
1252       See the PostgreSQL documentation and RFC 5803 for details on this.
1253
1254       The passwords or secrets stored in the authentication  file  serve  two
1255       purposes.   First,  they  are  used to verify the passwords of incoming
1256       client connections, if a password-based authentication method  is  con‐
1257       figured.   Second,  they are used as the passwords for outgoing connec‐
1258       tions to the backend server, if the backend server  requires  password-
1259       based  authentication (unless the password is specified directly in the
1260       database’s connection string).  The latter works  if  the  password  is
1261       stored in plain text or MD5-hashed.  SCRAM secrets can only be used for
1262       logging into a server if the client authentication also uses SCRAM, the
1263       PgBouncer  database  definition  does  not specify a user name, and the
1264       SCRAM secrets are identical in  PgBouncer  and  the  PostgreSQL  server
1265       (same  salt and iterations, not merely the same password).  This is due
1266       to an inherent security property of SCRAM: The stored SCRAM secret can‐
1267       not by itself be used for deriving login credentials.
1268
1269       The authentication file can be written by hand, but it’s also useful to
1270       generate  it  from  some  other  list  of  users  and  passwords.   See
1271       ./etc/mkauth.py for a sample script to generate the authentication file
1272       from the pg_shadow system table.  Alternatively, use auth_query instead
1273       of  auth_file  to  avoid  having  to maintain a separate authentication
1274       file.
1275

HBA FILE FORMAT

1277       The location of the HBA file is specified by the setting auth_hba_file.
1278       It is only used if auth_type is set to hba.
1279
1280       The  file  follows  the  format of the PostgreSQL pg_hba.conf file (see
1281       <https://www.postgresql.org/docs/current/auth-pg-hba-conf.html>).
1282
1283       • Supported record types: local, host, hostssl, hostnossl.
1284
1285       • Database field: Supports all, sameuser, @file, multiple  names.   Not
1286         supported: replication, samerole, samegroup.
1287
1288       • User name field: Supports all, @file, multiple names.  Not supported:
1289         +groupname.
1290
1291       • Address field: Supports IPv4, IPv6.  Not supported: DNS names, domain
1292         prefixes.
1293
1294       • Auth-method  field:  Only  methods supported by PgBouncer’s auth_type
1295         are supported, plus peer and reject, but except any  and  pam,  which
1296         only work globally.  User name map (map=) parameter is not supported.
1297

EXAMPLES

1299       Small example configuration:
1300
1301              [databases]
1302              template1 = host=localhost dbname=template1 auth_user=someuser
1303
1304              [pgbouncer]
1305              pool_mode = session
1306              listen_port = 6432
1307              listen_addr = localhost
1308              auth_type = md5
1309              auth_file = users.txt
1310              logfile = pgbouncer.log
1311              pidfile = pgbouncer.pid
1312              admin_users = someuser
1313              stats_users = stat_collector
1314
1315       Database examples:
1316
1317              [databases]
1318
1319              ; foodb over Unix socket
1320              foodb =
1321
1322              ; redirect bardb to bazdb on localhost
1323              bardb = host=localhost dbname=bazdb
1324
1325              ; access to destination database will go with single user
1326              forcedb = host=localhost port=300 user=baz password=foo client_encoding=UNICODE datestyle=ISO
1327
1328       Example of a secure function for auth_query:
1329
1330              CREATE OR REPLACE FUNCTION pgbouncer.user_lookup(in i_username text, out uname text, out phash text)
1331              RETURNS record AS $$
1332              BEGIN
1333                  SELECT usename, passwd FROM pg_catalog.pg_shadow
1334                  WHERE usename = i_username INTO uname, phash;
1335                  RETURN;
1336              END;
1337              $$ LANGUAGE plpgsql SECURITY DEFINER;
1338              REVOKE ALL ON FUNCTION pgbouncer.user_lookup(text) FROM public, pgbouncer;
1339              GRANT EXECUTE ON FUNCTION pgbouncer.user_lookup(text) TO pgbouncer;
1340
1341       Example configs for 2 peered PgBouncer processes to create a multi-core
1342       PgBouncer setup using so_reuseport.  The config for the first process:
1343
1344              [databases]
1345              postgres = host=localhost dbname=postgres
1346
1347              [peers]
1348              1 = host=/tmp/pgbouncer1
1349              2 = host=/tmp/pgbouncer2
1350
1351              [pgbouncer]
1352              listen_addr=127.0.0.1
1353              auth_file=auth_file.conf
1354              so_reuseport=1
1355              unix_socket_dir=/tmp/pgbouncer1
1356              peer_id=1
1357
1358       The config for the second process:
1359
1360              [databases]
1361              postgres = host=localhost dbname=postgres
1362
1363              [peers]
1364              1 = host=/tmp/pgbouncer1
1365              2 = host=/tmp/pgbouncer2
1366
1367              [pgbouncer]
1368              listen_addr=127.0.0.1
1369              auth_file=auth_file.conf
1370              so_reuseport=1
1371              ; only unix_socket_dir and peer_id are different
1372              unix_socket_dir=/tmp/pgbouncer2
1373              peer_id=2
1374

SEE ALSO

1376       pgbouncer(1) - man page for general usage, console commands
1377
1378       <https://www.pgbouncer.org/>
1379
1380
1381
13821.21.0                                                        PGBOUNCER.INI(5)
Impressum