Debian PostgreSQL网络配置要点如下:
listen_addresses='*'以允许所有IP连接(生产环境建议指定具体IP),并确认port=5432(默认端口)。host all all 0.0.0.0/0 md5(允许所有IP连接,需结合防火墙限制)。ufw允许PostgreSQL端口(5432):sudo ufw allow 5432/tcp。ping测试节点间网络连通性,确保服务器IP可达。netstat或ss命令确认PostgreSQL监听状态:sudo netstat -plnt | grep 5432。pg_hba.conf中的IP范围,避免开放所有IP(生产环境建议仅允许可信IP)。sudo systemctl restart postgresql。注:Debian 10及以上版本可使用netplan配置网络接口(如静态IP),旧版本通过/etc/network/interfaces设置。