How to check status of PostgreSQL server Mac OS X

前端 未结 7 1900
南旧
南旧 2020-12-04 06:52

How can I tell if my Postgresql server is running or not?

I\'m getting this message:

[~/dev/working/sw] sudo bundle exec rake db:migrate 
rake aborte         


        
7条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-04 07:49

    As of PostgreSQL 9.3, you can use the command pg_isready to determine the connection status of a PostgreSQL server.

    From the docs:

    pg_isready returns 0 to the shell if the server is accepting connections normally, 1 if the server is rejecting connections (for example during startup), 2 if there was no response to the connection attempt, and 3 if no attempt was made (for example due to invalid parameters).

提交回复
热议问题