In this guide, you’ll learn how to safely demote the existing primary cluster in a Vault Disaster Recovery (DR) replication setup and then promote the DR secondary cluster to become the new primary. This procedure ensures minimal downtime and maintains data integrity across clusters.Documentation Index
Fetch the complete documentation index at: https://notes.kodekloud.com/llms.txt
Use this file to discover all available pages before exploring further.
- Vault version 1.9+ installed on both clusters
- Network connectivity between primary and secondary
- Root or privileged token access on both clusters
jqinstalled for JSON formatting
Quick Reference
| Step | Action | Command |
|---|---|---|
| 1 | Verify DR replication status on primary | vault read sys/replication/dr/status |
| 2 | Demote primary to secondary | vault write -f sys/replication/dr/primary/demote |
| 3 | Generate DR operation token on secondary | vault operator generate-root -dr-token |
| 4 | Promote secondary to primary | vault write sys/replication/dr/secondary/promote |
| 5 | Verify the new primary status and peers | vault operator raft list-peers |
1. Verify Current DR Replication Status
On your primary cluster, confirm that the DR replication relationship is healthy:connection_status is not connected, troubleshoot network connectivity and TLS settings before proceeding.
2. Demote the Current Primary Cluster
Demoting the primary ensures there is no conflict when promoting the secondary.Demoting the primary will briefly interrupt Vault service on that cluster. Ensure maintenance windows and inform your team.
3. Generate a DR Operation Token on the Secondary
Switch context to your DR secondary cluster to create a one-time operation token required for promotion.-
Initiate token generation
You’ll receive an operation nonce.
-
Unseal with quorum of unseal keys
Provide any 3 of 5 unseal keys from the former primary:Vault returns an encoded token, e.g.: -
Decode the DR operation token
Output:
The DR operation token is time-limited and can only be used once to promote the secondary.
4. Promote the Secondary to Primary
Using the decoded token, promote the DR secondary:5. Verify the New Primary
-
Authenticate (if needed):
-
List Raft peers:
Expected:
-
Test secrets engines:
Links and References
- HashiCorp Vault DR Replication
- Vault Operator Commands
- Vault API: sys/replication/dr
- HashiCorp Vault GitHub