环境: CentOS 5, Postgresql 9, WinXp
通过winXP上的psql连接远程服务器上postgresql服务,出现错误:
C:\Documents and Settings\rand>psql -U postgres -d postgres -h 10.71.88.251 -p 5432
psql: 无法联接到服务器: Connection refused (0x0000274D/10061)
服务器是否在主机 "10.71.88.251" 上运行并且准备接受在端口
5432 上的 TCP/IP 联接?
之前配置过pg_hba.conf上的信息:
host all all 10.71.88.252/32 trust --注10.71.88.252为winxp的IP地址
经排错,发现postgresql.conf中有一个监听器地址参数为#listen_addresses = 'localhost', 必须将其修改为listen_addresses = '*',以便可以让其它客户端来访问。
通过winXP上的psql连接远程服务器上postgresql服务,出现错误:
C:\Documents and Settings\rand>psql -U postgres -d postgres -h 10.71.88.251 -p 5432
psql: 无法联接到服务器: Connection refused (0x0000274D/10061)
服务器是否在主机 "10.71.88.251" 上运行并且准备接受在端口
5432 上的 TCP/IP 联接?
之前配置过pg_hba.conf上的信息:
host all all 10.71.88.252/32 trust --注10.71.88.252为winxp的IP地址
经排错,发现postgresql.conf中有一个监听器地址参数为#listen_addresses = 'localhost', 必须将其修改为listen_addresses = '*',以便可以让其它客户端来访问。
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/16582684/viewspace-734091/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/16582684/viewspace-734091/
文章详细介绍了在CentOS5环境下,使用WinXP通过psql工具连接远程服务器上运行的PostgreSQL服务时遇到的Connection refused错误。重点在于通过修改配置文件`postgresql.conf`中的`listen_addresses`参数,由原来的`localhost`更改为`'*'`,以允许其他客户端访问。此解决方案解决了连接问题,并提供了完整的排查步骤。
838

被折叠的 条评论
为什么被折叠?



