Advertisement
Guest User

Untitled

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