2

I have upgraded from 9.2 to 9.3 successfully on ubuntu. However,

/etc/init.d/postgresql start

starts both 9.2 and 9.3

Although the above command can accept that the version number and successfully starts and stops each one, is there any method I can use to make this command start 9.3 only.

The reason is that, I am not able to reboot the system now, but I am afraid when it is rebooted both servers can start.

My short term solution is to adjust the port numbers to make my application use 9.3 database. However, I would like to learn about more permanent and robust solutions.

Thanks in advance,

Steve

Steve Harman
  • 741
  • 1
  • 8
  • 11
  • possible duplicate of [2 instances of postgresql but I really need one](http://stackoverflow.com/questions/20629561/2-instances-of-postgresql-but-i-really-need-one) – Daniel Vérité Jan 10 '14 at 00:47

2 Answers2

1

Ubuntu uses pg_wrapper to manage PostgreSQL installs. See the Ubuntu PostgreSQL wiki page.

You'll want to pg_dropcluster the 9.2 cluster, if you wish to actually destroy the old data. Or un-install PostgreSQL 9.2. Or modify the config file (don't remember the name right now) in /etc/postgresql/9.2/ that controls whether Pg starts or not. It's called something like start.conf or pg_ctl.conf or something.

You may also want to reverse the configured ports so your new 9.3 runs on 5432 and your not-started-by-default 9.2 tuns on 5433. That is in postgresql.conf.

Craig Ringer
  • 307,061
  • 76
  • 688
  • 778
  • 1
    Thanks for the response. In the /etc/postgresql/9.2/main/ directory, there is start.conf. If you change the single line in that file from 'auto' to 'disabled' then, /etc/init.d/postgresql start will not start 9.2. – Steve Harman Jan 01 '14 at 16:55
  • @SteveHarman So that has done the trick? Was there more to what you were after? – Craig Ringer Jan 01 '14 at 23:00
  • Thanks Craig. Yes, that has done the trick (that I needed at least) – Steve Harman Jan 04 '14 at 01:41
0

Steve Harman's response worked perfectly for me, too:

Thanks for the response. In the /etc/postgresql/9.2/main/ directory, there is start.conf. If you change the single line in that file from 'auto' to 'disabled' then, /etc/init.d/postgresql start will not start 9.2. – Steve Harman Jan 1 at 16:55

On the other hand, just fyi, the command output is that both versions of the server are starting (which is not true and is coming from the service starting scripts)

user@server:/etc/postgresql/9.3/main$ sudo service postgresql start
 * Starting PostgreSQL 9.1 database server
   ...done.
 * Starting PostgreSQL 9.3 database server
   ...done.
codenoob
  • 800
  • 10
  • 24