|
| 1 | +[databases] |
| 2 | +{% for pool in pgbouncer_pools %} |
| 3 | +{{ pool.name }} = {{ pool.conninfo }} |
| 4 | +{% endfor %} |
| 5 | + |
| 6 | +[pgbouncer] |
| 7 | + |
| 8 | +;;; |
| 9 | +;;; Administrative settings |
| 10 | +;;; |
| 11 | + |
| 12 | +logfile = {{ pgbouncer_logfile }} |
| 13 | +pidfile = {{ pgbouncer_pidfile }} |
| 14 | + |
| 15 | +;;; |
| 16 | +;;; Where to wait for clients |
| 17 | +;;; |
| 18 | + |
| 19 | +; ip address or * which means all ip-s |
| 20 | +listen_addr = {{ pgbouncer_listen_addr }} |
| 21 | +listen_port = {{ pgbouncer_listen_port }} |
| 22 | + |
| 23 | +; unix socket is also used for -R. |
| 24 | +; On debian it should be /var/run/postgresql |
| 25 | +;unix_socket_dir = /tmp |
| 26 | +;unix_socket_mode = 0777 |
| 27 | +;unix_socket_group = |
| 28 | + |
| 29 | +;;; |
| 30 | +;;; Authentication settings |
| 31 | +;;; |
| 32 | + |
| 33 | +; any, trust, plain, crypt, md5 |
| 34 | +auth_type = {{ pgbouncer_auth_type }} |
| 35 | +auth_file = {{ pgbouncer_auth_file }} |
| 36 | + |
| 37 | +;;; |
| 38 | +;;; Users allowed into database 'pgbouncer' |
| 39 | +;;; |
| 40 | + |
| 41 | +; comma-separated list of users, who are allowed to change settings |
| 42 | +admin_users = {{ pgbouncer_admin_user }} |
| 43 | + |
| 44 | +; comma-separated list of users who are just allowed to use SHOW command |
| 45 | +stats_users = {{ pgbouncer_admin_user }},{{ pgbouncer_stats_users |join(",")}} |
| 46 | + |
| 47 | +;;; |
| 48 | +;;; Pooler personality questions |
| 49 | +;;; |
| 50 | + |
| 51 | +; When server connection is released back to pool: |
| 52 | +; session - after client disconnects |
| 53 | +; transaction - after transaction finishes |
| 54 | +; statement - after statement finishes |
| 55 | +pool_mode = {{ pgbouncer_pool_mode }} |
| 56 | + |
| 57 | +; |
| 58 | +; Query for cleaning connection immediately after releasing from client. |
| 59 | +; No need to put ROLLBACK here, pgbouncer does not reuse connections |
| 60 | +; where transaction is left open. |
| 61 | +; |
| 62 | +; Query for 8.3+: |
| 63 | +; DISCARD ALL; |
| 64 | +; |
| 65 | +; Older versions: |
| 66 | +; RESET ALL; SET SESSION AUTHORIZATION DEFAULT |
| 67 | +; |
| 68 | +; Empty if transaction pooling is in use. |
| 69 | +; |
| 70 | +server_reset_query = {{ 'DISCARD ALL' if pgbouncer_pool_mode == 'session' else '' }} |
| 71 | + |
| 72 | +; |
| 73 | +; Comma-separated list of parameters to ignore when given |
| 74 | +; in startup packet. Newer JDBC versions require the |
| 75 | +; extra_float_digits here. |
| 76 | +; |
| 77 | +ignore_startup_parameters = extra_float_digits |
| 78 | + |
| 79 | +; |
| 80 | +; When taking idle server into use, this query is ran first. |
| 81 | +; SELECT 1 |
| 82 | +; |
| 83 | +;server_check_query = select 1 |
| 84 | + |
| 85 | +; If server was used more recently that this many seconds ago, |
| 86 | +; skip the check query. Value 0 may or may not run in immediately. |
| 87 | +;server_check_delay = 30 |
| 88 | + |
| 89 | +;;; |
| 90 | +;;; Connection limits |
| 91 | +;;; |
| 92 | + |
| 93 | +; total number of clients that can connect |
| 94 | +max_client_conn = {{ pgbouncer_max_client_conn }} |
| 95 | + |
| 96 | +; default pool size. 20 is good number when transaction pooling |
| 97 | +; is in use, in session pooling it needs to be the number of |
| 98 | +; max clients you want to handle at any moment |
| 99 | +default_pool_size = {{ pgbouncer_default_pool_size }} |
| 100 | + |
| 101 | +; how many additional connection to allow in case of trouble |
| 102 | +reserve_pool_size = 0 |
| 103 | + |
| 104 | +; if a clients needs to wait more than this many seconds, use reserve pool |
| 105 | +;reserve_pool_timeout = 3 |
| 106 | + |
| 107 | +; log if client connects or server connection is made |
| 108 | +;log_connections = 1 |
| 109 | + |
| 110 | +; log if and why connection was closed |
| 111 | +;log_disconnections = 1 |
| 112 | + |
| 113 | +; log error messages pooler sends to clients |
| 114 | +log_pooler_errors = 1 |
| 115 | + |
| 116 | + |
| 117 | +; If off, then server connections are reused in LIFO manner |
| 118 | +;server_round_robin = 0 |
| 119 | + |
| 120 | +;;; |
| 121 | +;;; Timeouts |
| 122 | +;;; |
| 123 | + |
| 124 | +;; Close server connection if its been connected longer. |
| 125 | +server_lifetime = 7200 |
| 126 | + |
| 127 | +;; Close server connection if its not been used in this time. |
| 128 | +;; Allows to clean unnecessary connections from pool after peak. |
| 129 | +server_idle_timeout = 30 |
| 130 | + |
| 131 | +;; Cancel connection attempt if server does not answer takes longer. |
| 132 | +server_connect_timeout = 10 |
| 133 | + |
| 134 | +;; If server login failed (server_connect_timeout or auth failure) |
| 135 | +;; then wait this many second. |
| 136 | +server_login_retry = 10 |
| 137 | + |
| 138 | +;; Dangerous. Server connection is closed if query does not return |
| 139 | +;; in this time. Should be used to survive network problems, |
| 140 | +;; _not_ as statement_timeout. (default: 0) |
| 141 | +;query_timeout = 0 |
| 142 | + |
| 143 | +;; Dangerous. Client connection is closed if the query is not assigned |
| 144 | +;; to a server in this time. Should be used to limit the number of queued |
| 145 | +;; queries in case of a database or network failure. (default: 0) |
| 146 | +;query_wait_timeout = 0 |
| 147 | + |
| 148 | +;; Dangerous. Client connection is closed if no activity in this time. |
| 149 | +;; Should be used to survive network problems. (default: 0) |
| 150 | +;client_idle_timeout = 0 |
| 151 | + |
| 152 | +;; Disconnect clients who have not managed to log in after connecting |
| 153 | +;; in this many seconds. |
| 154 | +;client_login_timeout = 60 |
| 155 | + |
| 156 | +;; Clean automatically created database entries (via "*") if they |
| 157 | +;; stay unused in this many seconds. |
| 158 | +; autodb_idle_timeout = 3600 |
| 159 | + |
| 160 | +;;; |
| 161 | +;;; Low-level tuning options |
| 162 | +;;; |
| 163 | + |
| 164 | +;; buffer for streaming packets |
| 165 | +;pkt_buf = 2048 |
| 166 | + |
| 167 | +;; man 2 listen |
| 168 | +;listen_backlog = 128 |
| 169 | + |
| 170 | +;; networking options, for info: man 7 tcp |
| 171 | + |
| 172 | +;; Linux: notify program about new connection only if there |
| 173 | +;; is also data received. (Seconds to wait.) |
| 174 | +;; On Linux the default is 45, on other OS'es 0. |
| 175 | +;tcp_defer_accept = 0 |
| 176 | + |
| 177 | +;; In-kernel buffer size (Linux default: 4096) |
| 178 | +;tcp_socket_buffer = 0 |
| 179 | + |
| 180 | +;; whether tcp keepalive should be turned on (0/1) |
| 181 | +tcp_keepalive = 1 |
| 182 | + |
| 183 | +;; following options are Linux-specific. |
| 184 | +;; they also require tcp_keepalive=1 |
| 185 | + |
| 186 | +;; count of keepaliva packets |
| 187 | +;tcp_keepcnt = 0 |
| 188 | + |
| 189 | +;; how long the connection can be idle, |
| 190 | +;; before sending keepalive packets |
| 191 | +;tcp_keepidle = 0 |
| 192 | + |
| 193 | +;; The time between individual keepalive probes. |
| 194 | +;tcp_keepintvl = 0 |
| 195 | + |
| 196 | +;; DNS lookup caching time |
| 197 | +;dns_max_ttl = 15 |
| 198 | + |
| 199 | +;; DNS zone SOA lookup period |
| 200 | +;dns_zone_check_period = 0 |
0 commit comments