[英]PG::ConnectionBad could not connect to server - heroku local rails app
我試圖運行heroku local
或heroku local web
,一切正常。 將數據從我的 heroku 遠程導入到本地環境后,它開始向我拋出以下錯誤:
在某些地方搜索解決方案后,我嘗試使用brew services restart postgresql
,它正常啟動但我一直收到錯誤消息。 我還嘗試按照此 SO post PG::ConnectionBad 中的建議刪除postmaster.pid
- 無法連接到服務器:連接被拒絕但未找到該文件。
好吧,找到解決方案比我想象的要容易。
在同一篇文章中( PG::ConnectionBad - 無法連接到服務器:連接被拒絕),它建議在刪除文件之前檢查日志,我什至沒有找到要刪除的文件。
因此,我檢查了 heroku 的 Postgres 版本,它使用 12 作為默認版本,但brew
使用最新版本,即第 13 個版本。
總而言之,我從 Postgre v12 轉儲到 Postgre v13,這是不兼容的,所以我將降級我的本地 Postgres 以按預期處理我的數據。
為此,我執行了以下操作:
brew uninstall postgres
- 刪除 v13
brew install postgresql@12
- 安裝特定版本
brew services start postgresql@12
- 啟動新版本
很酷的事實,我不需要恢復或修改數據,因為即使卸載 Postgresql 也沒有刪除數據。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.