我想知道启动/停止postgres数据库的正确方法。有两种方法
pg_ctl start/stopservice postgresql start/stop我想知道它们之间的区别,我应该使用哪一个?是他们的优点/缺点。
我在网上检查,但没有得到满意的答复。
提前致谢
如果您查看/etc/init.d/postgres${VER}文件,您会发现,当您运行service postgresql start/stop它时,会运行pg_ctl $OPTIONS start/stop. 唯一的区别是服务为您提供了存储环境变量和启用/禁用自动启动的便捷方式。
以上所有内容都可以手动完成,使用pg_ctl和一些脚本。
小智 5
开始:
brew services start postgresql
Run Code Online (Sandbox Code Playgroud)
停止:
brew services stop postgresql
Run Code Online (Sandbox Code Playgroud)
开始:
pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
Run Code Online (Sandbox Code Playgroud)
停止:
pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log stop
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4870 次 |
| 最近记录: |