diff --git a/auth_file.txt.tmpl b/auth_file.txt.tmpl index 2492d24..181041e 100644 --- a/auth_file.txt.tmpl +++ b/auth_file.txt.tmpl @@ -1,2 +1 @@ "$PGUSER" "$PGPASSWORD" -"$STATS_USER" "$STATS_PASSWORD" diff --git a/pgbouncer.ini.tmpl b/pgbouncer.ini.tmpl index c57857f..1324c81 100644 --- a/pgbouncer.ini.tmpl +++ b/pgbouncer.ini.tmpl @@ -7,10 +7,10 @@ pool_mode = $CONNECTION_POOLER_MODE listen_port = $CONNECTION_POOLER_PORT listen_addr = * -auth_type = plain +auth_type = md5 auth_file = /etc/pgbouncer/auth_file.txt admin_users = $PGUSER -stats_users = $STATS_USER +stats_users_prefix = robot_ auth_query = SELECT * FROM $PGSCHEMA.user_lookup($1) logfile = /var/log/pgbouncer/pgbouncer.log pidfile = /var/run/pgbouncer/pgbouncer.pid @@ -30,7 +30,14 @@ default_pool_size = $CONNECTION_POOLER_DEFAULT_SIZE # Add more server connections to pool if below this number. Improves behavior # when usual load comes suddenly back after period of total inactivity. -min_pool_size = $CONNECTION_POOLER_MIN_SIZE +# +# NOTE: This value is per pool, i.e. a pair of (db, user), not a global one. +# Which means on the higher level it has to be calculated from the max allowed +# database connections and number of databases and users. If not taken into +# account, then for too many users or databases PgBouncer will go crazy +# opening/evicting connections. For now disable it. +# +# min_pool_size = $CONNECTION_POOLER_MIN_SIZE # How many additional connections to allow to a pool reserve_pool_size = $CONNECTION_POOLER_RESERVE_SIZE