“ service postgresql start”和“ service postgresql start”之间有什么区别?和“ pg_ctl开始”? [英] What is the difference between "service postgresql start" and "pg_ctl start"?

查看:700
本文介绍了“ service postgresql start”和“ service postgresql start”之间有什么区别?和“ pg_ctl开始”?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Ubuntu 14.04上,如果我设置了PGDATA环境变量,则这两个命令

On Ubuntu 14.04, if i have the PGDATA environment variable set, the two commands

service postgresql start

并且

pg_ctl start

似乎做同样的事情:在后台启动postgres服务器。
在未设置PGDATA的情况下, pg_ctl start需要附加的 -D / datadir 参数才能启动。该服务不需要此。为什么会这样呢?两种启动服务器的方式有什么区别?以及如何在不知道数据目录的情况下启动服务?

seems to do the same thing: Start the postgres server in the background. Without PGDATA set, "pg_ctl start" needs needs the additional -D /datadir argument in order to start. The service does not need this. Why is this so? What is the difference between the two ways of starting the server? And how can the service start without knowing the data dir?

推荐答案

服务命令运行系统V风格的初始化脚本。在这种情况下,您正在 /etc/init.d 目录中运行名为 postgreql 的脚本。该脚本可能是专门为Ubuntu而编写的,并且其中包含正确的配置信息。

The service command runs a System V-style init script. In this case you are running a script named postgreql in the /etc/init.d directory. This script likely has been written especially for Ubuntu and has the proper configuration information in it.

这篇关于“ service postgresql start”和“ service postgresql start”之间有什么区别?和“ pg_ctl开始”?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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