6

I upgraded my postgresql to 9.3 following the instruction found here

When I run sudo service postgresql start

it shows

 * Starting PostgreSQL 9.1 database server
   ...done.
 * Starting PostgreSQL 9.3 database server
   ...done.

I just want to use 9.3 now, (don't even need to start 9.1) and how do I do that?

2 Answers 2

3

First check the status, it should look something like this:

$ sudo pg_lsclusters
Ver  Cluster Port Status Owner     Data directory                Log file
9.1  main    5432 online postgres  /var/lib/postgresql/9.1/main  /var/log/postgresql/postgresql-9.1-main.log
9.3  main    5433 online postgres  /var/lib/postgresql/9.3/main  /var/log/postgresql/postgresql-9.3-main.log

Stop the old version:

sudo systemctl stop [email protected]

Then make sure to test that you can reach the new version, and that your data is actually there (even if pg_upgrade reported no errors, please check!).

To delete the old version, including the old data directory, run:

sudo apt purge postgresql-9.1

You should now only have the new version left:

$ sudo pg_lsclusters
Ver  Cluster Port Status Owner     Data directory                Log file
9.3  main    5433 online postgres  /var/lib/postgresql/9.3/main  /var/log/postgresql/postgresql-9.3-main.log
1
  • 1
    You might also want to set the port back to 5432, the standard. The upgrade uses 5433 so both old and new databases may run simultaneously (so you can verify that the upgrade worked and you got all your data migrated).
    – ubfan1
    Jul 28, 2021 at 15:37
1

The auto-start of a specific PostgreSQL cluster is specified by its start.conf file.
For a postgresql 9.1 main cluster, it's /etc/postgresql/9.1/main/start.conf.

See the comments at the beginning of the file:

# Automatic startup configuration
# auto: automatically start/stop the cluster in the init script
# manual: do not start/stop in init scripts, but allow manual startup with
#         pg_ctlcluster
# disabled: do not allow manual startup with pg_ctlcluster (this can be easily
#           circumvented and is only meant to be a small protection for
#           accidents).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .