PostgreSQL10配置远程连接

时间:2019-10-15
本文章向大家介绍PostgreSQL10配置远程连接,主要包括PostgreSQL10配置远程连接使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。

PostgreSQL10配置远程连接

centos7.3中

1、开启相应的防火墙端口,允许端口5432

2、访问权限配置/etc/postgresql/10/main/下的pg_hba.conf

 
 
# TYPE  DATABASE        USER            ADDRESS                 METHOD

# "local" is for Unix domain socket connections only
local   all             all                                     peer
# IPv4 local connections:
host    all             all             127.0.0.1/32            ident
# IPv6 local connections:
host    all             all             ::1/128                 ident
# Allow replication connections from localhost, by a user with the
# replication privilege.
#local   replication     all                                     peer
#host    replication     all             127.0.0.1/32            ident
#host    replication     all             ::1/128                 ident
host    all             all             0.0.0.0/0               md5

3、监听机器配置/etc/postgresql/10/main/下的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)

centos6.8中

上述文件在/var/lib/pgsql/10/data/路径下

原文地址:https://www.cnblogs.com/Gbeniot/p/11678404.html