listen_addresses(string)Specifies the TCP/IP address(es) on which the server is to listen for connections from client applications. The value takes the form of a comma-separated list of host names and/or numeric IP addresses. The special entry
*corresponds to all available IP interfaces. The entry0.0.0.0allows listening for all IPv4 addresses and::allows listening for all IPv6 addresses. If the list is empty, the server does not listen on any IP interface at all, in which case only Unix-domain sockets can be used to connect to it. If the list is not empty, the server will start if it can listen on at least one TCP/IP address. A warning will be emitted for any TCP/IP address which cannot be opened. The default value is localhost, which allows only local TCP/IP "loopback" connections to be made.
1.编辑参数文件,然后重启pg
vi $PGDATA/postgresql.conf
bash
listen_addresses = '192.168.56.10'
2.编辑pg_hba.conf,然后运行pg_ctl reload
vi $PGDATA/pg_hba.conf
bash
host all all 192.168.56.0/24 scram-sha-256