pg_dump:[archiver(db)]与数据库“development”的连接失败:无法连接到服务器:Connection拒绝

时间:2016-05-18 04:35:58

标签: ruby-on-rails heroku

在尝试将我的数据库从我的development.sqlite3文件推送到我的Heroku应用程序时,我遇到以下错误消息:

pg_dump: [archiver (db)] connection to database "development" failed: 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?
pg_restore: [archiver] input file is too short (read 0, expected 5)
psql: 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?
 !    Heroku client internal error.
 !    Search for help at: https://help.heroku.com
 !    Or report a bug at: https://github.com/heroku/heroku/issues/new

我是Heroku的新手,无法想出这个。希望它是简单的我忽略的。

1 个答案:

答案 0 :(得分:0)

首先,sqlite并不打算用于生产。事实上,Heroku不支持使用sqlite,因此如果你想将你的应用程序与Heroku一起使用,你需要切换到Postgres:https://devcenter.heroku.com/articles/getting-started-with-rails4#write-your-app

您获得的具体错误是因为您的heroku应用程序要连接到端口5432,默认情况下由Postgres使用,而sqlite不使用。但是,由于您没有要在localhost上连接的PG服务器,因此您的应用程序失败并显示该错误。