Advertisement
Guest User

Untitled

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