Sharding — Reducing the Number of Shards posted Tue Oct 06 2020 by The Neighbourhoodie CouchDB Team
In contrast to increasing the number of shards for a database, reducing the number of shards is not a built-in operation. In addition, as shard splitting is only available in CouchDB 3.x and later, this advice is good for version 2.x as well.
Neighbourhoodie has built the
couch-continuum tool that automates the bulk changing of database parameters, including the number of shards for a database:
This tool can both increase and decrease the number of shards for a database in both CouchDB 2.x and 3.x.
There is just one caveat: it can not operate without taking the original database offline for the duration of its restore. So you can only do this during a maintenance window.