PostgreSQL10配置远程连接
PostgreSQL10配置远程连接
psql --version
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)