I just finished setting up a CouchDB cluster with 3 nodes. Now I am trying to shard my data to scale the database, this is what I did to create a database with 2 shards and 2 replicas:
Create a database with the command
$ curl -X PUT "http://username:login@myhost:5984/test?q=2&r=1&w=1&n=2
Received a true message.
Create 50 documents in database "test"
However, When I checked the all three nodes, I found each nodes has a complete copy of all 50 documents. When I deleted one of the documents from node 1, this document got deleted in all three nodes' test database. It seems that cluster works fine but not the way I want.
In my opinion, if I set shards as 2 and replicas as 2, the database will be divided into two parts, each parts will be saved in two nodes. For example, I got a list [1,2,3,4]. I am going to store it in my database just created, it is possible that
The node1 has :
The node2 has:
The node3 has:
but definitely not [1,2,3,4] [1,2,3,4] [1,2,3,4] respectively in three nodes. Am I right?
If not, why didn't my database partition my 50 documents? My aim is scaling and reliability. It seems that it did not extend my storage at all.