This post is part of our CouchDB Tips Series (RSS) that we publish every week. The team at Neighbourhoodie works on and with CouchDB every day and we are happy to pass on all the tips and tricks we learn along the way. If you like what you see, check out our Professional Services for CouchDB, including production support and training. If you want to continuously ensure that your CouchDB is running optimally, sign up for Opservatory, our 24/7 CouchDB analysis and diagnostics tool.
This advice is only true for CouchDB 3.0.0 or later. Next week, we’ll cover increasing the number of shards in CouchDB 2.x.
Increasing the number of shards in CouchDB is implemented by a technique called shard splitting. It allows you to specify for any one shard in a database to be split into two equal-sized shards.
CouchDB does all the hard work for you: a single request to the /_reshard endpoint will start the process. Shard splitting is a background process that can go on while your CouchDB cluster is fully operational. Once the split shards are available, CouchDB starts using them to serve requests instead of the original shard, which then gets deleted.
Note that shard copies are replicated across your cluster. We recommend you split one shard at a time. In addition, we recommend to split all shards of a database around the same time in order to guarantee consistent performance.