doc:appunti:linux:sa:postgresql_upgrade_11_to_13
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revisionNext revisionBoth sides next revision | ||
doc:appunti:linux:sa:postgresql_upgrade_11_to_13 [2022/07/07 11:05] – created niccolo | doc:appunti:linux:sa:postgresql_upgrade_11_to_13 [2022/07/07 11:42] – [Cleanup] niccolo | ||
---|---|---|---|
Line 12: | Line 12: | ||
The PostgreSQL database will upgrade from version **11.16** to **13.7**, the **PostGIS library** will upgrade from version **2.5.1** to **3.1.1**. | The PostgreSQL database will upgrade from version **11.16** to **13.7**, the **PostGIS library** will upgrade from version **2.5.1** to **3.1.1**. | ||
- | Once the system is fully upgraded, you will find that your databases still run on the older **11/main cluster**. Switch to the **postgres** user and run the **pg_lsclusters** command: | + | ===== After the system upgrade ===== |
+ | |||
+ | Once the system is fully upgraded, you will find that your databases still run on the older **11/main cluster**. Switch to the **postgres** user and run the **pg_lsclusters** command | ||
< | < | ||
Line 41: | Line 43: | ||
</ | </ | ||
+ | ===== Execute pg_upgradecluster ===== | ||
+ | |||
+ | Connect to the new cluster and verify that it is empty (only the system databases '' | ||
+ | |||
+ | < | ||
+ | psql --cluster 13/main | ||
+ | postgres=# \l | ||
+ | </ | ||
+ | |||
+ | So you can remove the 13/main cluster ad perform the automatic upgrade: | ||
+ | |||
+ | < | ||
+ | pg_dropcluster --stop 13 main | ||
+ | pg_upgradecluster 11 main | ||
+ | </ | ||
+ | |||
+ | The old cluster was moved to port **5433/ | ||
+ | |||
+ | < | ||
+ | pg_lsclusters | ||
+ | Ver Cluster Port Status Owner Data directory | ||
+ | 11 main 5433 down | ||
+ | 13 main 5432 online postgres / | ||
+ | </ | ||
+ | |||
+ | Connect to the new cluster and verify that your geographic databases were upgraded to the new PostGIS extension: | ||
+ | |||
+ | < | ||
+ | psql --cluster 13/main | ||
+ | postgres=# \connect strade | ||
+ | strade=# \dx | ||
+ | List of installed extensions | ||
+ | Name | Version | | ||
+ | ---------+---------+------------+--------------------------------------------------------------------- | ||
+ | | ||
+ | | ||
+ | </ | ||
+ | |||
+ | ===== Cleanup ===== | ||
+ | |||
+ | All the above operations were made using the **posgres** user (not '' | ||
+ | |||
+ | < | ||
+ | pg_dropcluster 11 main | ||
+ | pg_ctlcluster 13 main stop | ||
+ | </ | ||
+ | |||
+ | We stopped the new cluster because we need to start it again using the **systemd** subsystem, under the controlo of the **root** user: | ||
+ | |||
+ | < | ||
+ | systemctl daemon-reload | ||
+ | systemctl enable postgresql@13-main | ||
+ | systemctl start postgresql@13-main | ||
+ | </ |
doc/appunti/linux/sa/postgresql_upgrade_11_to_13.txt · Last modified: 2023/02/03 12:38 by niccolo