查询以检查PostgreSQL数据库状态 [英] Query to check postgresql database status

查看:421
本文介绍了查询以检查PostgreSQL数据库状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有任何查询来检查数据库状态?
我只想知道它在远程主机上是否处于活动状态。因此,是否有任何查询在数据库正在运行以及其他数据库详细信息时返回200 OK?

Is there any query to check the database status? I just want to know if it is active or not on the remote host.So, Is there any query which return 200 OK if db is running and other db detail?

推荐答案

https ://www.postgresql.org/docs/current/static/app-pg-isready.html

-bash-4.2$ if pg_isready93 -d postgres://localhost:5432/template; then echo "200 OK"; else echo "500 NOT OK"; fi
200 OK
-bash-4.2$ if pg_isready93 -d postgres://localhost:5430/template; then echo "200 OK"; else echo "500 NOT OK"; fi
500 NOT OK



贷记给Abelisto的信用额-我不认为 pg_isready 在这种情况下

这篇关于查询以检查PostgreSQL数据库状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆