前提・実現したいこと
ターミナルからpostgreSQLを起動したいのですができません。どなたかご教授願います。
なお以前使用していたpostgreSQLがあったので新しくインストールする前にuninstallしました。
発生している問題・エラーメッセージ
018-05-11 00:19:56.568 JST [683] LOG: could not bind IPv6 address "::1": Address already in use 2018-05-11 00:19:56.568 JST [683] HINT: Is another postmaster already running on port 5432? If not, wait a few seconds and retry. 2018-05-11 00:19:56.568 JST [683] LOG: could not bind IPv4 address "127.0.0.1": Address already in use 2018-05-11 00:19:56.568 JST [683] HINT: Is another postmaster already running on port 5432? If not, wait a few seconds and retry. 2018-05-11 00:19:56.568 JST [683] WARNING: could not create listen socket for "localhost" 2018-05-11 00:19:56.568 JST [683] FATAL: could not create any TCP/IP sockets 2018-05-11 00:19:56.568 JST [683] LOG: database system is shut down
試したこと
$postgres -D /usr/local/var/postgres
①エラー内容:
2018-05-11 00:17:30.817 JST [677] FATAL: lock file "postmaster.pid" already exists
2018-05-11 00:17:30.817 JST [677] HINT: Is another postmaster (PID 655) running in data directory "/usr/local/var/postgres"?
postmaster.pidを削除しなければならないようなので以下のコマンドを実行し削除しました。
$sudo rm /usr/local/var/postgres/postmaster.pid
②再度起動してみる以下のようなエラーが吐かれました。
018-05-11 00:19:56.568 JST [683] LOG: could not bind IPv6 address "::1": Address already in use 2018-05-11 00:19:56.568 JST [683] HINT: Is another postmaster already running on port 5432? If not, wait a few seconds and retry. 2018-05-11 00:19:56.568 JST [683] LOG: could not bind IPv4 address "127.0.0.1": Address already in use 2018-05-11 00:19:56.568 JST [683] HINT: Is another postmaster already running on port 5432? If not, wait a few seconds and retry. 2018-05-11 00:19:56.568 JST [683] WARNING: could not create listen socket for "localhost" 2018-05-11 00:19:56.568 JST [683] FATAL: could not create any TCP/IP sockets 2018-05-11 00:19:56.568 JST [683] LOG: database system is shut down
次にポート5432を使用しているプロセスを調べてみると確かにpostgresが存在していました。
$sudo lsof -i:5432
postgres 684 ユーザ名 5u IPv6 0x6bcf3ef402c44f61 0t0 TCP localhost:postgresql (LISTEN) postgres 684 ユーザ名 6u IPv4 0x6bcf3ef405678749 0t0 TCP localhost:postgresql (LISTEN)
↑を削除するためkillコマンドを実行するのですが、新たなプロセスが発生してしまいます。
postgres 697 ユーザ名 5u IPv6 0x6bcf3ef402c44f61 0t0 TCP localhost:postgresql (LISTEN)
postgres 697 ユーザ名 6u IPv4 0x6bcf3ef405678749 0t0 TCP localhost:postgresql (LISTEN)
自動起動設定がされているのかと考え以下のコマンドを実行してみましたが、うまくいきません。
$sudo launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
③エラー内容
Library/LaunchAgents/homebrew.mxcl.postgresql.plist: Could not find specified service
その他システムの再起動を行ってみましたができませんでした。
前回起動した時はうまく行ったのでサーバーの停止が正常にできていなかったのかとも思うのですが行き詰ってしまいました。
どなたか解決方法を教えていただけると幸いです。よろしくお願いします。
補足情報
OS:macOS High Sierra10.13.4
postgreSQLバージョン:10.3
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。