Skip to content

Commit 53fdce1

Browse files
committed
Document maintenance mode
1 parent 27789cf commit 53fdce1

File tree

3 files changed

+39
-0
lines changed

3 files changed

+39
-0
lines changed

docs/administration/.pages

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
nav:
2+
- 'index.md'
3+
- 'clients.md'
4+
- 'config.md'
5+
- 'pools.md'
6+
- 'servers.md'
7+
- '...'

docs/administration/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ The admin database name is [configurable](../configuration/pgdog.toml/admin.md).
2525
| `RESUME` | Resume all pools. Clients are able to check out connections again. |
2626
| `SHOW PREPARED` | List prepared statements currently in the cache. |
2727
| `SHOW QUERY_CACHE` | List statements currently in the AST cache used for query routing. |
28+
| [`MAINTENANCE`](maintenance_mode.md) | Pause all queries to synchronize configuration changes across multiple instances of PgDog. |
2829

2930
## Shutting down PgDog
3031

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Maintenance mode
2+
3+
Maintenance mode pauses queries from all clients so you can synchronize configuration changes across multiple instances of PgDog. This is useful if you're changing the [sharding](../features/sharding/index.md) options.
4+
5+
### How it works
6+
7+
You can turn on maintenance mode by connecting to the [admin](index.md) database and running this query:
8+
9+
```
10+
MAINTENANCE ON;
11+
```
12+
13+
Clients that are currently executing a transaction will be allowed to finish, while all others will be immediately paused. Pausing traffic has the effect of holding query requests inside PgDog's network buffer. To the client, this will seem like the proxy isn't responding.
14+
15+
!!! note
16+
Before enabling maintenance mode, make sure to set the application-level timeouts high enough as to avoid erroring out.
17+
18+
During maintenance mode, you can perform live configuration changes. The following flow is typical and, if performed quickly, won't cause errors or downtime:
19+
20+
1. Make changes to `pgdog.toml` and/or `users.toml`
21+
2. Enable maintenance mode
22+
3. Reload config on all instances of PgDog
23+
4. Disable maintenance mode
24+
25+
#### Turn off maintenance mode
26+
27+
Turning off maintenance mode and resuming all queries can be done with a query:
28+
29+
```
30+
MAINTENANCE OFF;
31+
```

0 commit comments

Comments
 (0)