Apache CouchDB recovery

A CouchDB database is complete only when every shard range and its authoritative revisions are accounted for.

CouchDB splits clustered databases into shard ranges and distributes replica copies across nodes. Each shard is a separate CouchDB file, while the _dbs metadata records ranges, nodes, suffixes, and placement history.

Understand the symptom

A healthy-looking replica may be older, divergent, or missing revisions that exist on another node.

WHY

What is happening

The q setting determines shard ranges and n determines replica copies. Moving or replacing shards requires coordinated file transfer and matching _dbs changelog, by_node, and by_range entries. CouchDB warns that inconsistent placement metadata can irreparably corrupt the cluster, so recovery should compare revision trees before any replica is declared authoritative.

What you may see

Symptoms that change the recovery path.

01

Some document IDs return not found

The shard range responsible for those IDs may be unavailable.

02

Database appears on some nodes only

Placement metadata and physical shard files may disagree.

03

One replica is much smaller or older

It may lack recent revisions or attachments.

04

Database was deleted

Soft-delete recovery may exist only if enable_database_recovery was configured before deletion.

Protect the source

Actions that can make the situation worse.

01

Editing _dbs incorrectly corrupts placement

Changelog, by_node, and by_range must remain consistent.

02

Copying one shard can erase newer revisions

Replica generation must be compared before replacement.

03

Resharding during recovery changes boundaries

New jobs make it harder to match physical files to the original ranges.

Do this now

Safe steps before evaluation.

01

Stop writes and resharding

Pause clients, compaction, cleanup, shard moves, and cluster-membership changes.

02

Acquire every node

Copy data/shards, data/.shards, system databases, configs, and logs.

03

Export placement metadata

Record q, n, suffixes, changelog, by_node, by_range, and membership.

04

Preserve revisions and attachments

Do not compact or purge tombstones needed to reconcile document history.

NEPFOSYS process

How a data-first evaluation proceeds.

01

Shard-range inventory

NEPFOSYS maps every range, replica file, node, suffix, and metadata revision.

02

Revision-tree comparison

Conflicts and newest readable generations are evaluated on copies.

03

Controlled database reconstruction

Complete ranges are assembled and validated through document and attachment checks.

A clear next step

Preserve the original device before another repair or recovery attempt.

Start a case with the exact symptoms, incident timeline, prior attempts, encryption details, and the files that matter most. NEPFOSYS will route the case to the appropriate DFW intake or nationwide mail-in path.

Start with a case review

Questions, answered

What customers ask before starting.

Can another replica always replace a missing shard?

Only if it contains the required revisions and attachments; compare generations first.

Does CouchDB automatically rebalance old databases after adding a node?

No. Existing shard placement must be changed deliberately.

Can a deleted database be undeleted?

Only when soft-delete recovery was enabled or recoverable shard and metadata copies still exist.

DFW local · Nationwide mail-in

Protect the device. Start with the facts.

Start my recovery case