Seamless Region Failover in Nomad with Handoff – A Practical Guide
Learn how Nomad’s Handoff feature lets you migrate running jobs across regions automatically, reducing downtime during regional failures. Step‑by‑step guide, example config, and trade‑offs included.
02 Nov 2025, 21:46 UTC

The Problem: Region Failures in Distributed Nomad Clusters
Running a Nomad cluster across multiple regions is common in highly available environments. When a region’s leader node crashes or a data center is lost, all jobs that were running there suddenly become unreachable. A manual redeploy in another region is time‑consuming, risks configuration drift, and can lead to a brief outage that affects SLAs.
Handoff: What It Is and Why It Matters
Handoff is a built‑in Nomad feature that automatically migrates a running job from a failing or drained region to another healthy region. It preserves the job’s allocation state, including task volumes, environment variables, and Consul service registrations. The feature is available in Nomad 1.5+ and requires a multi‑region cluster with Consul integration.
Key Prerequisites
- Nomad cluster configured for at least two regions (e.g., region-a and region-b).
- Consul agents running in each region and registered with Nomad.
- Client drivers that support persistent storage (Docker with volume mounts, for example).
- Nomad version ≥ 1.5 and enabled Handoff API (default in recent releases).
Step‑by‑Step Handoff Setup
- Define the Job with Handoff Enabled
job "webapp" { type = "service" group "app" { task "server" { driver = "docker" config { image = "example/webapp:latest" volumes = ["/data:/app/data"] } } } handoff { enabled = true } }Place the
handoff { enabled = true }stanza anywhere inside the job definition. This tells Nomad to consider this job for automatic migration. - Deploy the Job to Region A
# Run on a machine with Nomad CLI configured for region-a nomad job run webapp.nomadVerify the job is running:
nomad status webapp. The output should show allocations with theregion = "region-a"field. - Simulate Region Failure
# Stop the leader in region-a (or drain all nodes) nomad server stop --region=region-aIn a real environment, you would see the leader election fail and the cluster mark region‑a as failed.
- Check Migration in Region B
# Verify that the job has appeared in region-b nomad status webapp --region=region-bThe status should list a new allocation with
region = "region-b". The allocation ID will be different from the original, indicating a fresh allocation in the new region. - Validate Service Registration in Consul
# List services in region-b consul catalog services --region=region-bThe service should be registered under the new region and no longer appear under region‑a. This confirms that Consul’s service catalog has been updated automatically.
Verifying Migration and Handling Edge Cases
| Check | Command | Expected Result |
|---|---|---|
| Job Allocation | nomad status webapp --region=region-b | Allocation exists, region-b |
| nomad alloc status <alloc-id> --region=region-b | Running, healthy | |
| consul catalog services --region=region-b | Service present | |
| consul catalog services --region=region-a | Service absent |
If the target region lacks sufficient resources, the allocation will remain pending and the job will not start. In that case, you must scale the target region or manually intervene.
Trade‑offs & Limitations
- Data Consistency – Handoff does not copy data between regions. For stateful services that write to local volumes, the data must already be replicated (e.g., via shared storage or database replication). Otherwise, the migrated job will lose local state.
- Temporary Downtime – While the allocation is being recreated in the target region, the service may be unavailable for a few seconds. For zero‑downtime requirements, consider using a load balancer that can keep the old allocation alive until the new one is healthy.
- Consul Dependency – Mis‑configured Consul agents can lead to orphaned services after migration. Always verify that each region’s Consul is healthy before enabling handoff.
- Single‑Region Clusters – Handoff is ignored if the cluster is not multi‑region. Ensure
multi_region = trueis set in the Nomad configuration.
Actionable Next Steps
- Upgrade to Nomad 1.5+ if you haven’t already.
- Configure a multi‑region cluster with Consul integration.
- Add the
handoff { enabled = true }stanza to critical jobs. - Test migration in a staging environment by stopping a region and observing the job status in another.
- Implement monitoring alerts:
nomad statusmetrics and Consul health checks should trigger on allocation failures. - Document the migration process for your ops team, including rollback steps if the target region cannot accept the allocation.
By enabling Handoff, you give your Nomad workloads resilience against regional outages without manual redeploys. The feature works best when jobs use shared or replicated storage and when the target region is provisioned to absorb the migrated workload.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.