0

我遇到了应用程序看不到数据库的情况。我的pg_hba.conf文件有以下内容:

local   all             all                                     trust
host    all             all             127.0.0.1/32            trust
host    all             all             ::1/128                 trust

除了安全性,应用程序告诉我它根本看不到数据库,而其他客户端可以看到它:

PG::ConnectionBad: could not connect to server: Connection refused
    Is the server running on host "127.0.0.1" and accepting
    TCP/IP connections on port 5432?
 (Sequel::DatabaseConnectionError)

我必须将我的应用程序指向IP该盒子的公众,并将其添加到我pg_hba.conf的应用程序中才能正常工作。此外,它与 混淆了localhost,因为它显然是先查看IP6路线然后再查看IP4路线,两者都抛出错误:

Could not spawn process for application /var/www/pints: The application encountered the following error: PG::ConnectionBad: could not connect to server: Connection refused
  Is the server running on host "localhost" (::1) and accepting
  TCP/IP connections on port 5432?
could not connect to server: Connection refused
  Is the server running on host "localhost" (127.0.0.1) and accepting
  TCP/IP connections on port 5432?
 (Sequel::DatabaseConnectionError)

问题:在同一个盒子上强制它使用IP4路由并最好地使用IP4资源来处理通信的最佳方法是什么? localhost和以前一样是盲人,127.0.0.1所以我很困惑。干杯

4

0 回答 0