How to create 2 nodes with backup, but without document balance

I have 2 couchbase nodes.

One should backup the other, but I do NOT want the server to balance the documents between them.

So I’ve tried to add them both to one cluster, and set replicas to “disable” on the bucket, but still it balance the documents between those 2 servers.

Then I’ve tried to use the servers as different clusters with replication between them. I’ve also added in the client config those two servers:

When I shut down server1, the requests went to server2, so the backup worked!

BUT i’m not sure if I’m sending a request from a client on server1, it will always choose the nearest server (sending the request always to server1ip).

How can I achieve that ?


When you are creating a Couchbase cluster, this is viewed as a “single” database. The data are always distributed in the same cluster.

So if you want to “backup” automatically the data into other nodes, what you have to use is the the XDCR (Cross Data Center Replication) that will replicate the data from one cluster to another cluster. (as you can see I am not using the word, “node”, since a Couchbase database should be deployed on multipe node.)

I am inviting you to look at the following resources to learn more about this:


Thanks for you comment. How can I use the second cluster I configure as a backup ?
I mean, how can I define that my client will always send requests to cluster A, but will have cluster B as backup ?

Your application connect only to one cluster (IP addresses/hostnames) the other one is here for backup.

You can write some code in your application to connect to the other in case of failure.

Does it make sense?