Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/postgresql/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Postgresql Postgres连接在内部网络而非外部网络上超时_Postgresql - Fatal编程技术网

Postgresql Postgres连接在内部网络而非外部网络上超时

Postgresql Postgres连接在内部网络而非外部网络上超时,postgresql,Postgresql,设置 使用 Postgres 11, pg promise npm模块 我有一个大约5台机器的本地网络,所有机器都在C 192.168.1.0/24类配置上运行 我的postgres运行在192.168.1.A上,可以通过NAT和防火墙通过外部连接访问,我的heroku API连接到192.168.1.A上的postgres 在我的网络中的192.168.1.B上,我在另一台机器上运行了与heroku类似的API开发版本 问题 192.168.1.B有一个总是给我一个超时错误。这些机器位于相同的

设置

使用
Postgres 11,
pg promise npm模块

我有一个大约5台机器的本地网络,所有机器都在
C 192.168.1.0/24类
配置上运行

我的postgres运行在192.168.1.A上,可以通过NAT和防火墙通过外部连接访问,我的heroku API连接到192.168.1.A上的postgres

在我的网络中的192.168.1.B上,我在另一台机器上运行了与heroku类似的API开发版本

问题

192.168.1.B有一个总是给我一个超时错误。这些机器位于相同的物理位置。我不知道如何追踪我为什么会出现这个超时错误。设置非常简单

pg_hba.conf
有以下几行:

host    all             all             127.0.0.1/32            md5
host    all             all             0.0.0.0/0               md5
host    all             all             192.168.1.0/24          md5
Heroku log说:

2021-04-16T22:46:10.973041+00:00 heroku[router]: at=info method=GET path="/api/locations" host=<host> request_id=<id> fwd="<an ip>" dyno=web.1 connect=1ms service=735ms status=304 bytes=182 protocol=https
我不明白为什么会这样。WAN连接正常,但LAN连接超时

解决方案

我不知道我是否应该删除这个。 最后一行配置错误。
192.168.1.0/24
应该是
192.168.1.0/32

postgres日志是否显示失败的连接尝试?否。未记录任何连接错误。没有连接到日志的错误。它在连接过程中超时。这就是问题所在。为什么局域网会超时,但广域网是标准的30-40毫秒响应?@KenIngram您是否检查过没有防火墙过滤局域网连接(可能在数据库机器中)?防火墙通常会产生超时。iptables在为postgres服务的机器上没有设置。
GET /api/locations 500 31647.158 ms - 37