Advertisement
Guest User

Untitled

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