如何配置 PostgreSQL 以接受所有传入连接 [英] How to configure PostgreSQL to accept all incoming connections
问题描述
我有一个 PostgreSQL 数据库,我想将其配置为接受所有传入连接,而不管源 IP 地址如何.如何在 pg_hba.conf 文件中配置?我使用的是 postgreSQL 8.4 版.
I've got a PostgreSQL data base that I'd like to configure to accept all incoming connections regardless of the source IP address. How can this be configured in the pg_hba.conf file? I'm using postgreSQL version 8.4.
推荐答案
只需使用0.0.0.0/0
.
host all all 0.0.0.0/0 md5
确保 postgresql.conf
中的listen_addresses(或ALTER SYSTEM SET
) 允许所有可用 IP 接口上的传入连接.
Make sure the listen_addresses
in postgresql.conf
(or ALTER SYSTEM SET
) allows incoming connections on all available IP interfaces.
listen_addresses = '*'
更改后,您必须重新加载配置.一种方法是以超级用户身份执行此 SELECT
.
After the changes you have to reload the configuration. One way to do this is execute this SELECT
as a superuser.
SELECT pg_reload_conf();
注意:改变listen_addresses
,重新加载是不够的,你必须重新启动服务器.
Note: to change listen_addresses
, a reload is not enough, and you have to restart the server.
这篇关于如何配置 PostgreSQL 以接受所有传入连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!