From 4e15a3969a082b3dfecb28cd3a8d294a198e6132 Mon Sep 17 00:00:00 2001 From: Alex Vandiver Date: Wed, 8 May 2024 00:03:01 +0000 Subject: [PATCH] docs: Document PostgreSQL multiple database host failover. Added in bd82c6edf998, this is based on libpq's functionality[^1]. [^1]: https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-MULTIPLE-HOSTS --- docs/production/postgresql.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/docs/production/postgresql.md b/docs/production/postgresql.md index b3ae52471a..ddd4d0a5db 100644 --- a/docs/production/postgresql.md +++ b/docs/production/postgresql.md @@ -194,6 +194,17 @@ If you are using password authentication, you can set a `postgresql_replication_password` secret in `/etc/zulip/zulip-secrets.conf`. +To make fail-over to the warm-standby faster, without requiring a restart of +Zulip services, you can configure Zulip with a comma-separated list of remote +PostgreSQL servers to connect to; it will choose the first which accepts writes +(i.e. is not a read-only replica). In the event that the primary fails, it will +repeatedly retry the list, in order, until the replica is promoted and becomes +writable. To configure this, in `/etc/zulip/settings.py`, set: + +```python3 +REMOTE_POSTGRES_HOST = 'primary-database-host,warm-standby-host' +``` + [warm-standby]: https://www.postgresql.org/docs/current/warm-standby.html [wal-g]: export-and-import.md#database-only-backup-tools