如何在 Ubuntu 18.04 中重启 PostgreSQL
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/52610485/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to restart PostgreSQL in Ubuntu 18.04
提问by ?smail Yavuz
How to restart PostgreSQL via ssh console?
如何通过 ssh 控制台重启 PostgreSQL?
When i search this thing on SO I only find: postgres, ubuntu how to restart service on startup? get stuck on clustering after instance reboot
当我在 SO 上搜索这个东西时,我只发现:postgres,ubuntu 如何在启动时重新启动服务?实例重启后卡在集群上
回答by ?smail Yavuz
sudo service postgresql restart
回答by aziz aziz
systemctl restart postgresql@<postgres_version>-<cluster_name>.service
By default cluster_name = 'main', run this command to list all the clusters you have :
默认情况下 cluster_name = 'main',运行此命令以列出您拥有的所有集群:
ls var/lib/postgresql/
ls var/lib/postgresql/
if you want to know whether the postgresql is running try this command :
如果您想知道 postgresql 是否正在运行,请尝试以下命令:
systemctl status postgresql@<postgres_version>-<cluster_version>.service
回答by JL_SO
My postgresql service is named postgresql-9.5; in case you get "postgresql: unrecognized service"
you can find its name with
我的 postgresql 服务名为 postgresql-9.5;如果你得到"postgresql: unrecognized service"
你可以找到它的名字
sudo service --status-all | grep postgresql
and then proceed as per the accepted answer.
然后按照接受的答案继续。