如何禁用 1 个版本的 PostgreSQL 服务器而不卸载它

Bar*_*ira 4 postgresql database-administration

我已经安装的PostgreSQL9.19.2我的Ubuntu的机器上。postgresql 服务启动两个版本:

$ sudo service postgresql start
$ * Starting PostgreSQL 9.1 database server  [ OK ]
$ * Starting PostgreSQL 9.2 database server  [ OK ]
Run Code Online (Sandbox Code Playgroud)

我只想启动9.2服务器但不卸载9.1,这可能吗?

Dan*_*ité 10

简短版本
替换automanualin/etc/postgresql/9.1/main/start.conf

长版

Debian/Ubuntu 中的每个 PostgreSQL 集群都有一个start.conf文件来控制/etc/init.d/postgresql应该做什么。

这是用pg_createcluster 记录的

   STARTUP CONTROL
   The start.conf file in the cluster configuration directory controls the
   start/stop behavior of that cluster’s postmaster process. The file can
   contain comment lines (started with ’#’), empty lines, and must have
   exactly one line with one of the following keywords:

   auto
       The postmaster process is started/stopped automatically in the init
       script.  This is also the default if the file is missing.

   manual
       The postmaster process is not handled by the init script, but
       manually controlling the cluster with pg_ctlcluster(1) is
       permitted.

   disable
       Neither the init script nor pg_ctlcluster(1) are permitted to
       start/stop the cluster. Please be aware that this will not stop the
       cluster owner from calling lower level tools to control the
       postmaster process; this option is only meant to prevent accidents
       during maintenance, not more.
Run Code Online (Sandbox Code Playgroud)

  • 将“auto”更改为“manual”也适用于运行“systemd”的计算机。只需记住在编辑文件后运行“systemctl daemon-reload”即可。 (3认同)