【发布时间】:2021-06-28 00:33:49
【问题描述】:
我正在创建一个使用 PostgreSQL 数据库服务器的应用程序,该服务器在 Linux(20.1 Ubuntu)机器上运行。但是,当 Linux 机器与尝试连接它的客户端不在同一个网络上时,我收到错误:
Is the server running on host xxx.xxx.xx.xx and accepting TCP/IP connections on port xxxx?
我的防火墙中有一个例外,因为它都在同一个网络上工作,这对我来说意味着我的配置很好,我不明白我哪里出错了。我已经尝试了所有here。
我的pg_hba.conf 看起来像这样:
local replication all peer
host replication all 127.0.0.1/32 md5
host replication all ::1/128 md5
host all all 0.0.0.0/0 md5
host all all ::/0 md5
而我的postgresql.conf 看起来像这样:
# - Connection Settings -
listen_addresses = '*' # what IP address(es) to listen on;
# comma-separated list of addresses;
# defaults to 'localhost'; use '*' for all
# (change requires restart)
port = 5432 # (change requires restart)
max_connections = 100 # (change requires restart)
有人可以帮助我/指导我他们是如何做到这一点的吗?我已经审查了所有答案,但如果我遗漏了什么,请为重复道歉。任何帮助表示赞赏。
【问题讨论】:
-
我的解决方案对你有用吗?
标签: postgresql tcp database-connection