forked from erp-dev/erp
giveup6
This commit is contained in:
@@ -26,9 +26,35 @@ services:
|
||||
pgbouncer:
|
||||
image: pgbouncer/pgbouncer:latest
|
||||
container_name: pgbouncer
|
||||
# 配置文件已包含所有配置,环境变量仅作为备用
|
||||
volumes:
|
||||
- ./pgbouncer/pgbouncer.ini:/etc/pgbouncer/pgbouncer.ini:ro
|
||||
# 使用环境变量配置,让镜像自动生成配置文件
|
||||
environment:
|
||||
# 数据库连接配置(格式:数据库名=host=主机 port=端口 dbname=数据库名 user=用户 password=密码)
|
||||
DATABASES: flower=host=postgres port=${POSTGRES_PORT:-5432} dbname=${POSTGRES_DB:-flower} user=${POSTGRES_USER:-postgres} password=${POSTGRES_PASSWORD:-postgres}
|
||||
# PgBouncer 基本配置
|
||||
PGBOUNCER_LISTEN_ADDR: 0.0.0.0
|
||||
PGBOUNCER_LISTEN_PORT: 6432
|
||||
PGBOUNCER_AUTH_TYPE: trust
|
||||
# 连接池配置
|
||||
PGBOUNCER_POOL_MODE: transaction
|
||||
PGBOUNCER_MAX_CLIENT_CONN: "100"
|
||||
PGBOUNCER_DEFAULT_POOL_SIZE: "25"
|
||||
PGBOUNCER_MIN_POOL_SIZE: "5"
|
||||
PGBOUNCER_RESERVE_POOL_SIZE: "5"
|
||||
PGBOUNCER_RESERVE_POOL_TIMEOUT: "3"
|
||||
# 连接超时设置
|
||||
PGBOUNCER_SERVER_CONNECT_TIMEOUT: "15"
|
||||
PGBOUNCER_SERVER_IDLE_TIMEOUT: "600"
|
||||
PGBOUNCER_QUERY_TIMEOUT: "0"
|
||||
PGBOUNCER_QUERY_WAIT_TIMEOUT: "120"
|
||||
# 日志配置
|
||||
PGBOUNCER_LOG_CONNECTIONS: "1"
|
||||
PGBOUNCER_LOG_DISCONNECTIONS: "1"
|
||||
PGBOUNCER_LOG_POOLER_ERRORS: "1"
|
||||
# 其他设置
|
||||
PGBOUNCER_IGNORE_STARTUP_PARAMETERS: extra_float_digits
|
||||
PGBOUNCER_APPLICATION_NAME_ADD_HOST: "1"
|
||||
ports:
|
||||
- "${PGBOUNCER_PORT:-6432}:6432"
|
||||
# 确保 postgres 完全启动后再启动 pgbouncer
|
||||
depends_on:
|
||||
postgres:
|
||||
|
||||
Reference in New Issue
Block a user