- Newest
- Most votes
- Most comments
When dealing with Amazon DocumentDB in a high availability (HA) configuration, it's important to understand the behavior during failover events, particularly concerning read replicas. Here’s what typically happens when the primary instance fails, and there's only one read replica:
Behavior When the Primary Instance Fails
Primary Instance Failure
-
Promotion of Replica: If the primary instance fails, the read replica will be promoted to become the new primary instance. This process usually takes a few minutes, depending on various factors like the size of your dataset and network latency.
-
Read Query Behavior:
- During Promotion: When the read replica is promoting to primary, any read queries directed to the reader endpoint will fail until the promotion is complete. This is because the reader endpoint will temporarily be unavailable during the promotion process.
- Post-Promotion: Once the promotion is complete, the new primary instance will accept both read and write queries. However, there may be a slight delay as it catches up on any writes that were pending at the time of the failover.
No Additional Replicas
If the reader instance itself fails and there are no additional replicas:
-
Read Queries Fail: Any read queries directed to the reader endpoint will stop working while the reader is unavailable. There won’t be a fallback to the primary instance for reads unless you have explicitly coded your application to handle such failovers by redirecting read queries to the primary endpoint.
-
Handling Failures: It is crucial for your application to have logic for handling such scenarios. Implementing retry mechanisms or fallbacks to the primary instance can help mitigate downtime during replica failures.
Here are some links to the official AWS documentation that provide further details on these behaviors:
Relevant content
- AWS OFFICIALUpdated 2 years ago
