サーバーはホスト「localhost」(::1)で実行されており、ポート5432でTCP/IP接続を受け入れていますか? 質問する

サーバーはホスト「localhost」(::1)で実行されており、ポート5432でTCP/IP接続を受け入れていますか? 質問する

まず最初に、Stack Overflow や Web 上の記事で同様の質問をいくつか見つけたのですが、どれも私の問題を解決するのに役立たなかったことに注意してください。

さて、問題は次の通りです。

  • 完璧に動作する Rails アプリがあります。
  • 共同作業者とは、GitHub を使用して共同作業を行っています。
  • masterと のブランチがありますmvp
  • 最近、gitHomebrew (Mac) でバージョンを更新しました。
  • アプリをローカルで起動するには、Foreman を使用します。

ここで、アプリをローカルで起動しようとすると、次のエラーが発生します。

PG::ConnectionBad at /
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?

コンピュータを何度か再起動してみました。

以下の内容も確認しました/usr/local/var/postgres:

PG_VERSION      pg_dynshmem     pg_multixact    pg_snapshots    pg_tblspc       postgresql.conf
base            pg_hba.conf     pg_notify       pg_stat         pg_twophase     postmaster.opts
global          pg_ident.conf   pg_replslot     pg_stat_tmp     pg_xlog         server.log
pg_clog         pg_logical      pg_serial       pg_subtrans     postgresql.auto.conf

ご覧のとおり、postmaster.pidそこにはファイルがありません。

これを修正するにはどうすればいいでしょうか?

ベストアンサー1

実行するpostgres -D /usr/local/var/postgresと、次のような画面が表示されます。

 FATAL:  lock file "postmaster.pid" already exists
 HINT:   Is another postmaster (PID 379) running in data directory "/usr/local/var/postgres"?

次にkill -9 PIDHINTを実行します

これで準備完了です。

おすすめ記事