In our previous PostgreSQL upgrade blog post, we have shown how to upgrade on Windows machines, and this post is valid for the newer PostgreSQL versions as well. However, this time we are focusing on Debian, as there is a little bit of difference.
Remember, the procedure we are going to cover now can be reused on different versions, not just 13->14. We have tested 11->14 upgrade and it worked marvelously.
First, install the newer version of Postgres 14 and then execute the command below to confirm that you have multiple Postgres instances:
Ver Cluster Port Status OwnerData directoryLog file
13main5432 online postgres /var/lib/postgresql/13/main log/postgresql-%Y-%m-%d.log
14main5433 online postgres /var/lib/postgresql/14/main /var/log/postgresql/postgresql-14-main.log
The upgrade procedure is the following:
1. Drop the newer version data:
2. Start the upgradecluster procedure:
3. Once the operation is completed, double-check whether it is working
4. Remove the old version:
This pretty much illustrates a different way to upgrade the cluster. Of course, there are numerous options with upgradecluster command- from version number to folder where it will store new data. However, this is maybe a topic for another blog post. Stay tuned.