![](/img/trans.png)
[英]PG::ConnectionBad - could not connect to server: Connection refused
[英]pg_dump: [archiver (db)] connection to database “development” failed: could not connect to server: Connection refused
在嘗試將我的數據庫從我的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的新手,無法想出這個。 希望它是一個簡單的我忽略。
首先,sqlite不打算用於生產。 事實上,Heroku不支持使用sqlite,因此如果您想將您的應用程序與Heroku一起使用,則需要切換到Postgres: https : //devcenter.heroku.com/articles/getting-started-with-rails4#寫你的應用程序 。
您獲得的具體錯誤是因為您的heroku應用程序將連接到端口5432,默認情況下由Postgres使用,而sqlite不使用該端口。 但是,由於您沒有要在localhost上連接的PG服務器,因此您的應用程序失敗並顯示該錯誤。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.