如何重启PostgreSQL [英] How to restart Postgresql

查看:2895
本文介绍了如何重启PostgreSQL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Linux Mint机器上安装了Postgresql 9.3和9.4.如何重新启动Postgresql 9.4?一起重新启动两个版本的方法也很好.

I have Postgresql 9.3 and 9.4 installed on my Linux Mint machine. How can I restart postgresql 9.4? A method to restart both versions together is also fine.

推荐答案

以root身份尝试(也许可以使用sudosu):

Try this as root (maybe you can use sudo or su):

/etc/init.d/postgresql restart

脚本不带任何参数,也提示您如何重新启动特定版本

Without any argument the script also gives you a hint on how to restart a specific version

[Uqbar@Feynman ~] /etc/init.d/postgresql
Usage: /etc/init.d/postgresql {start|stop|restart|reload|force-reload|status} [version ...]

类似地,如果您拥有它,则您也可以使用service工具:

Similarly, in case you have it, you can also use the service tool:

[Uqbar@Feynman ~] service postgresql
Usage: /etc/init.d/postgresql {start|stop|restart|reload|force reload|status} [version ...]

请注意可选的[version ...]尾随参数. 这意味着允许您(用户)在特定版本上执行操作,以防您运行多个版本.因此,您可以重新启动版本 X ,同时保持版本 Y Z 不变并运行.

Please, pay attention to the optional [version ...] trailing argument. That's meant to allow you, the user, to act on a specific version, in case you were running multiple ones. So you can restart version X while keeping version Y and Z untouched and running.

最后,如果您正在运行 systemd ,则可以像这样使用systemctl :

Finally, in case you are running systemd, then you can use systemctl like this:

[support@Feynman ~] systemctl status postgresql
● postgresql.service - PostgreSQL database server
   Loaded: loaded (/usr/lib/systemd/system/postgresql.service; enabled; vendor preset: disabled)
   Active: active (running) since Wed 2017-11-14 12:33:35 CET; 7min ago
...

您可以将status替换为stopstartrestart以及其他操作.请参阅文档以获取全部详细信息.不幸的是,使用此工具似乎无法对多个版本的Postgresql进行操作. 最后,请记住,与前面提到的其他情况一样,非信息性任务可能需要root权限.

You can replace status with stop, start or restart as well as other actions. Please refer to the documentation for full details. Unluckily there seems to be no way to operate on multiple versions of Postgresql with this tool. Finally Keep in mind that root permissions may be needed for non-informative tasks as in the other cases seen earlier.

这篇关于如何重启PostgreSQL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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