forked from erp-dev/erp
giveup2
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -17,29 +17,17 @@ services:
|
||||
pgbouncer:
|
||||
image: pgbouncer/pgbouncer:latest
|
||||
container_name: pgbouncer
|
||||
# 配置文件已包含所有配置,环境变量仅作为备用
|
||||
environment:
|
||||
POSTGRES_HOST: postgres
|
||||
POSTGRES_PORT: "5432"
|
||||
POSTGRES_DB: flower
|
||||
POSTGRES_USER: postgres
|
||||
POSTGRES_PASSWORD: postgres
|
||||
DATABASES_HOST: postgres
|
||||
DATABASES_PORT: "5432"
|
||||
DATABASES_USER: postgres
|
||||
DATABASES_PASSWORD: postgres
|
||||
DATABASES_DBNAME: flower
|
||||
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_IDLE_TIMEOUT: "600"
|
||||
PGBOUNCER_LOG_CONNECTIONS: "1"
|
||||
PGBOUNCER_LOG_DISCONNECTIONS: "1"
|
||||
PGBOUNCER_LOG_POOLER_ERRORS: "1"
|
||||
ports:
|
||||
- "6432:6432"
|
||||
volumes:
|
||||
- ./pgbouncer/pgbouncer.ini:/etc/pgbouncer/pgbouncer.ini
|
||||
depends_on:
|
||||
- postgres
|
||||
restart: unless-stopped
|
||||
|
||||
@@ -18,29 +18,17 @@ services:
|
||||
pgbouncer:
|
||||
image: pgbouncer/pgbouncer:latest
|
||||
container_name: pgbouncer
|
||||
# 配置文件已包含所有配置,环境变量仅作为备用
|
||||
environment:
|
||||
POSTGRES_HOST: postgres
|
||||
POSTGRES_PORT: "${POSTGRES_PORT:-5432}"
|
||||
POSTGRES_DB: ${POSTGRES_DB:-flower}
|
||||
POSTGRES_USER: ${POSTGRES_USER:-postgres}
|
||||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-postgres}
|
||||
DATABASES_HOST: postgres
|
||||
DATABASES_PORT: "${POSTGRES_PORT:-5432}"
|
||||
DATABASES_USER: ${POSTGRES_USER:-postgres}
|
||||
DATABASES_PASSWORD: ${POSTGRES_PASSWORD:-postgres}
|
||||
DATABASES_DBNAME: ${POSTGRES_DB:-flower}
|
||||
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_IDLE_TIMEOUT: "600"
|
||||
PGBOUNCER_LOG_CONNECTIONS: "1"
|
||||
PGBOUNCER_LOG_DISCONNECTIONS: "1"
|
||||
PGBOUNCER_LOG_POOLER_ERRORS: "1"
|
||||
ports:
|
||||
- "${PGBOUNCER_PORT:-6432}:6432"
|
||||
volumes:
|
||||
- ./pgbouncer/pgbouncer.ini:/etc/pgbouncer/pgbouncer.ini
|
||||
depends_on:
|
||||
- postgres
|
||||
restart: unless-stopped
|
||||
|
||||
@@ -17,29 +17,18 @@ services:
|
||||
pgbouncer:
|
||||
image: pgbouncer/pgbouncer:latest
|
||||
container_name: pgbouncer
|
||||
# 配置文件已包含所有配置,环境变量仅作为备用
|
||||
environment:
|
||||
POSTGRES_HOST: postgres
|
||||
POSTGRES_PORT: "5432"
|
||||
POSTGRES_DB: flower
|
||||
POSTGRES_USER: postgres
|
||||
POSTGRES_PASSWORD: postgres
|
||||
# 如果镜像支持环境变量配置,这些可以作为备用
|
||||
DATABASES_HOST: postgres
|
||||
DATABASES_PORT: "5432"
|
||||
DATABASES_USER: postgres
|
||||
DATABASES_PASSWORD: postgres
|
||||
DATABASES_DBNAME: flower
|
||||
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_IDLE_TIMEOUT: "600"
|
||||
PGBOUNCER_LOG_CONNECTIONS: "1"
|
||||
PGBOUNCER_LOG_DISCONNECTIONS: "1"
|
||||
PGBOUNCER_LOG_POOLER_ERRORS: "1"
|
||||
ports:
|
||||
- "6432:6432"
|
||||
volumes:
|
||||
- ./pgbouncer/pgbouncer.ini:/etc/pgbouncer/pgbouncer.ini
|
||||
depends_on:
|
||||
- postgres
|
||||
restart: unless-stopped
|
||||
|
||||
38
pgbouncer/pgbouncer.ini
Normal file
38
pgbouncer/pgbouncer.ini
Normal file
@@ -0,0 +1,38 @@
|
||||
[databases]
|
||||
flower = host=postgres port=5432 dbname=flower user=postgres password=postgres
|
||||
|
||||
[pgbouncer]
|
||||
; 监听地址和端口
|
||||
listen_addr = 0.0.0.0
|
||||
listen_port = 6432
|
||||
|
||||
; 认证方式:trust 表示信任所有连接(适用于容器内部网络)
|
||||
; 这样客户端连接时不需要密码,但 PgBouncer 到 PostgreSQL 的连接仍需要密码
|
||||
auth_type = trust
|
||||
|
||||
; 连接池配置
|
||||
; pool_mode: session, transaction, statement
|
||||
; transaction 模式最适合 Django,每个事务结束后释放连接
|
||||
pool_mode = transaction
|
||||
max_client_conn = 100
|
||||
default_pool_size = 25
|
||||
min_pool_size = 5
|
||||
reserve_pool_size = 5
|
||||
reserve_pool_timeout = 3
|
||||
|
||||
; 连接超时设置
|
||||
server_connect_timeout = 15
|
||||
server_idle_timeout = 600
|
||||
query_timeout = 0
|
||||
query_wait_timeout = 120
|
||||
|
||||
; 日志配置
|
||||
log_connections = 1
|
||||
log_disconnections = 1
|
||||
log_pooler_errors = 1
|
||||
|
||||
; 其他设置
|
||||
; 忽略 PostgreSQL 16 的额外启动参数
|
||||
ignore_startup_parameters = extra_float_digits
|
||||
application_name_add_host = 1
|
||||
|
||||
Reference in New Issue
Block a user