-
Notifications
You must be signed in to change notification settings - Fork 11
Database Upgrade
Tom Hughes edited this page Jan 4, 2023
·
14 revisions
- Take site offline
- Stop chef on all database servers
- Let osmdbt on master capture logs for most recent changes
- Disable osmdbt replication on planet server with
osmdbt-disable-replication -c /etc/replication/osmdbt-config.yaml - 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.rbin chef to new version - Run chef on master, wait for run to complete and check postgres is up and working
- Analyse database
vacuumdb --all --verbose --analyze-in-stages --jobs=20
- Reindex users
reindexdb --table=users openstreetmap
- Stop chef on master
- Stop postgres on master
- Sync tablespaces to slaves
cd /var/lib/postgresqlsudo rsync --verbose --archive --delete --hard-links --size-only --no-inc-recursive --no-inc-recursive --copy-dirlinks --keep-dirlinks <old-version> <new-version> root@slave:/var/lib/postgresqlcd /store/postgresqlsudo rsync --verbose --archive --delete --hard-links --size-only --no-inc-recursive --no-inc-recursive --copy-dirlinks --keep-dirlinks openstreetmap root@slave:/store/postgresqlsudo rsync --verbose --archive --delete --hard-links --size-only --no-inc-recursive --no-inc-recursive --copy-dirlinks --keep-dirlinks ssd root@slave:/store/postgresql
- 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> mainon each machine - Enable osmdbt replication on planet server with
osmdbt-enable-replication -c /etc/replication/osmdbt-config.yaml - Bring site online