DR implementation: MySQL Flexible Server (Temporal)
Tier: T1. MySQL is the persistence and visibility store for the self-hosted Temporal cluster (ADR-0019). It holds workflow histories, mutable state, timers, task queues, and search attributes. If MySQL is lost, every workflow stops. Temporal resumes them from their history when MySQL returns.
Current configuration
| Environment | Server | HA | Backup retention | Geo-backup |
|---|---|---|---|---|
prd | mysql-zge-prd | Zone-redundant, healthy | 30 days | Enabled |
gma | Same naming | Zone-redundant | 30 days | Enabled |
apa | Same naming | None | 7 days | Not required |
MySQL 8.4 holds both the persistence and the visibility schemas. Elasticsearch
visibility is optional and not deployed. The Temporal server runs in the
coapp-zge Container Apps environment.
Failure scenarios
| Scenario | Behaviour | Recovery | RTO and RPO |
|---|---|---|---|
| Zone loss | Automatic HA failover. Temporal reconnects, and workflows continue | Automatic | Minutes. RPO 0 |
| MySQL unavailable | Workflows pause. Activities that are running finish, but their results cannot be recorded until MySQL returns | Microsoft-managed | Until recovery. RPO 0 |
| Logical corruption of Temporal data | Workflows fail or behave wrongly | Prefer a targeted fix: terminate and restart the affected workflows. A full PITR is the last resort | Hours |
| Full PITR of the Temporal database | Temporal goes back in time. Workflow progress after the restore point is lost, and activities may run again | PITR to a new server. Re-point the Temporal server. Then check the side effects of the replayed activities | T1 target not set. RPO is the PITR point |
| Server deleted | Temporal stops | Restore the deleted server within Microsoft’s recovery window | Hours |
Recovery procedures
Prefer a targeted repair
Owner: Ziege team
Use the Temporal CLI to find the affected workflows by search attribute. Then reset them to an earlier event, or terminate and restart them. This keeps the rest of the workflows as they are.
Full PITR, if a targeted repair is not possible
Owner: Ziege team, approved by the destructive restore approver
Scale the Temporal workers to zero. Run az mysql flexible-server restore
to <server>-rst-<yyyymmdd>. Apply the network and parameter settings from
Terraform, and enable zone-redundant HA on the new server. Re-point the
Temporal server’s connection setting. Start the server, then start the workers
step by step, and watch for duplicate side effects.
Rules
- Zone-redundant HA MUST be on in
gmaandprd.apaandbtaMAY run without HA. - Backup retention is set by data protection.
- Temporal activities MUST be idempotent.
- The server MUST have
prevent_destroyand aCanNotDeletelock.
Validation and drills
- Twice a year in
gma: run a PITR of the Temporal store, start the cluster on it, and confirm that the workflows resume. Record the duplicate activities. - Zone-down test: measure the HA failover time and the workflow latency during it.