How to disable 1 version of PostgreSQL server without uninstalling it
I have installed PostgreSQL 9.1
and 9.2
on my Ubuntu machine. The postgresql service starts both versions:
$ sudo service postgresql start
$ * Starting PostgreSQL 9.1 database server [ OK ]
$ * Starting PostgreSQL 9.2 database server [ OK ]
I'd like to start just 9.2
server but without uninstalling 9.1
, is that possible?
Short version:
Replace auto
with manual
in /etc/postgresql/9.1/main/start.conf
Long version:
Each PostgreSQL cluster in Debian/Ubuntu has a start.conf
file that controls what /etc/init.d/postgresql
should do.
This is documented with 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.