从远程主机访问postgres容器时出错

时间:2018-11-29 12:05:50

标签: postgresql docker

我有一个Postgres Docker集群,该集群在具有覆盖网络的Docker集群环境中运行。一切看起来都很好,直到我尝试使用此命令 psql -h -p -U 来从远程主机访问创建的容器时。

我正在使用如下所示的环境变量文件设置postgres初始化参数

`# the name of the cluster
PATRONI_SCOPE=pg-test-cluster

# create an admin user on pg init
PATRONI_admin_OPTIONS=createdb, createrole
PATRONI_admin_PASSWORD=admin

# host and port of etcd service
PATRONI_ETCD_HOST=etcd:2379

# location of password file
PATRONI_POSTGRESQL_PGPASS=home/postgres/.pgpass

# address patroni will use to connect to local server
PATRONI_POSTGRESQL_LISTEN=0.0.0.0:5432

# replication user and password
PATRONI_REPLICATION_PASSWORD=abcd
PATRONI_REPLICATION_USERNAME=replicator

# address patroni used to receive incoming api calls
PATRONI_RESTAPI_LISTEN=0.0.0.0:8008

# api basic auth
PATRONI_RESTAPI_PASSWORD=admin
PATRONI_RESTAPI_USERNAME=admin

# patroni needs superuser adminstrate postgres
PATRONI_SUPERUSER_PASSWORD=postgres
PATRONI_SUPERUSER_USERNAME=postgres`

我得到的错误是

`psql: could not connect to server: Connection refused
    Is the server running on host "10.66.112.29" and accepting
    TCP/IP connections on port 5000?`

我通过主数据库的patroni rest api暴露了端口5000。

有什么想法让我遗漏了吗?谢谢!

0 个答案:

没有答案
相关问题