first draft of a pgsql maint script
This commit is contained in:
parent
76897f9f59
commit
906cb61a84
29
pgsql_maint202412.sh
Normal file
29
pgsql_maint202412.sh
Normal file
@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# This script does the following things:
|
||||
# - Stop mastodon services
|
||||
# - Stop postgresql service
|
||||
# - Delete AWS S3 pgbackrest repository
|
||||
# - Install postgresql-16
|
||||
# - Upgrade existing cluster to postgresql-16
|
||||
# - Start postgresql
|
||||
|
||||
# Stop relevant services
|
||||
systemctl stop mastodon-* && systemctl stop postgresql
|
||||
|
||||
# Delete deprecated AWS repository from pgbackrest stanza
|
||||
sudo -u postgres pgbackrest --stanza=main --log-level-console=info stop && \
|
||||
sudo -u postgres pgbackrest --stanza=main --repo=1 --log-level-console=info stanza-delete
|
||||
|
||||
# Install Postgres 16 and make sure postgresql is stopped again
|
||||
apt install -y postgresql-16 && systemctl stop postgresql
|
||||
|
||||
# Upgrade pgsql14 cluster to 16
|
||||
pg_renamecluster 16 main main_pristine && pg_upgradecluster --method=link 14 main
|
||||
|
||||
# Start postgresql
|
||||
systemctl start postgresql
|
||||
|
||||
# REMAINING TODO ITEMS
|
||||
# - Upgrade stanza in pgbackrest - https://pgbackrest.org/user-guide.html#upgrade-stanza
|
||||
# systemctl start mastodon-* and verify it is working.
|
Loading…
Reference in New Issue
Block a user