From 0d47637294a577670b93abca7e17d6c1ab480de0 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Fri, 9 Aug 2019 13:29:50 +0200 Subject: [PATCH] Clean up example and test configuration files Consistently comment out settings that are the default, update various documentation comments, make commenting consistent. In configuration files for tests, remove most comments, so we don't have to keep syncing them with the main example file. --- etc/pgbouncer.ini | 181 ++++++++++++++++++++++------------------------ etc/small.ini | 2 - etc/test.ini | 1 - test/ssl/test.ini | 67 ----------------- test/test.ini | 102 -------------------------- 5 files changed, 86 insertions(+), 267 deletions(-) diff --git a/etc/pgbouncer.ini b/etc/pgbouncer.ini index 6bce391..fed4a9f 100644 --- a/etc/pgbouncer.ini +++ b/etc/pgbouncer.ini @@ -1,35 +1,39 @@ +;;; +;;; PgBouncer configuration file +;;; + ;; database name = connect string ;; ;; connect string params: -;; dbname= host= port= user= password= +;; dbname= host= port= user= password= auth_user= ;; client_encoding= datestyle= timezone= -;; pool_size= connect_query= -;; auth_user= +;; pool_size= reserve_pool= max_db_connections= +;; pool_mode= connect_query= application_name= [databases] -; foodb over Unix socket +;; foodb over Unix socket ;foodb = -; redirect bardb to bazdb on localhost +;; redirect bardb to bazdb on localhost ;bardb = host=localhost dbname=bazdb -; access to dest database will go with single user +;; access to dest database will go with single user ;forcedb = host=127.0.0.1 port=300 user=baz password=foo client_encoding=UNICODE datestyle=ISO connect_query='SELECT 1' -; use custom pool sizes +;; use custom pool sizes ;nondefaultdb = pool_size=50 reserve_pool=10 -; use auth_user with auth_query if user not present in auth_file -; auth_user must exist in auth_file +;; use auth_user with auth_query if user not present in auth_file +;; auth_user must exist in auth_file ; foodb = auth_user=bar -; fallback connect string +;; fallback connect string ;* = host=testserver ;; User-specific configuration [users] -user1 = pool_mode=transaction max_user_connections=10 +;user1 = pool_mode=transaction max_user_connections=10 ;; Configuration section [pgbouncer] @@ -45,12 +49,12 @@ pidfile = /var/run/pgbouncer/pgbouncer.pid ;;; Where to wait for clients ;;; -; IP address or * which means all IPs +;; IP address or * which means all IPs listen_addr = 127.0.0.1 listen_port = 6432 -; Unix socket is also used for -R. -; On Debian it should be /var/run/postgresql +;; Unix socket is also used for -R. +;; On Debian it should be /var/run/postgresql ;unix_socket_dir = /tmp ;unix_socket_mode = 0777 ;unix_socket_group = @@ -107,7 +111,7 @@ listen_port = 6432 ;;; Authentication settings ;;; -; any, trust, plain, crypt, md5, cert, hba, pam +;; any, trust, plain, md5, cert, hba, pam auth_type = trust auth_file = /etc/pgbouncer/userlist.txt @@ -122,61 +126,44 @@ auth_file = /etc/pgbouncer/userlist.txt ;;; Users allowed into database 'pgbouncer' ;;; -; comma-separated list of users, who are allowed to change settings +;; comma-separated list of users who are allowed to change settings ;admin_users = user2, someadmin, otheradmin -; comma-separated list of users who are just allowed to use SHOW command +;; comma-separated list of users who are just allowed to use SHOW command ;stats_users = stats, root ;;; ;;; Pooler personality questions ;;; -; When server connection is released back to pool: -; session - after client disconnects -; transaction - after transaction finishes -; statement - after statement finishes -pool_mode = session - -; -; Query for cleaning connection immediately after releasing from client. -; No need to put ROLLBACK here, pgbouncer does not reuse connections -; where transaction is left open. -; -; Query for 8.3+: -; DISCARD ALL; -; -; Older versions: -; RESET ALL; SET SESSION AUTHORIZATION DEFAULT -; -; Empty if transaction pooling is in use. -; -server_reset_query = DISCARD ALL - - -; Whether server_reset_query should run in all pooling modes. -; If it is off, server_reset_query is used only for session-pooling. +;; When server connection is released back to pool: +;; session - after client disconnects (default) +;; transaction - after transaction finishes +;; statement - after statement finishes +;pool_mode = session + +;; Query for cleaning connection immediately after releasing from +;; client. No need to put ROLLBACK here, pgbouncer does not reuse +;; connections where transaction is left open. +;server_reset_query = DISCARD ALL + +;; Whether server_reset_query should run in all pooling modes. If it +;; is off, server_reset_query is used only for session-pooling. ;server_reset_query_always = 0 -; -; Comma-separated list of parameters to ignore when given -; in startup packet. Newer JDBC versions require the -; extra_float_digits here. -; +;; Comma-separated list of parameters to ignore when given in startup +;; packet. Newer JDBC versions require the extra_float_digits here. ;ignore_startup_parameters = extra_float_digits -; -; When taking idle server into use, this query is ran first. -; SELECT 1 -; +;; When taking idle server into use, this query is run first. ;server_check_query = select 1 -; If server was used more recently that this many seconds ago, +;; If server was used more recently that this many seconds ago, ; skip the check query. Value 0 may or may not run in immediately. ;server_check_delay = 30 -; Close servers in session pooling mode after a RECONNECT, RELOAD, -; etc. when they are idle instead of at the end of the session. +;; Close servers in session pooling mode after a RECONNECT, RELOAD, +;; etc. when they are idle instead of at the end of the session. ;server_fast_close = 0 ;; Use as application_name on server. @@ -189,13 +176,13 @@ server_reset_query = DISCARD ALL ;;; Connection limits ;;; -; total number of clients that can connect -max_client_conn = 100 +;; Total number of clients that can connect +;max_client_conn = 100 -; default pool size. 20 is good number when transaction pooling -; is in use, in session pooling it needs to be the number of -; max clients you want to handle at any moment -default_pool_size = 20 +;; Default pool size. 20 is good number when transaction pooling +;; is in use, in session pooling it needs to be the number of +;; max clients you want to handle at any moment +;default_pool_size = 20 ;; Minimum number of server connections to keep in pool. ;min_pool_size = 0 @@ -203,14 +190,16 @@ default_pool_size = 20 ; how many additional connection to allow in case of trouble ;reserve_pool_size = 0 -; if a clients needs to wait more than this many seconds, use reserve pool +;; If a clients needs to wait more than this many seconds, use reserve +;; pool. ;reserve_pool_timeout = 5 -; how many total connections to a single database to allow from all pools +;; How many total connections to a single database to allow from all +;; pools ;max_db_connections = 0 ;max_user_connections = 0 -; If off, then server connections are reused in LIFO manner +;; If off, then server connections are reused in LIFO manner ;server_round_robin = 0 ;;; @@ -222,13 +211,13 @@ default_pool_size = 20 ;syslog_facility = daemon ;syslog_ident = pgbouncer -; log if client connects or server connection is made +;; log if client connects or server connection is made ;log_connections = 1 -; log if and why connection was closed +;; log if and why connection was closed ;log_disconnections = 1 -; log error messages pooler sends to clients +;; log error messages pooler sends to clients ;log_pooler_errors = 1 ;; write aggregated stats into log @@ -244,8 +233,8 @@ default_pool_size = 20 ;; Close server connection if its been connected longer. ;server_lifetime = 3600 -;; Close server connection if its not been used in this time. -;; Allows to clean unnecessary connections from pool after peak. +;; Close server connection if its not been used in this time. Allows +;; to clean unnecessary connections from pool after peak. ;server_idle_timeout = 600 ;; Cancel connection attempt if server does not answer takes longer. @@ -255,33 +244,35 @@ default_pool_size = 20 ;; then wait this many second. ;server_login_retry = 15 -;; Dangerous. Server connection is closed if query does not return -;; in this time. Should be used to survive network problems, -;; _not_ as statement_timeout. (default: 0) +;; Dangerous. Server connection is closed if query does not return in +;; this time. Should be used to survive network problems, _not_ as +;; statement_timeout. (default: 0) ;query_timeout = 0 -;; Dangerous. Client connection is closed if the query is not assigned -;; to a server in this time. Should be used to limit the number of queued -;; queries in case of a database or network failure. (default: 120) +;; Dangerous. Client connection is closed if the query is not +;; assigned to a server in this time. Should be used to limit the +;; number of queued queries in case of a database or network +;; failure. (default: 120) ;query_wait_timeout = 120 -;; Dangerous. Client connection is closed if no activity in this time. -;; Should be used to survive network problems. (default: 0) +;; Dangerous. Client connection is closed if no activity in this +;; time. Should be used to survive network problems. (default: 0) ;client_idle_timeout = 0 ;; Disconnect clients who have not managed to log in after connecting ;; in this many seconds. ;client_login_timeout = 60 -;; Clean automatically created database entries (via "*") if they -;; stay unused in this many seconds. +;; Clean automatically created database entries (via "*") if they stay +;; unused in this many seconds. ; autodb_idle_timeout = 3600 -;; How long SUSPEND/-R waits for buffer flush before closing connection. +;; How long SUSPEND/-R waits for buffer flush before closing +;; connection. ;suspend_timeout = 10 -;; Close connections which are in "IDLE in transaction" state longer than -;; this many seconds. +;; Close connections which are in "IDLE in transaction" state longer +;; than this many seconds. ;idle_transaction_timeout = 0 ;;; @@ -302,9 +293,9 @@ default_pool_size = 20 ;; networking options, for info: man 7 tcp -;; Linux: notify program about new connection only if there -;; is also data received. (Seconds to wait.) -;; On Linux the default is 45, on other OS'es 0. +;; Linux: Notify program about new connection only if there is also +;; data received. (Seconds to wait.) On Linux the default is 45, on +;; other OS'es 0. ;tcp_defer_accept = 0 ;; In-kernel buffer size (Linux default: 4096) @@ -313,17 +304,17 @@ default_pool_size = 20 ;; whether tcp keepalive should be turned on (0/1) ;tcp_keepalive = 1 -;; The following options are Linux-specific. -;; They also require tcp_keepalive=1. +;; The following options are Linux-specific. They also require +;; tcp_keepalive=1. -;; count of keepalive packets +;; Count of keepalive packets ;tcp_keepcnt = 0 -;; how long the connection can be idle, -;; before sending keepalive packets +;; How long the connection can be idle before sending keepalive +;; packets ;tcp_keepidle = 0 -;; The time between individual keepalive probes. +;; The time between individual keepalive probes ;tcp_keepintvl = 0 ;; DNS lookup caching time @@ -339,18 +330,18 @@ default_pool_size = 20 ;;; Random stuff ;;; -;; Hackish security feature. Helps against SQL-injection - when PQexec is disabled, -;; multi-statement cannot be made. +;; Hackish security feature. Helps against SQL injection: when PQexec +;; is disabled, multi-statement cannot be made. ;disable_pqexec = 0 -;; Config file to use for next RELOAD/SIGHUP. +;; Config file to use for next RELOAD/SIGHUP ;; By default contains config file from command line. ;conffile -;; Win32 service name to register as. job_name is alias for service_name, -;; used by some Skytools scripts. +;; Windows service name to register as. job_name is alias for +;; service_name, used by some Skytools scripts. ;service_name = pgbouncer ;job_name = pgbouncer -;; Read additional config from the /etc/pgbouncer/pgbouncer-other.ini file +;; Read additional config from other file ;%include /etc/pgbouncer/pgbouncer-other.ini diff --git a/etc/small.ini b/etc/small.ini index 1cae773..9aac724 100644 --- a/etc/small.ini +++ b/etc/small.ini @@ -1,4 +1,3 @@ - [databases] evtest = host=127.0.0.1 provider = host=127.0.0.1 @@ -17,7 +16,6 @@ listen_addr = 127.0.0.1 listen_port = 6432 unix_socket_dir = /tmp -; any, trust, plain, crypt, md5 auth_type = trust auth_file = etc/userlist.txt diff --git a/etc/test.ini b/etc/test.ini index f703a97..6681c96 100644 --- a/etc/test.ini +++ b/etc/test.ini @@ -9,7 +9,6 @@ listen_addr = 127.0.0.1 listen_port = 6432 unix_socket_dir = /tmp -; any, trust, plain, crypt, md5 auth_type = md5 auth_file = etc/test.users diff --git a/test/ssl/test.ini b/test/ssl/test.ini index feb4434..25ae319 100644 --- a/test/ssl/test.ini +++ b/test/ssl/test.ini @@ -1,90 +1,23 @@ -;; database name = connect string [databases] - p0 = port=6666 host=localhost dbname=p0 user=bouncer pool_size=2 p1 = port=6666 host=localhost dbname=p1 user=bouncer -;; Configuation section [pgbouncer] - -;;; -;;; Administrative settings -;;; - logfile = test.log pidfile = test.pid -;;; -;;; Where to wait for clients -;;; - -; ip address or * which means all ip-s listen_addr = 127.0.0.1 listen_port = 6667 unix_socket_dir = /tmp -;;; -;;; Authentication settings -;;; - -; any, trust, plain, crypt, md5 ;auth_type = trust auth_file = tmp/userlist.txt -;;; -;;; Pooler personality questions -;;; - -; When server connection is released back to pool: -; session - after client disconnects -; transaction - after transaction finishes -; statement - after statement finishes pool_mode = statement -; When taking idle server into use, this query is ran first. -; -; Query for session pooling: -; ABORT; RESET ALL; SET SESSION AUTHORIZATION DEFAULT -; Query for statement/transaction pooling: -; SELECT 1 -; Empty query disables the functionality -server_check_query = select 1 - -; If server was used more recently that this many seconds ago, -; skip the check query. If 0, the check query is always ran. server_check_delay = 10 - -;;; -;;; Connection limits -;;; - -; total number of clients that can connect max_client_conn = 10 default_pool_size = 5 -;;; -;;; Timeouts -;;; - -; Close server connection if its been connected longer. server_lifetime = 120 - -; Close server connection if its not been used in this time. -; Allows to clean unneccessary connections from pool after peak. server_idle_timeout = 60 - -; Cancel connection attepmt if server does not answer takes longer. -server_connect_timeout = 15 - -; If server login failed (server_connect_timeout or auth failure) -; then wait this many second. -server_login_retry = 15 - -; Dangerous. Server connection is closed if query does not return -; in this time. Should be used to survive network problems, -; _not_ as statement_timeout. (default: 0) -query_timeout = 0 - -; Dangerous. Client connection is closed if no activity in this time. -; Should be used to survive network problems. (default: 0) -client_idle_timeout = 0 diff --git a/test/test.ini b/test/test.ini index 9ce357a..5659243 100644 --- a/test/test.ini +++ b/test/test.ini @@ -1,6 +1,4 @@ -;; database name = connect string [databases] - p0 = port=6666 host=127.0.0.1 dbname=p0 user=bouncer pool_size=2 p1 = port=6666 host=127.0.0.1 dbname=p1 user=bouncer p3 = port=6666 host=127.0.0.1 dbname=p0 user=bouncer pool_mode=session @@ -11,125 +9,25 @@ p5x= port=6666 host=127.0.0.1 dbname=p5 user=muser1 password=wrong authdb = port=6666 host=127.0.0.1 dbname=p1 auth_user=pswcheck -;; Configuation section [pgbouncer] - -;;; -;;; Administrative settings -;;; - logfile = test.log pidfile = test.pid -;;; -;;; Where to wait for clients -;;; - -; ip address or * which means all ip-s listen_addr = 127.0.0.1 listen_port = 6667 unix_socket_dir = /tmp -;;; -;;; Authentication settings -;;; - -; any, trust, plain, crypt, md5 auth_type = trust auth_file = userlist.txt -;;; -;;; Pooler personality questions -;;; - -; When server connection is released back to pool: -; session - after client disconnects -; transaction - after transaction finishes -; statement - after statement finishes pool_mode = statement -; When taking idle server into use, this query is ran first. -; -; Query for session pooling: -; ABORT; RESET ALL; SET SESSION AUTHORIZATION DEFAULT -; Query for statement/transaction pooling: -; SELECT 1 -; Empty query disables the functionality -server_check_query = select 1 - -; If server was used more recently that this many seconds ago, -; skip the check query. If 0, the check query is always ran. server_check_delay = 10 - -;;; -;;; Connection limits -;;; - -; total number of clients that can connect max_client_conn = 10 default_pool_size = 5 -;;; -;;; Timeouts -;;; - -; Close server connection if its been connected longer. server_lifetime = 120 - -; Close server connection if its not been used in this time. -; Allows to clean unneccessary connections from pool after peak. server_idle_timeout = 60 -; Cancel connection attepmt if server does not answer takes longer. -server_connect_timeout = 15 - -; If server login failed (server_connect_timeout or auth failure) -; then wait this many second. -server_login_retry = 15 - -; Dangerous. Server connection is closed if query does not return -; in this time. Should be used to survive network problems, -; _not_ as statement_timeout. (default: 0) -query_timeout = 0 - -; Dangerous. Client connection is closed if no activity in this time. -; Should be used to survive network problems. (default: 0) -client_idle_timeout = 0 - - -;;; -;;; Low-level tuning options -;;; - -; buffer for streaming packets -;pkt_buf = 4096 - -;;; -;;; networking options, for info: man 7 tcp -;;; - -; linux: notify program about new connection only if there -; is also data received. (Seconds to wait.) tcp_defer_accept = 0 - -;; following options are reloadable, but apply only to -;; new connections. - -; in-kernel buffer size (linux default: 4096) -tcp_socket_buffer = 0 - -; whether tcp keepalive should be turned on (0/1) tcp_keepalive = 0 - -;; following options are linux-specific. -;; they also require tcp_keepalive=1 - -; count of keepaliva packets -tcp_keepcnt = 0 - -; how long the connection can be idle, -; before sending keepalive packets -tcp_keepidle = 0 - -; The time between individual keepalive probes. -tcp_keepintvl = 0 -- 2.40.0