PostgreSQLサーバのステータスを確認する方法 Mac OS X 質問する

PostgreSQLサーバのステータスを確認する方法 Mac OS X 質問する

Postgresql サーバーが実行中かどうかはどうすればわかりますか?

次のメッセージが表示されます:

[~/dev/working/sw] sudo bundle exec rake db:migrate 
rake aborted!
could not connect to server: Connection refused
    Is the server running on host "localhost" and accepting
    TCP/IP connections on port 5432?

アップデート:

> which postgres
/usr/local/bin/postgres
> pg_ctl -D /usr/local/bin/postgres -l /usr/local/bin/postgres/server.log start
pg_ctl: could not open PID file "/usr/local/bin/postgres/postmaster.pid": Not a directory

アップデート2:

>pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
server starting
sh: /usr/local/var/postgres/server.log: No such file or directory

ベストアンサー1

実行中のプロセスを確認する最も簡単な方法:

ps auxwww | grep postgres

次のようなコマンドを探します (バージョンが 8.3 ではない可能性があります)。

/Library/PostgreSQL/8.3/bin/postgres -D /Library/PostgreSQL/8.3/data

サーバーを起動するには、次のように実行します。

/Library/PostgreSQL/8.3/bin/pg_ctl start -D /Library/PostgreSQL/8.3/data -l postgres.log

おすすめ記事