Пытаюсь соединить Pgbouncer и Postgresql внутри докера.
Docker-compose:
version: '3'
services:
db:
container_name: web_postgresql
image: postgres:13.0
volumes:
- pg_data:/var/lib/postgresql13/data/
ports:
- 5432:5432
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
- POSTGRES_db=postgres
pgbouncer:
container_name: pgbouncer
build: ./pgbouncer
restart: always
env_file:
- pgbouncer/pgbouncer.env
ports:
- 6432:6432
depends_on:
- db
Pgbouncer.ini
[databases]
* = host=db port=5432
[pgbouncer]
pool_mode = transaction
listen_addr = *
listen_port = 6432
auth_type = md5
auth_file = /opt/pgbouncer/etc/userlist.txt
max_client_conn = 5000
default_pool_size = 20
min_pool_size = 10
reserve_pool_size = 10
max_db_connections = 50
max_user_connections = 50
ignore_startup_parameters = extra_float_digits
# Log settings
log_connections = 0
log_disconnections = 0
admin_users = postgres
pgbouncer.env
DATABASES_HOST=db
DATABASES_PORT=5432
DATABASES_USER=postgres
DATABASES_PASSWORD=postgres
DATABASES_DBNAME=postgres
PGBOUNCER_LISTEN_ADDE=*
PGBOUNCER_LISTEN_PORT=6432
PGBOUNCER_MAX_CLIENT_CONN=5000
PGBOUNCER_DEFAULT_POOL_SIZE=20
PGBOUNCER_MIN_POOL_SIZE=10
PGBOUNCER_RESERVE_POOL_SIZE=10
PGBOUNCER_MAX_DB_CONNECTIONS=50
PGBOUNCER_MAX_USER_CONNECTIONS=50
PGBOUNCER_LOG_CONNECTIONS=0
PGBOUNCER_LOG_DISCONNECTIONS=0
PGBOUNCER_ADMIN_USERS=postgres
PGBOUNCER_AUTH_TYPE=md5
userlist.txt
"postgres" "postgres"
Dockerfile для Pgbouncer
FROM pgbouncer/pgbouncer
COPY pgbouncer.ini /opt/pgbouncer/etc/pgbouncer.ini
COPY userlist.txt /opt/pgbouncer/etc/userlist.txt
Поднимаю контейнеры. К постгресу спокойно могу подключиться через psql с паролем и юзернеймом postgres.
А к pgbouncer никак не могу.
Что бы я там ни пробовал, не понимаю, где ошибка.
Буду благодарен за помощь