---
source: https://iinventedlight.com/library/notes/couchdb-replication.md
title: "CouchDB replication copies active documents from a source to a destination"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "Apache-2.0 (Apache CouchDB); Apache-2.0 (Apache CouchDB); prose restates cited source lines in own words"
license_family: mixed-green
attribution: "Summary by iinventedlight (AI-assisted). Sources: Apache CouchDB, Introduction to Replication; Apache CouchDB, couch_replicator README. Apache-2.0; Apache-2.0."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-20
status: published
approved_by: "Cole Withington, 2026-11-20 13:14 PT: \"Publish the full batch and rewrite the 6 live notes\""
checked_on: 2026-11-20
as_of: 2026-11-20
confidence: medium
untested: "Not reproduced (2026-11-20). Official docs and source files were read; no test suite, server, or API call was run for this note."
category: coding-references
topic_area: "code-systems: CouchDB replication"
tags: [couchdb, replication, databases]
client: Librarian
sources:
  - id: S1
    title: "Introduction to Replication"
    publisher: Apache CouchDB
    url: https://docs.couchdb.org/en/stable/replication/intro.html
    accessed: 2026-11-20
    license: "Apache-2.0"
  - id: S2
    title: "couch_replicator README"
    publisher: Apache CouchDB
    url: https://raw.githubusercontent.com/apache/couchdb/main/src/couch_replicator/README.md
    accessed: 2026-11-20
    license: "Apache-2.0"
---
# CouchDB replication copies active documents from a source to a destination
**Answer:** Replication uses a source database and a destination database, on the same instance or on different CouchDB instances. When the process finishes, every active document from the source is also in the destination, and documents deleted on the source are deleted on the destination if they were present there.

## Transient and persistent

- `source` the database being copied from
- `destination` the database being copied to
- `transient` a replication with no documents backing it up
- `persistent` the other way to set up a replication, with documents backing it up

You can set up a replication in two ways. The first one introduced into CouchDB leads to a transient replication, with no documents backing it up.

## Scheduler jobs

The main API function is `add_job`. It takes a `rep` record, which may come from a document update in a `_replicator` db, or from a POST to the `_replicate` endpoint. The scheduler will try to stop some jobs, start some new ones, and keep the running job count less than max_jobs (default 500). History length is limited based on the max_history configuration value. The default is 20 entries. History event types include added, started, stopped, and crashed. Failed replication jobs are penalized using an exponential backoff.

## See also

- [couchdb-mango-queries](https://iinventedlight.com/library/notes/couchdb-mango-queries/)
- [postgres-logical-replication](https://iinventedlight.com/library/notes/postgres-logical-replication/)
- [sqlite-when-to-use](https://iinventedlight.com/library/notes/sqlite-when-to-use/)

## Claims

- id: C1
  claim: Replication has a source and a destination database, on the same instance or on different instances.
  source: S1
  evidence: "Replication involves a source and a destination database"

- id: C2
  claim: When replication finishes, active source documents are on the destination, and source deletions are reflected there too.
  source: S1
  evidence: "all active documents in the source database are also in the destination database"

- id: C3
  claim: The scheduler accepts a job from a _replicator database document or from a POST to _replicate.
  source: S2
  evidence: "the result of a POST to `_replicate` endpoint."

## Sources

- [S1] Introduction to Replication. Apache CouchDB. https://docs.couchdb.org/en/stable/replication/intro.html . License: Apache-2.0. Accessed 2026-11-20.

- [S2] couch_replicator README. Apache CouchDB. https://raw.githubusercontent.com/apache/couchdb/main/src/couch_replicator/README.md . License: Apache-2.0. Accessed 2026-11-20.

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Apache CouchDB, Introduction to Replication; Apache CouchDB, couch_replicator README. Apache-2.0; Apache-2.0. Text was condensed and changed from the originals.

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
