Sunday , December 22 2024

UPGRADE POSTGRESQL 10 To 11

We will upgrade POSTGRESQL 10 To 11 on CENTOS in this article. Before I start the upgrade process, I want to make the following critical warning:

You will need to re-configure your postgresql.conf and pg_hba.conf files. Because the files will be reset after upgrade.

Install PostgreSQL 11

We are installing Postgresql 11 with the following commands.

initdb

We are performing the initdb operation in the Postgresql 11 database.

Checking Whether the Upgrade is Applicable

We check the applicability of the upgrade with the command below. (with postgresql user)

Stop PostgreSQL 10

If we perform the upgrade without stopping Postgresql 10, we get the following error.

We are stopping Postgresql 10 (with root user)

Upgrade

Then we switch to postgres user and run the upgrade command.(with Postgres user)

We are running the following commands before executing the commands requested from us.

Then we run the commands requested from us.

Delete Old Cluster

Then run the below command. But, be aware that this command delete old cluster. Thats why, be sure that postgresql 11 is working before delete the old cluster.

We remove all packages related to Postgresql10. (with root user)

Upgrade has completed. You can connect to the database and see version 11.

Loading

About Engin Yilmaz

4 comments

  1. There’s some typos, it should have double dash “–”
    /usr/pgsql-10/bin/pg_upgrade –old-bindir=/usr/pgsql-10/bin/ –new-bindir=/usr/pgsql-11/bin/ –old-datadir=/var/lib/pgsql/10/data –new-datadir=/var/lib/pgsql/11/data –check

    also I’m getting this error after executing that:
    could not write to log file “pg_upgrade_internal.log”
    Failure, exiting

    Any ideas on how to workaround that?

  2. Hi Jim,
    Could you please write operating system name and version?
    Also, which user did you try upgrade check command? postgres or other?
    Best Regards,

  3. you should run the below command on tmp. That is, it should be as follows.

    su – postgres

    cd /tmp

    then execute command:

    /usr/pgsql-10/bin/pg_upgrade –old-bindir=/usr/pgsql-10/bin/ –new-bindir=/usr/pgsql-11/bin/ –old-datadir=/var/lib/pgsql/10/data –new-datadir=/var/lib/pgsql/11/data –check

  4. This is a very detail information. Good Job

Leave a Reply

Your email address will not be published. Required fields are marked *