那么我似乎已经尝试了一切,我可以find – 没有那么多 – 但无法理解为什么我不能远程连接到我的数据库。
这是我有:
#postgresql.conf listen_addresses = '12.34.56.78,localhost' # included my local ip port = 5432 # the port I'm trying to connect with tcpip_socket = true #pg_hba.conf host all mydbuser 12.34.56.78/32 md5 I receive: connection to database 'name' failed, could not connect to server: Connection refused. Is the server running on host "domain.com" and accepting TCP/IP connections on port 5432? netstat -ant | grep 5432 #returns nothing
netstat -nltp | grep 5432:什么也没有返回
解
真的,我认为是什么阻碍了我对这个问题的理解,是关于这个问题的一个写得不好的博客文章。 另一方面,在切片主机的一个令人敬畏的教程清理了我的东西,如果有人曾经到过这里有同样的问题,我build议他们通读它。 Slicehost在教程的质量和维护方面确实值得称道,但我认为帮助人们使用他们的服务是一件好事。
谢谢大家回答。
在数据库服务器上,你可以运行以下并发布输出:
ps axf | grep postgres netstat -nltp | grep 5432 netstat -nltp | grep 5432 要绕过防火墙尝试使用端口80或8080而不是5432。
你从12.34.56.78 / 32连接(这是你的pg_hba.conf允许的范围)?
你能ping 12.34.56.78吗?
从空的netstat输出,看起来像你的postgres进程没有监听端口!
/ var / log / postgresql /重新启动数据库时是否显示有趣的内容。
你检查过你的防火墙吗? 你可能有一些规则阻止访问该端口
主机全部mydbuser 12.34.56.78/32 md5
这个行在你的pg_hba.conf意味着只有来自主机12.34.56.78的用户mydbuser才能够连接。
因此,如果这是PG服务器,则需要为主机或子网添加另一行(例如,如果要连接12.34.45.01-254中的任何一个,则将放置12.34.56.00/24)