【问题标题】:PostgreSQL Can't connect to remote server running under rootPostgreSQL 无法连接到在 root 下运行的远程服务器
【发布时间】:2019-01-27 11:13:37
【问题描述】:

我有一个在 root 下启动并运行的 postgresql 服务器。它在一个 docker 容器中,暴露的端口是 5434。我的 API docker 容器能够连接到这个服务器,但我无法从本地机器访问它,连接超时。

这是命令ps -elf|grep root的输出

4 S root     15264  5623  0  80   0 -  2128 -      Jan25 ?        00:00:00 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 5434 -container-ip 172.18.0.5 -container-port 5432

【问题讨论】:

    标签: postgresql docker containers


    【解决方案1】:

    现在 Postgres 在 Docker 容器中运行,您的 IP 不再是本地 IP,因此您需要更新服务器的 pg_hba.conf 以允许来自您访问 Postgres 的网络的连接。

    【讨论】:

      猜你喜欢
      • 2015-10-28
      • 2015-09-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-03-08
      相关资源
      最近更新 更多