[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 220.127.116.11 logfile 18.104.22.168 pidfile 22.214.171.124 listen_addr 126.96.36.199 listen_port 188.8.131.52 unix_socket_dir 184.108.40.206 auth_file 220.127.116.11 auth_type 18.104.22.168 pool_mode 22.214.171.124 max_client_conn 126.96.36.199 default_pool_size 188.8.131.52 server_round_robin 1.4.2 Log Settings 184.108.40.206 syslog 220.127.116.11 syslog_facility 18.104.22.168 log_conn Ections 22.214.171.124 log_disconnections 126.96.36.199 log_pooler_errors 1.4.3 Console access control 188.8.131.52 admin_users 184.108.40.206 stats_users 1.4.4 Company Connect health Check, timeout 220.127.116.11 server_reset_query 18.104.22.168 server_check_delay 22.214.171.124 server_check_query 126.96.36.199 server_lifetime 188.8.131.52 server_idle_timeout 184.108.40.206 server_connect_timeout 220.127.116.11 server_login_retry 18.104.22.168 client_login_timeout 1.4.5 Dangerous timeout 22.214.171.124 query_timeout 126.96.36.199 client_idle_timeout 1.4.6 The underlying network settings 188.8.131.52 pkt_buf 184.108.40.206 tcp_defer_accept 220.127.116.11 Tcp_socket_buffer 18.104.22.168 tcp_keepalive 22.214.171.124 tcp_keepcnt 126.96.36.199 tcp_keepidle 188.8.131.52 TCP_KEEPINTVL 1.5 [Databases] section 1.5.1 Position parameter 184.108.40.206 dbname 220.127.116.11 Host 18.104.22.168 Port 22.214.171.124 User, password 1.5.2 connection pool size per database 126.96.36.199 pool_size 1.5.3 additional parameters 188.8.131.52 client_encoding 184.108.40.206 E 220.127.116.11 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