【发布时间】:2020-01-16 18:14:49
【问题描述】:
我为 PGbouncer 创建了一个 docker 容器。 (Docker 镜像来自 -https://hub.docker.com/r/edoburu/pgbouncer)
docker run -d -it --name=pb -e DB_NAME=events -e DB_HOST=localhost -e DB_USER=postgres -e DB_PASSWORD=postgres -e LISTEN_ADDR=127.0.0.1 -e LISTEN_PORT=8083 -e AUTH_TYPE=any -e AUTH_FILE=/Users/nandeeshnaik/Desktop/pg/userlist.txt brainsam/pgbouncer:latest
上面的命令运行 pgbouncer。 来自 docker 容器的日志,
adduser: user 'postgres' in use
#pgbouncer.ini
# Description
# Config file is in “ini” format. Section names are between “[” and “]”.
# Lines starting with “;” or “#” are taken as comments and ignored.
# The characters “;” and “#” are not recognized when they appear later in the line.
[databases]
* = host=localhost port=5432 user=postgres password=postgres
[pgbouncer]
# Generic settings
listen_addr = 127.0.0.1
listen_port = 8083
auth_file = /Users/nandeeshnaik/Desktop/pg/userlist.txt
auth_type = any
ignore_startup_parameters = extra_float_digits
# Log settings
admin_users = postgres
# Connection sanity checks, timeouts
# TLS settings
# Dangerous timeouts
################## end file ##################
Starting pgbouncer...
2019-09-15 20:05:23.309 1 LOG File descriptor limit: 1048576 (H:1048576), max_client_conn: 100, max fds possible: 110
2019-09-15 20:05:23.309 1 LOG listening on 127.0.0.1:8083
2019-09-15 20:05:23.309 1 LOG listening on unix:/tmp/.s.PGSQL.8083
2019-09-15 20:05:23.309 1 LOG process up: pgbouncer 1.8.1, libevent 2.1.8-stable (epoll), adns: c-ares 1.13.0, tls: OpenSSL 1.0.2n 7 Dec 2017
在此之后,我尝试使用 postgres 客户端 (PSQL) 连接到 pgbouncer。
psql -h 127.0.0.1 -p 8083 -U postgres events
我收到以下错误..
(base) MUMCAP0120:pg nandeeshnaik$ psql -h 127.0.0.1 -p 8083 -U postgres events
psql: could not connect to server: Connection refused
Is the server running on host "127.0.0.1" and accepting
TCP/IP connections on port 8083?
- 使用 Mac
- 本地安装的 Postgresql。
- userlist.txt 只有 "postgres",用户名和密码都在痛苦文本中。
非常感谢任何解决此问题的建议和解决方案。
如果您需要更清楚的说明,请告诉我。
【问题讨论】:
标签: postgresql docker pgbouncer