pgbouncer.ini 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342
  1. ;; database name = connect string
  2. ;;
  3. ;; connect string params:
  4. ;; dbname= host= port= user= password=
  5. ;; client_encoding= datestyle= timezone=
  6. ;; pool_size= connect_query=
  7. [databases]
  8. ; foodb over unix socket
  9. ;foodb =
  10. ; redirect bardb to bazdb on localhost
  11. ;bardb = host=localhost dbname=bazdb
  12. ; access to dest database will go with single user
  13. ;forcedb = host=127.0.0.1 port=300 user=baz password=foo client_encoding=UNICODE datestyle=ISO connect_query='SELECT 1'
  14. ; use custom pool sizes
  15. ;nondefaultdb = pool_size=50 reserve_pool_size=10
  16. ; fallback connect string
  17. ;* = host=testserver
  18. * = host=127.0.0.1 user=odoo password=zeus
  19. ;; Configuration section
  20. [pgbouncer]
  21. ;;;
  22. ;;; Administrative settings
  23. ;;;
  24. logfile = /var/log/pgbouncer/pgbouncer.log
  25. pidfile = /var/run/pgbouncer/pgbouncer.pid
  26. ;;;
  27. ;;; Where to wait for clients
  28. ;;;
  29. ; ip address or * which means all ip-s
  30. listen_addr = 127.0.0.1
  31. listen_port = 6432
  32. ; unix socket is also used for -R.
  33. ; On debian it should be /var/run/postgresql
  34. ;unix_socket_dir = /tmp
  35. ;unix_socket_mode = 0777
  36. ;unix_socket_group =
  37. ;unix_socket_dir = /var/run/postgresql
  38. ;;;
  39. ;;; TLS settings for accepring clients
  40. ;;;
  41. ;; disable, allow, require, verify-ca, verify-full
  42. ;client_tls_sslmode = disable
  43. ;; Path to file that contains trusted CA certs
  44. ;client_tls_ca_file = <system default>
  45. ;; Private key and cert to present to clients.
  46. ;; Required for accepting TLS connections from clients.
  47. ;client_tls_key_file =
  48. ;client_tls_cert_file =
  49. ;; fast, normal, secure, legacy, <ciphersuite string>
  50. ;client_tls_ciphers = fast
  51. ;; all, secure, tlsv1.0, tlsv1.1, tlsv1.2
  52. ;client_tls_protocols = all
  53. ;; none, auto, legacy
  54. ;client_tls_dheparams = auto
  55. ;; none, auto, <curve name>
  56. ;client_tls_ecdhcurve = auto
  57. ;;;
  58. ;;; TLS settings for connecting to backend databases
  59. ;;;
  60. ;; disable, allow, require, verify-ca, verify-full
  61. ;server_tls_sslmode = disable
  62. ;; Path to that contains trusted CA certs
  63. ;server_tls_ca_file = <system default>
  64. ;; Private key and cert to present to backend.
  65. ;; Needed only if backend server require client cert.
  66. ;server_tls_key_file =
  67. ;server_tls_cert_file =
  68. ;; all, secure, tlsv1.0, tlsv1.1, tlsv1.2
  69. ;server_tls_protocols = all
  70. ;; fast, normal, secure, legacy, <ciphersuite string>
  71. ;server_tls_ciphers = fast
  72. ;;;
  73. ;;; Authentication settings
  74. ;;;
  75. ; any, trust, plain, crypt, md5
  76. auth_type = md5
  77. ;auth_file = /8.0/main/global/pg_auth
  78. auth_file = /etc/pgbouncer/userlist.txt
  79. ;; Path to HBA-style auth config
  80. ;auth_hba_file =
  81. ;; Query to use to fetch password from database. Result
  82. ;; must have 2 columns - username and password hash.
  83. ;auth_query = SELECT usename, passwd FROM pg_shadow WHERE usename=$1
  84. ;;;
  85. ;;; Users allowed into database 'pgbouncer'
  86. ;;;
  87. ; comma-separated list of users, who are allowed to change settings
  88. admin_users = pgbouncer,odoo
  89. ; comma-separated list of users who are just allowed to use SHOW command
  90. ;stats_users = stats, root
  91. ;;;
  92. ;;; Pooler personality questions
  93. ;;;
  94. ; When server connection is released back to pool:
  95. ; session - after client disconnects
  96. ; transaction - after transaction finishes
  97. ; statement - after statement finishes
  98. pool_mode = transaction
  99. ;
  100. ; Query for cleaning connection immediately after releasing from client.
  101. ; No need to put ROLLBACK here, pgbouncer does not reuse connections
  102. ; where transaction is left open.
  103. ;
  104. ; Query for 8.3+:
  105. ; DISCARD ALL;
  106. ;
  107. ; Older versions:
  108. ; RESET ALL; SET SESSION AUTHORIZATION DEFAULT
  109. ;
  110. ; Empty if transaction pooling is in use.
  111. ;
  112. server_reset_query = DISCARD ALL
  113. ; Whether server_reset_query should run in all pooling modes.
  114. ; If it is off, server_reset_query is used only for session-pooling.
  115. ;server_reset_query_always = 0
  116. ;
  117. ; Comma-separated list of parameters to ignore when given
  118. ; in startup packet. Newer JDBC versions require the
  119. ; extra_float_digits here.
  120. ;
  121. ;ignore_startup_parameters = extra_float_digits
  122. ;
  123. ; When taking idle server into use, this query is ran first.
  124. ; SELECT 1
  125. ;
  126. ;server_check_query = select 1
  127. ; If server was used more recently that this many seconds ago,
  128. ; skip the check query. Value 0 may or may not run in immediately.
  129. ;server_check_delay = 30
  130. ;; Use <appname - host> as application_name on server.
  131. ;application_name_add_host = 0
  132. ;;;
  133. ;;; Connection limits
  134. ;;;
  135. ; total number of clients that can connect
  136. max_client_conn = 500
  137. ; default pool size. 20 is good number when transaction pooling
  138. ; is in use, in session pooling it needs to be the number of
  139. ; max clients you want to handle at any moment
  140. default_pool_size = 20
  141. ;; Minimum number of server connections to keep in pool.
  142. ;min_pool_size = 0
  143. ; how many additional connection to allow in case of trouble
  144. ;reserve_pool_size = 5
  145. ; if a clients needs to wait more than this many seconds, use reserve pool
  146. ;reserve_pool_timeout = 3
  147. ; how many total connections to a single database to allow from all pools
  148. ;max_db_connections = 50
  149. ;max_user_connections = 50
  150. ; If off, then server connections are reused in LIFO manner
  151. ;server_round_robin = 0
  152. ;;;
  153. ;;; Logging
  154. ;;;
  155. ;; Syslog settings
  156. ;syslog = 0
  157. ;syslog_facility = daemon
  158. ;syslog_ident = pgbouncer
  159. ; log if client connects or server connection is made
  160. ;log_connections = 1
  161. ; log if and why connection was closed
  162. ;log_disconnections = 1
  163. ; log error messages pooler sends to clients
  164. ;log_pooler_errors = 1
  165. ;; Period for writing aggregated stats into log.
  166. ;stats_period = 60
  167. ;; Logging verbosity. Same as -v switch on command line.
  168. ;verbose=0
  169. ;;;
  170. ;;; Timeouts
  171. ;;;
  172. ;; Close server connection if its been connected longer.
  173. ;server_lifetime = 1200
  174. ;; Close server connection if its not been used in this time.
  175. ;; Allows to clean unnecessary connections from pool after peak.
  176. ;server_idle_timeout = 60
  177. ;; Cancel connection attempt if server does not answer takes longer.
  178. ;server_connect_timeout = 15
  179. ;; If server login failed (server_connect_timeout or auth failure)
  180. ;; then wait this many second.
  181. ;server_login_retry = 15
  182. ;; Dangerous. Server connection is closed if query does not return
  183. ;; in this time. Should be used to survive network problems,
  184. ;; _not_ as statement_timeout. (default: 0)
  185. ;query_timeout = 0
  186. ;; Dangerous. Client connection is closed if the query is not assigned
  187. ;; to a server in this time. Should be used to limit the number of queued
  188. ;; queries in case of a database or network failure. (default: 120)
  189. ;query_wait_timeout = 120
  190. ;; Dangerous. Client connection is closed if no activity in this time.
  191. ;; Should be used to survive network problems. (default: 0)
  192. ;client_idle_timeout = 0
  193. ;; Disconnect clients who have not managed to log in after connecting
  194. ;; in this many seconds.
  195. ;client_login_timeout = 60
  196. ;; Clean automatically created database entries (via "*") if they
  197. ;; stay unused in this many seconds.
  198. ; autodb_idle_timeout = 3600
  199. ;; How long SUSPEND/-R waits for buffer flush before closing connection.
  200. ;suspend_timeout = 10
  201. ;; Close connections which are in "IDLE in transaction" state longer than
  202. ;; this many seconds.
  203. ;idle_transaction_timeout = 0
  204. ;;;
  205. ;;; Low-level tuning options
  206. ;;;
  207. ;; buffer for streaming packets
  208. ;pkt_buf = 4096
  209. ;; man 2 listen
  210. ;listen_backlog = 128
  211. ;; Max number pkt_buf to process in one event loop.
  212. ;sbuf_loopcnt = 5
  213. ;; Maximum Postgres protocol packet size.
  214. ;max_packet_size = 2147483647
  215. ;; networking options, for info: man 7 tcp
  216. ;; Linux: notify program about new connection only if there
  217. ;; is also data received. (Seconds to wait.)
  218. ;; On Linux the default is 45, on other OS'es 0.
  219. ;tcp_defer_accept = 0
  220. ;; In-kernel buffer size (Linux default: 4096)
  221. ;tcp_socket_buffer = 0
  222. ;; whether tcp keepalive should be turned on (0/1)
  223. ;tcp_keepalive = 1
  224. ;; following options are Linux-specific.
  225. ;; they also require tcp_keepalive=1
  226. ;; count of keepaliva packets
  227. ;tcp_keepcnt = 0
  228. ;; how long the connection can be idle,
  229. ;; before sending keepalive packets
  230. ;tcp_keepidle = 0
  231. ;; The time between individual keepalive probes.
  232. ;tcp_keepintvl = 0
  233. ;; DNS lookup caching time
  234. ;dns_max_ttl = 15
  235. ;; DNS zone SOA lookup period
  236. ;dns_zone_check_period = 0
  237. ;; DNS negative result caching time
  238. ;dns_nxdomain_ttl = 15
  239. ;;;
  240. ;;; Random stuff
  241. ;;;
  242. ;; Hackish security feature. Helps against SQL-injection - when PQexec is disabled,
  243. ;; multi-statement cannot be made.
  244. ;disable_pqexec=0
  245. ;; Config file to use for next RELOAD/SIGHUP.
  246. ;; By default contains config file from command line.
  247. ;conffile
  248. ;; Win32 service name to register as. job_name is alias for service_name,
  249. ;; used by some Skytools scripts.
  250. ;service_name = pgbouncer
  251. ;job_name = pgbouncer
  252. ;; Read additional config from the /etc/pgbouncer/pgbouncer-other.ini file
  253. ;%include /etc/pgbouncer/pgbouncer-other.ini