Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

2 Answers 2

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.
share|improve this answer
    
Actually it should be 'disabled', not 'disable' - so says the start.conf file itself. Should I start the server some other way that 'sudo service postgresql start'? cause this way the manual/disabled cluster still starts :/ –  Bartlomiej Skwira Sep 28 '13 at 19:00
    
@BartlomiejSkwira: manual worked for me when I had to use it (no auto-start). About disable or disabled, the startup shell script (see /usr/share/postgresql-common/init.d-functions) doesn't really care, if it's not auto it doesn't start. –  Daniel Vérité Sep 28 '13 at 19:43
    
According to the source /usr/share/postgresql-common/PgCommon.pm it's also spelled disabled so the manpage is indeed wrong. –  Daniel Vérité Sep 28 '13 at 19:49

Rename /etc/postgresql/9.1/main/posgtgresql.conf to something else, or move the entire /etc/postgresql/9.1 directory somewhere else.

The start scripts key off of the directories that exist in /etc/postgresql/ that have */postgresql.conf in them.

share|improve this answer
    
Renaming or even moving postgresql.conf and start.conf isn't enough and the server still starts. Moving the dir works, but seems more like a bad workaround. –  Bartlomiej Skwira Sep 28 '13 at 17:53
    
It won't start w/o a postgresql.conf... it'll SAY it does, because the startup scripts on ubuntu are horrible about giving any sort of useful output about what is going on, but the server doesn't start:((( for c in /etc/postgresql/"$2"/*; do [ -e "$c/postgresql.conf" ] || continue )))(read: no error output) Moving the entire directory removes the configuration from the startup script detection completely and then it shouldn't mention it. –  jerm Sep 28 '13 at 18:07

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.