小编Jac*_*sen的帖子

在`pg_hba.conf` 中使用主机名?

根据 PostgreSQL 文档:

以点 (.) 开头的主机名规范与实际主机名的后缀匹配。所以 .example.com 将匹配 foo.example.com(但不仅仅是 example.com)。

所以我把这一行放进去pg_hba.conf并重新启动 PostgreSQL:

hostssl market_data market_data_access .horsholm.dk md5
Run Code Online (Sandbox Code Playgroud)

然后我尝试连接到数据库:

psql "postgresql://market_data_access@<server-IP>:5433/market_data?sslmode=require"
Run Code Online (Sandbox Code Playgroud)

我得到了这个,而不是密码提示:

psql: FATAL:  no pg_hba.conf entry for host "195.249.206.131", user "market_data_access", database "market_data", SSL on
Run Code Online (Sandbox Code Playgroud)

为了检查,我对错误消息中列出的 IP 地址进行反向 DNS 查找:

$ host 195.249.206.131
131.206.249.195.in-addr.arpa is an alias for 131.129-190.206.249.195.in-addr.arpa.
131.129-190.206.249.195.in-addr.arpa domain name pointer kommune.horsholm.dk.
$
Run Code Online (Sandbox Code Playgroud)

我究竟做错了什么?

postgresql authentication postgresql-9.6

8
推荐指数
1
解决办法
4483
查看次数