Fedora 33 will upgrade your PostgreSQL database from 12.6~ to 13.2-6.
Since this is a major upgrade it will require that you upgrade your database.
Here is how to do it:
- Install the upgrade utilities: dnf install postgresql-upgrade
- Become user postgres: sudo su - postgres
- Rename the data directory: mv /var/lib/pgsql/data/ /var/lib/pgsql/data_12.6/
- As root, initialize your 13.2 database: sudo postgresql-setup --initdb --unit postgresql
- As user postgres, Copy your pg_hba.conf: cp /var/lib/pgsql/data_12.6/pg_hba.conf /var/lib/pgsql/data/pg_hba.conf
- To avoid any potential password issues, temporarily change "md5" to "trust" in both pg_hba.conf files
- Run the upgrade process: pg_upgrade -b /usr/lib64/pgsql/postgresql-12/bin/ -B /usr/bin/ -d data_12.6/ -D data
- Change "trust" to md5" if you changed in step 6
- Enable your postgresql.service: sudo systemctl enable postgresql.service
- Start your postgresql.service: sudo systemctl start postgresql.service
- Run the analyse_new_cluster.sh script as suggested
- Run the delete_old_cluster.sh script as suggested
Note: When running commands as the postgres user, it is
assumed you are running them from the postgres user $home directory.
This will be your location after you enter the command in step 2. If
you for some reason change to another directory from this userid, just
remember to enter: cd $home before entering any postgresql
commands - otherwise you may not be able to execute the desired command,
or may receive a permission error.
Thank you. Your procedure works!
ReplyDeleteOnly a note: The step 4 starts the postmaster process but the pg_upgrade command (step 7) requires to stop it.
Thank you again.