postgresqlupgrade
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| postgresqlupgrade [2024/03/01 15:05] – created z0hpvk | postgresqlupgrade [2025/03/08 22:24] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 2: | Line 2: | ||
| ==== Using pg_upgrade ==== | ==== Using pg_upgrade ==== | ||
| + | https:// | ||
| - | < | + | < |
| / | / | ||
| --new-datadir=/ | --new-datadir=/ | ||
| Line 14: | Line 15: | ||
| Upgrade Streaming Replication server. \\ | Upgrade Streaming Replication server. \\ | ||
| - | < | + | < |
| rsync --verbose --archive --delete --hard-links --size-only --no-inc-recursive --human-readable | rsync --verbose --archive --delete --hard-links --size-only --no-inc-recursive --human-readable | ||
| 10 14 postgres@postgres02-upgrade:/ | 10 14 postgres@postgres02-upgrade:/ | ||
| </ | </ | ||
| + | |||
| + | ==== Using pg_dumpall ==== | ||
| + | https:// | ||
| + | |||
| + | If necessary, create a new instance … \\ | ||
| + | <code bash> | ||
| + | pg_createcluster -d / | ||
| + | </ | ||
| + | |||
| + | On postgres-test, | ||
| + | Copy the pg_hba.conf and postgresql.conf files from the old instance to the new one … \\ | ||
| + | <code bash> | ||
| + | cp / | ||
| + | cp / | ||
| + | </ | ||
| + | |||
| + | Edit the postgresql.conf and update relevant entries to 14/doob. \\ | ||
| + | Restart the new PostgreSQL 14 instance … \\ | ||
| + | <code bash> | ||
| + | sudo systemctl restart postgresql@14-doob | ||
| + | </ | ||
| + | |||
| + | Copy data from the old instance to the new using the following command … \\ | ||
| + | <code bash> | ||
| + | pg_dumpall -p 5432 -U postgres -d postgres | psql -p 5434 -U postgres -d postgres | ||
| + | </ | ||
| + | |||
| + | If you wish to test the above process again then delete the cluster and begin again from the start … \\ | ||
| + | <code bash> | ||
| + | pg_dropcluster 14 doob --stop | ||
| + | </ | ||
| + | Otherwise, stop the old instance and then configure the new instance to use port 5432 and restart. | ||
postgresqlupgrade.1709305506.txt.gz · Last modified: (external edit)
