-
Notifications
You must be signed in to change notification settings - Fork 12
Database Upgrade
Tom Hughes edited this page Feb 27, 2022
·
13 revisions
- Take site offline
- Stop chef on all database servers
- Stop postgres on master
- Stop postgres on slaves
- Ugrade master
sudo pg_upgradecluster -v <new-version> -m upgrade -k <old-version> main
- Update
cookbooks/db/attributes/default.rb
in chef to new version - Run chef on master, wait for run to complete and check postgres is up and working
- Stop chef on master
- Stop postgres on master
- Sync tablespaces to slaves
cd /var/lib/postgresql
sudo rsync --verbose --archive --delete --hard-links --size-only --no-inc-recursive --keep-dirlinks <old-version> <new-version> root@slave:/var/lib/postgresql
/store/arrays/nvme
sudo rsync --verbose --archive --delete --hard-links --size-only --no-inc-recursive --keep-dirlinks postgresql-openstreetmap root@slave:/store/arrays/fast
sudo rsync --verbose --archive --delete --hard-links --size-only --no-inc-recursive --keep-dirlinks postgresql-ssd root@slave:/store/arrays/ssd
- Start postgres on master and check postgres is up and working
- Run chef on slaves, wait for run to complete and check postgres is up and working
- Drop old cluster
sudo pg_dropcluster <old-version> main
on each machine - Bring site online