apache / apache/couchdb

Shard Rebalance Command

Open
#3,865 3 comments 4 reactions 0 assignees View on GitHub
enhancement needs-triage
Dominant language
Erlang
Stars
7k
Forks
1.1k
Avg merge
1d 16h
Merged PRs (30d)
9

Description

## Summary

In the "Moving Shard" section of the documentation (https://docs.couchdb.org/en/stable/cluster/sharding.html#moving-a-shard), it says that "To balance the distribution of shards from existing databases, they must be moved manually."

## Desired Behaviour

In a nutshell, the behavior would be pretty close to what is done on Gluster (See: https://docs.gluster.org/en/latest/Administrator-Guide/Managing-Volumes/#rebalancing-volumes)

Whenever a node is added or removed from the cluster or whenever the `q` or `n` parameter are changed, the user could run a command (or REST call) that would rebalance the entire cluster or a specific database.

In the perfect world, this command could be even called automatically whenever we add or remove a new node or change the `q` or `n` parameters.

## Possible Solution

Unfortunately, I am new to couchDB, so I am not familiar with the codebase.

## Additional context

A couple of reasons why this is important:

- Moving shards manually is very error prone
- Moving shards manually is time consuming.
- The current behavior can lead to data loss/inconsistencies if done incorrectly.

I know this is not an easy feature and I am glad to help if possible.

Contributor guide

Open the contributing guide

Research direction

Start by reading the documented "Moving a Shard" section and the linked Gluster rebalancing guidance. The issue does not name CouchDB files, entry points, tests, or a settled command/REST design; clarify whether rebalance should target a cluster or database and which node or q/n changes trigger it. Done would require an agreed and implemented rebalance workflow that avoids the manual shard-move risks described.

Written by the indexing model from the issue text.

Assessment

Tech stack
erlang
Domain
databases, distributed-systems
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.