postgresqlupgrade
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
postgresqlupgrade [2024/03/01 15:09] – z0hpvk | postgresqlupgrade [2025/03/08 22:24] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 4: | Line 4: | ||
https:// | https:// | ||
- | < | + | < |
/ | / | ||
--new-datadir=/ | --new-datadir=/ | ||
Line 15: | 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:/ | ||
Line 24: | Line 24: | ||
If necessary, create a new instance … \\ | If necessary, create a new instance … \\ | ||
- | < | + | < |
pg_createcluster -d / | pg_createcluster -d / | ||
</ | </ | ||
Line 30: | Line 30: | ||
On postgres-test, | On postgres-test, | ||
Copy the pg_hba.conf and postgresql.conf files from the old instance to the new one … \\ | Copy the pg_hba.conf and postgresql.conf files from the old instance to the new one … \\ | ||
- | < | + | < |
cp / | cp / | ||
cp / | cp / | ||
Line 37: | Line 37: | ||
Edit the postgresql.conf and update relevant entries to 14/doob. \\ | Edit the postgresql.conf and update relevant entries to 14/doob. \\ | ||
Restart the new PostgreSQL 14 instance … \\ | Restart the new PostgreSQL 14 instance … \\ | ||
- | < | + | < |
sudo systemctl restart postgresql@14-doob | sudo systemctl restart postgresql@14-doob | ||
</ | </ | ||
Copy data from the old instance to the new using the following command … \\ | Copy data from the old instance to the new using the following command … \\ | ||
- | < | + | < |
pg_dumpall -p 5432 -U postgres -d postgres | psql -p 5434 -U postgres -d postgres | 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 … \\ | If you wish to test the above process again then delete the cluster and begin again from the start … \\ | ||
- | < | + | < |
pg_dropcluster 14 doob --stop | pg_dropcluster 14 doob --stop | ||
</ | </ | ||
Otherwise, stop the old instance and then configure the new instance to use port 5432 and restart. | Otherwise, stop the old instance and then configure the new instance to use port 5432 and restart. |
postgresqlupgrade.1709305785.txt.gz · Last modified: 2025/03/08 22:23 (external edit)