一尘不染

如何检查 PostgreSQL 服务器 Mac OS X 的状态

javascript

如何判断我的 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

阅读 78

收藏
2022-07-14

共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
2022-07-14