How do you stop PostgreSQL from starting a cluster under linux (Ubuntu)

I've spent some more time on Google and as a result of an argument for another answer, read through the startup scrips. This turns out to be quite simple:


Disabling the old cluster

Under the config files for each cluster (/etc/postgresql/<version>/<cluster>/) there is a file called start.conf. This contains just one uncommented word - auto. By simply changing this to manual the startup scripts will ignore this cluster completely.

To start a cluster manually you can use pg_ctlcluster <version> <name>.


Renaming the old / new cluster

The PostgreSQL scripts work on the basis that the postgresql.conf file for EVERY cluster can be found at /etc/postgresql/<version>/<cluster name>/postgresql.conf.

It's tempting to think that you can simply rename this directory to change the cluster name (keeping the version name the same). Actually it nearly is that simple.

However postgresql.conf references a couple of other files such as pg_hba.conf. These will also get moved when you rename the directory. So after renaming the directory you also need to update these references in postgresql.conf.

There is no requirement to rename the data directory, however it helps maintain your sanity if the data directory name follows that of the cluster. Again if you rename this, remember to update it in the postgresql.conf.