[Edit] Pgbouncer (5)
| Directory [Hide] 1 pgbouncer (5) 1.1 name 1.2 Summary 1.3 Description 1.4 [Pgbouncer] segment 1.4.1 Common settings 184.108.40.206 logfile 220.127.116.11 pidfile 18.104.22.168 listen_addr 22.214.171.124 listen_port 126.96.36.199 unix_socket_dir 188.8.131.52 auth_file 184.108.40.206 auth_type 220.127.116.11 pool_mode 18.104.22.168 max_client_conn 22.214.171.124 default_pool_size 126.96.36.199 server_round_robin 1.4.2 Log Settings 188.8.131.52 syslog 184.108.40.206 syslog_facility 220.127.116.11 log_conn Ections 18.104.22.168 log_disconnections 22.214.171.124 log_pooler_errors 1.4.3 Console access control 126.96.36.199 admin_users 188.8.131.52 stats_users 1.4.4 Company Connect health Check, timeout 184.108.40.206 server_reset_query 220.127.116.11 server_check_delay 18.104.22.168 server_check_query 22.214.171.124 server_lifetime 126.96.36.199 server_idle_timeout 188.8.131.52 server_connect_timeout 184.108.40.206 server_login_retry 220.127.116.11 client_login_timeout 1.4.5 Dangerous timeout 18.104.22.168 query_timeout 22.214.171.124 client_idle_timeout 1.4.6 The underlying network settings 126.96.36.199 pkt_buf 188.8.131.52 tcp_defer_accept 184.108.40.206 Tcp_socket_buffer 220.127.116.11 tcp_keepalive 18.104.22.168 tcp_keepcnt 22.214.171.124 tcp_keepidle 126.96.36.199 TCP_KEEPINTVL 1.5 [Databases] section 1.5.1 Position parameter 188.8.131.52 dbname 184.108.40.206 Host 220.127.116.11 Port 18.104.22.168 User, password 1.5.2 connection pool size per database 22.214.171.124 pool_size 1.5.3 additional parameters 126.96.36.199 client_encoding 188.8.131.52 E 184.108.40.206 TimeZone 1.6 example 1.7 see Also
Pgbouncer-postgresql a lightweight connection pool.  Summary
[databases] db = ...
[Pgbouncer] ... [Edit] Description
The configuration file is in "INI" format. The name of the segment is between "and". To Or the line that begins with ' "is treated as a comment and is ignored. ";" appearing at a point other than the beginning of the line. and ' "will not be recognized. [Edit] [pgbouncer] section  Common settings  logfile
Declares a log file. The log file is kept open until Kill-hup or RELOAD on the console; After the completion.
Default: Not set.  pidfile
Declare the PID file. It is not allowed to be a daemon without pidfile.
Default: No settings.  listen_addr
Declares a IPV4 address for listening on a TCP connection. or * means "listen to all the addresses." If not set, only UNIX socket connections are allowed.
Default: No settings  listen_port
which port to monitor. Applies to TCP and UNIX sockets.
Default: 6000  unix_socket_dir
Declares the location of the Unix socket. Applies to listening for sockets and server connections. If set to an empty string, the Unix socket is closed.
Default:/tmp  auth_file
The user name and password are loaded from this file. The file format used is the same as the PostgreSQL pg_auth/pg_pwd file, so you can point directly to the backend file.
Default: Not set.  auth_type
How to authenticate users.
MD5 use MD5 as the basis for password checking. Auth_file can contain MD5 encrypted or plaintext passwords. The default value.
Crypt uses crypt (3) as the basis for password checking. Auth_file must contain a plaintext password.
Plain is sending a plaintext password on the line.
Trust does not do certification. The user name must still exist in the auth_file.
Any like trust, but given the user name is ignored. All databases are required to be configured to log on with a specific user.  pool_mode
Declares when a server connection is marked for reuse by another client.
Session after the client disconnects, the server releases back to the connection pool. Default.
The Transaction Server releases back to the connection pool after the transaction completes.
Statement after the query has finished, the server releases the connection pool back. Long transactions spanning multiple statements are not allowed in this mode.  max_client_conn
The maximum number of client connections allowed. If you increase this value, it is best to increase the file descriptor limit as well. Please note that the actual number of file descriptors is always more than max_client_conn. The maximum number of descriptors to be used theoretically is:
Max_client_conn + (max_pool_size * total_databases * total_users)
This assumes that each user is connecting to the server with its user name. If the database user declares in the connection string (all users are connected to the same user), then the maximum value of the theory is:
Max_client_conn + (Max_pool_size * total_databases)
The maximum theoretical value should never be achieved unless someone intentionally designed a special load for him. Still, it means you should give FD some space.
Look at the Ulimit in your favorite hand album.
Default:  default_pool_size
The number of allowed server connections per user/database. Can be overridden in database-related configurations.
Default:  Server_round_robin
By default, pgbouncer the server-side connection in a LIFO manner, so that most of the load is borne by a small number of connections. This is the best performance when you have only one server to do database service. But if there is a TCP rotation mechanism behind the database IP, then it's best to use the pbcouncer, so that you can get a consistent load.
Default: 0 [Edit] Log Settings  syslog
Toggle Syslog on/Off
Default: 0  syslog_facility
Under what facilities is the log sent to the syslog. May be: autho,authopriv,daemon,user,local0-7
Default: Daemon  log_connections
Log logs that have been successfully logged.
Default: 1  log_disconnections
Record the reason for the disconnect.
Default: 1  log_pooler_errors
Logs the error log that connection Chi Fa sent to the client.
Default: 1 [Edit] Console access control  admin_users
Lists all users who are allowed to run commands on the console.
Default: Empty  stats_users
Lists the users who are allowed to run read-only queries on the console. This means all the show commands except show FDS.
default: Empty.  Connect health Check, timeout  server_reset_query
When the connection is released, the server can be used by other clients before the server is sent to the query. At that point, there is no transaction in process, so it should not include ABORT or ROLLBACK.
8.2 and earlier versions of the better way are:
Server_reset_query = Reset All; SET session AUTHORIZATION DEFAULT;
For a 8.3 or higher version, we can do this:
Server_reset_query = Discard all;  Server_check_delay
How long to keep a freed connection in the immediate available state without performing a health query. If 0, the query is always running.
Default:  Server_check_query
Simply do nothing for the query to check whether the server connection is alive.
If it is an empty string, then the health check is turned off.
Default: SELECT 1;  Server_lifetime
Connection pooling attempts to turn off server connections that have been connected longer than this value.
Default: 3600  Server_idle_timeout
If the server connection is idle longer than this, there is too much connectivity in the connection pool, so this can be turned off.
Default:  Server_connect_timeout
If the connection and login will not be completed during this time, the connection will be closed.
Default:  Server_login_retry
If the login failed to authenticate from connect (), the connection pool waits for the time and then tries to reconnect.
Default:  Client_login_timeout
If the client logs on, but cannot complete the login during this time, it will be disconnected. The main purpose is to avoid dead connections that are still SUSPEND and thus lead to online reboots.
Default: [Edit] Dangerous timeout
Set the following timeout for unknown reasons.  Query_timeout
Queries that run longer than this section are canceled. This should be used in conjunction with smaller server-side statement_timeout to help deal with network problems only.
Default: 0 (OFF)  Client_idle_timeout
Client connections are managed when they are idle for more than this period of time. This should be longer than the lifetime of the client connection, so that only network problems can be handled.
default: 0 (OFF)  The underlying network settings  pkt_buf
The internal buffer size used for the network package. Affects the TCP packet emitted and the general memory usage. The actual LIBPQ package can be larger than this, so there is no need to set it too large.
Default: 2048  tcp_defer_accept
The details of the following options should be obtained from Man 7 TCP
Default: In Linux is 45, otherwise it is 0