With Couchbase, on a new document creation, it is possible to create document replicas that are stored on another servers within the cluster. In case of a failure of the current server, document replicas are brought from those secondary servers.
I’ve got a couple of questions here:
- When updates are made to a document, are these updates propagated to the replicas?
- Is failure recovery the only use for such replicas? Can I, say, have one server in the US, one in Australia, and one in Europe, set up a cluster of these servers, and use replicas for faster data access in these locations?
Hey, thanks for the questions.
Here are some answers
Replication happens whenever you make a change to a document, whether that’s the creation of a new document or an update to an existing document. You can tune how many replicas you have and so on but replication happens on any change.
What you’re looking to do is possible but you shouldn’t try it in that way. There are a couple of reasons:
replicas are indeed intended for failure recovery only; Couchbase Server directs reads and writes to the same active copy of a document in order to maintain consistency and there’s no way to write directly to a replica in non-failure scenarios
Couchbase Server nodes expect to have LAN speed connections between each other and will time-out if you subject them to WAN latencies; you also risk a split-brain where the nodes of the cluster could become separated from one another due to problem on the wider internet.
Couchbase Server offers XDCR (cross-data-centre replication) to offer off-site disaster recovery and improved geographic location for faster access globally. Here’s some more on XDXR:
Thanks, Mathew, this helps!