























The Redis Active-Active architecture supports geographically distributed applications, providing real-time performance when apps are co-located with an Active-Active database member and ensuring strong eventual consistency through the Conflict-Free Replicated Datatype (CRDT) based conflict resolution.
In addition to this unique support, Redis Active-Active can be used for disaster recovery, with many use cases successfully developed thanks to its strong eventual consistency model. Several options exist for designing a disaster recovery strategy to ensure that the application can connect to an available Active-Active database member and execute workloads at any time. Load balancing solutions, global traffic managers, or software proxy solutions connect apps to a healthy dataset replica, increase application resiliency, and maximize service availability, especially for multi-region deployments.
Alongside infrastructure-based approaches such as load balancers, DNS routing, and proxies, failover can also be handled in the client. In Redis, this is supported through client-side geographic failover, which lets a client library monitor multiple Active-Active member endpoints and switch to the next healthy endpoint when the current one becomes unavailable.
With client-side geographic failover, client libraries can detect database failures based on a combination of the circuit breaker pattern and a configurable health check mechanism, and redirect the workload to the next healthy endpoint. The overall experience is that the application does not perceive any disruption and connects to the desired Redis A-A database member.

Jedis and redis-py support client-side geographic failover, and now it has been added to Lettuce as well. See the Lettuce 7.4.0 release notes to learn more.
The client-side geographic failover feature includes the following components and configurations:
Client-side geographic failover complements existing mechanisms for handling disconnections, latency spikes, and unstable connectivity. It maximizes availability while abstracting the underlying complexity from the application.
To test, first choose the desired client library: Jedis, Lettuce, or redis-py (more official client libraries will be supported soon), and read the docs to get started. Testing the feature is as easy as configuring the endpoints and using the default configuration. A quick example using redis-py follows.
python3 -m venv testvenvsource testvenv/bin/activatepip install redispip install pybreakerRestart the services on the cluster and observe the log.
This simple test application will log the two main events. First, the failure is detected, and a failover to the Redis Server instance running on port 15001 is done. When the former database member is operational again, the health check detects it, and failback is executed.
Remember that when using client-side geographic failover, you can achieve a more refined failback strategy by configuring the lag-aware health check, which offers the desired data consistency on failback.
Learn more about this feature from the docs:
And stick around, as we’re launching this feature for other client libraries.
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。