Load balancer in front of replicated couchbase cluster

We have 2 clusters, on different data centers, which are bi-directionally replicated through XDCR. They are typically identical. Our applications are also segregated to each data center and connect to their local cluster.

We are looking to implement a load balancer in front of the clusters so that the applications can still connect to the local cluster, but also connect to the other cluster if we were to have an issue with one of the clusters.

Does anyone have a solution for this?



Clusters are made of nodes which contain partitions, and the partitions contain documents. A function maps documentIds to partitions, and the cluster has a map of partitions to nodes. So the SDK uses the function and the map to determine which node contains a specific document. However, the cluster maps for the two clusters may not be identical. So if the SDK uses the map from ClusterA, but the load-balancer sends the request to a node in ClusterB - that node may not contain the document.

Your application would need to create Cluster objects for each cluster, and then a wrapper could use either one cluster or the other. It could use a circuit-breaker for the local cluster - so that if the local cluster became available, the circuit-breaker would open and requests would be sent to the other cluster until the circuit-breaker closed again.