docs: Document wal-g restore process.

This commit is contained in:
Alex Vandiver
2025-10-14 15:39:40 +00:00
committed by Tim Abbott
parent dd92036550
commit bdb2c921ba

View File

@@ -587,6 +587,53 @@ analysis of recent application-level data changes.
You may also want to adjust the [incremental backups][incremental]
configuration.
### Restoring from wal-g backups
The following steps will restore the database from the latest
backup. Note that this process will _delete your current database_.
1. As `root` on your database host, check your list of backups; the
most recent will be listed at the bottom, and is what will be
restored by the commands below.
```shell
env-wal-g backup-list --pretty
```
1. Stop Zulip, if it is running. On your application host (which may
or may not be different from your database host, depending on your
configuration):
```shell
/home/zulip/deployments/current/scripts/stop-server
```
1. As `root` on your database host, stop PostgreSQL:
```shell
service postgresql stop
```
1. As `root` on your database host, delete the current database, and
restore from the backup. This may take some time, depending on the
size of your database and your connection to your backup storage.
```shell
pg_version=$(crudini --get /etc/zulip/zulip.conf postgresql version)
rm -rf "/var/lib/postgresql/$pg_version/main"
env-wal-g backup-fetch "/var/lib/postgresql/$pg_version/main" LATEST
chown -R postgres.postgres "/var/lib/postgresql/$pg_version/main"
touch "/var/lib/postgresql/$pg_version/main/recovery.signal"
service postgresql start
```
1. As `root` on your application host, flush caches and start Zulip:
```shell
/home/zulip/deployments/current/scripts/setup/flush-memcached
/home/zulip/deployments/current/scripts/start-server
```
[wal]: https://www.postgresql.org/docs/current/wal-intro.html
[archive-timeout]: https://www.postgresql.org/docs/current/runtime-config-wal.html#GUC-ARCHIVE-TIMEOUT
[mobile-push]: ../production/mobile-push-notifications.md