Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
47a43c4
PCSM-283 Skip sharding operations for replica set
rasika-chivate Sep 1, 2026
542e25e
Create sharded-source-to-replica-set-target.md
rasika-chivate Sep 1, 2026
b789c70
Update sharded-source-to-replica-set-target.md
rasika-chivate Sep 1, 2026
b43c0bc
Update sharded-source-to-replica-set-target.md
rasika-chivate Sep 1, 2026
ed44f22
Update sharded-source-to-replica-set-target.md
rasika-chivate Sep 1, 2026
8cadb85
Update sharded-source-to-replica-set-target.md
rasika-chivate Sep 2, 2026
7a02a06
Update sharded-source-to-replica-set-target.md
rasika-chivate Sep 3, 2026
bccb242
examples before and after cross topology support
rasika-chivate Sep 3, 2026
675429f
Update sharded-source-to-replica-set-target.md
rasika-chivate Sep 3, 2026
ba79a33
Update sharded-source-to-replica-set-target.md
rasika-chivate Sep 3, 2026
9a972b7
Update sharded-source-to-replica-set-target.md
rasika-chivate Sep 3, 2026
15dd913
Update sharded-source-to-replica-set-target.md
rasika-chivate Sep 3, 2026
9266ff8
Potential fix for pull request finding
rasika-chivate Sep 3, 2026
e84e92c
Potential fix for pull request finding
rasika-chivate Sep 3, 2026
003e8e2
Potential fix for pull request finding
rasika-chivate Sep 3, 2026
f67df55
Potential fix for pull request finding
rasika-chivate Sep 3, 2026
5a290f0
Update sharded-source-to-replica-set-target.md
rasika-chivate Sep 3, 2026
d608fcc
Merge branch 'PCSM-283-Skip-sharding-operations-for-replica-set' of h…
rasika-chivate Sep 3, 2026
090cd53
Potential fix for pull request finding
rasika-chivate Sep 3, 2026
6cd6e66
Address documentation review feedback
Copilot Sep 3, 2026
2d56962
Update sharded-source-to-replica-set-target.md
rasika-chivate Sep 3, 2026
a993af9
Merge branch 'PCSM-283-Skip-sharding-operations-for-replica-set' of h…
rasika-chivate Sep 3, 2026
895a309
Update sharded-source-to-replica-set-target.md
rasika-chivate Sep 3, 2026
b63a5ff
Potential fix for pull request finding
rasika-chivate Sep 3, 2026
3f8f690
Potential fix for pull request finding
rasika-chivate Sep 3, 2026
db72be9
Update docs/sharded-source-to-replica-set-target.md
rasika-chivate Sep 7, 2026
19e103e
PCSM-335 Use RFC 3339 format for log timestamps
rasika-chivate Sep 7, 2026
bc7fde8
Merge branch 'PCSM-283-Skip-sharding-operations-for-replica-set' of h…
rasika-chivate Sep 7, 2026
91c9e95
Update docs/sharded-source-to-replica-set-target.md
rasika-chivate Sep 7, 2026
271c764
Update sharded-source-to-replica-set-target.md
rasika-chivate Sep 7, 2026
4ff0fcb
Merge branch 'PCSM-283-Skip-sharding-operations-for-replica-set' of h…
rasika-chivate Sep 7, 2026
5465fc3
implement feedback from dev
rasika-chivate Sep 7, 2026
d8a7af0
Update sharded-source-to-replica-set-target.md
rasika-chivate Sep 7, 2026
3196536
Update sharded-source-to-replica-set-target.md
rasika-chivate Sep 7, 2026
2b9c87e
Potential fix for pull request finding
rasika-chivate Sep 7, 2026
644794e
Clarify sharded-target vs replica-set-target guidance in sharding docs
Copilot Sep 7, 2026
ea37bd1
Update sharded-source-to-replica-set-target.md
rasika-chivate Sep 7, 2026
8589625
Merge branch 'PCSM-283-Skip-sharding-operations-for-replica-set' of h…
rasika-chivate Sep 7, 2026
470c43d
Update sharded-source-to-replica-set-target.md
rasika-chivate Sep 7, 2026
5ef5a00
Potential fix for pull request finding
rasika-chivate Sep 7, 2026
4453888
Split sharding prerequisites by target topology
Copilot Sep 7, 2026
5438446
implement feedback
rasika-chivate Sep 7, 2026
929cde3
Merge branch 'PCSM-283-Skip-sharding-operations-for-replica-set' of h…
rasika-chivate Sep 7, 2026
7421f62
Update sharded-source-to-replica-set-target.md
rasika-chivate Sep 7, 2026
d43e402
Addressed remaining review wording fixes
Copilot Sep 7, 2026
f206a65
Update sharded-source-to-replica-set-target.md
rasika-chivate Sep 15, 2026
eda880e
Potential fix for pull request finding
rasika-chivate Sep 16, 2026
4fd1663
Update docs/sharded-source-to-replica-set-target.md
rasika-chivate Sep 16, 2026
929f26e
Clarify sharded-target behavior docs
Copilot Sep 16, 2026
9a132e3
Update deployment.md
rasika-chivate Sep 16, 2026
400488c
Potential fix for pull request finding
rasika-chivate Sep 16, 2026
8dccd8e
Update sharding.md
rasika-chivate Sep 17, 2026
915aafe
Update docs/sharding.md
rasika-chivate Sep 17, 2026
118ba7e
Implemented feedback
rasika-chivate Sep 17, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

* **Replica Set to Replica Set**: The source and target replica sets can have different numbers of nodes.
* **Sharded cluster to Sharded cluster**: The source and target sharded clusters can have different numbers of shards. This functionality is in tech preview stage. See [Sharding support in {{pcsm.full_name}}](sharding.md) for details.
* **Sharded cluster to Replica Set**: Starting with PCSM 0.10.0, a sharded source cluster can replicate to a replica set target. Collections that are sharded on the source are created as regular collections on the target. For details, see [Replicate from a sharded cluster to a replica set](sharded-source-to-replica-set-target.md).

Check warning on line 7 in docs/deployment.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/deployment.md#L7

[Google.Colons] 'Starting' should be in lowercase.
Raw output
{"message": "[Google.Colons] 'Starting' should be in lowercase.", "location": {"path": "docs/deployment.md", "range": {"start": {"line": 7, "column": 39}}}, "severity": "WARNING"}

Check notice on line 7 in docs/deployment.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/deployment.md#L7

[Google.Acronyms] Spell out 'PCSM', if it's unfamiliar to the audience.
Raw output
{"message": "[Google.Acronyms] Spell out 'PCSM', if it's unfamiliar to the audience.", "location": {"path": "docs/deployment.md", "range": {"start": {"line": 7, "column": 53}}}, "severity": "INFO"}

Check notice on line 7 in docs/deployment.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/deployment.md#L7

[Google.Passive] In general, use active voice instead of passive voice ('are sharded').
Raw output
{"message": "[Google.Passive] In general, use active voice instead of passive voice ('are sharded').", "location": {"path": "docs/deployment.md", "range": {"start": {"line": 7, "column": 147}}}, "severity": "INFO"}

Check notice on line 7 in docs/deployment.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/deployment.md#L7

[Google.Passive] In general, use active voice instead of passive voice ('are created').
Raw output
{"message": "[Google.Passive] In general, use active voice instead of passive voice ('are created').", "location": {"path": "docs/deployment.md", "range": {"start": {"line": 7, "column": 173}}}, "severity": "INFO"}

## Version requirements

Expand All @@ -24,4 +25,4 @@
| Percona Server for MongoDB | Percona Server for MongoDB |
| MongoDB Community | Percona Server for MongoDB |
| MongoDB Enterprise Advanced | Percona Server for MongoDB |
| MongoDB Atlas | Percona Server for MongoDB |
| MongoDB Atlas | Percona Server for MongoDB |
166 changes: 166 additions & 0 deletions docs/sharded-source-to-replica-set-target.md
Comment thread
rasika-chivate marked this conversation as resolved.
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
# Replicate from a sharded cluster to a replica set

!!! admonition "Version added: 0.10.0"

{{pcsm.full_name}} (PCSM) supports replication from a sharded MongoDB cluster to a replica set. This lets you migrate data from a sharded deployment without having to recreate the source sharding configuration on the target.

Check notice on line 5 in docs/sharded-source-to-replica-set-target.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/sharded-source-to-replica-set-target.md#L5

[Google.Acronyms] Spell out 'PCSM', if it's unfamiliar to the audience.
Raw output
{"message": "[Google.Acronyms] Spell out 'PCSM', if it's unfamiliar to the audience.", "location": {"path": "docs/sharded-source-to-replica-set-target.md", "range": {"start": {"line": 5, "column": 21}}}, "severity": "INFO"}

For example, you can use this topology when moving data from a sharded MongoDB Atlas or MongoDB Enterprise deployment to a Percona Server for MongoDB replica set.

For information about sharded cluster support, see [Sharding support in Percona ClusterSync for MongoDB](sharding.md).

## Overview

When the PCSM server starts, it detects that the source is sharded and the target is a replica set.

Check notice on line 13 in docs/sharded-source-to-replica-set-target.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/sharded-source-to-replica-set-target.md#L13

[Google.Acronyms] Spell out 'PCSM', if it's unfamiliar to the audience.
Raw output
{"message": "[Google.Acronyms] Spell out 'PCSM', if it's unfamiliar to the audience.", "location": {"path": "docs/sharded-source-to-replica-set-target.md", "range": {"start": {"line": 13, "column": 10}}}, "severity": "INFO"}

Check notice on line 13 in docs/sharded-source-to-replica-set-target.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/sharded-source-to-replica-set-target.md#L13

[Google.Passive] In general, use active voice instead of passive voice ('is sharded').
Raw output
{"message": "[Google.Passive] In general, use active voice instead of passive voice ('is sharded').", "location": {"path": "docs/sharded-source-to-replica-set-target.md", "range": {"start": {"line": 13, "column": 57}}}, "severity": "INFO"}

During the initial sync, PCSM creates every source collection selected for replication on the target, including the sharded ones, as a regular collection. It doesn't carry over the source shard key, because a replica set has no shards to distribute documents across and doesn't support [`shardCollection` :octicons-link-external-16:](https://www.mongodb.com/docs/manual/reference/command/shardCollection/){:target="_blank"}.

Check notice on line 15 in docs/sharded-source-to-replica-set-target.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/sharded-source-to-replica-set-target.md#L15

[Google.Acronyms] Spell out 'PCSM', if it's unfamiliar to the audience.
Raw output
{"message": "[Google.Acronyms] Spell out 'PCSM', if it's unfamiliar to the audience.", "location": {"path": "docs/sharded-source-to-replica-set-target.md", "range": {"start": {"line": 15, "column": 26}}}, "severity": "INFO"}

During change replication, PCSM skips `shardCollection` events coming from the source [change stream :octicons-link-external-16:](https://www.mongodb.com/docs/manual/changeStreams/){:target="_blank"} and keeps applying the data changes it supports. No additional configuration is required.

Check notice on line 17 in docs/sharded-source-to-replica-set-target.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/sharded-source-to-replica-set-target.md#L17

[Google.Acronyms] Spell out 'PCSM', if it's unfamiliar to the audience.
Raw output
{"message": "[Google.Acronyms] Spell out 'PCSM', if it's unfamiliar to the audience.", "location": {"path": "docs/sharded-source-to-replica-set-target.md", "range": {"start": {"line": 17, "column": 28}}}, "severity": "INFO"}

Check notice on line 17 in docs/sharded-source-to-replica-set-target.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/sharded-source-to-replica-set-target.md#L17

[Google.Passive] In general, use active voice instead of passive voice ('is required').
Raw output
{"message": "[Google.Passive] In general, use active voice instead of passive voice ('is required').", "location": {"path": "docs/sharded-source-to-replica-set-target.md", "range": {"start": {"line": 17, "column": 278}}}, "severity": "INFO"}

!!! note
A collection that is sharded on the source is created as a regular collection on the replica set target. The collection data is copied, but the target collection isn't sharded.

Check notice on line 20 in docs/sharded-source-to-replica-set-target.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/sharded-source-to-replica-set-target.md#L20

[Google.Contractions] Use 'that's' instead of 'that is'.
Raw output
{"message": "[Google.Contractions] Use 'that's' instead of 'that is'.", "location": {"path": "docs/sharded-source-to-replica-set-target.md", "range": {"start": {"line": 20, "column": 18}}}, "severity": "INFO"}

Check notice on line 20 in docs/sharded-source-to-replica-set-target.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/sharded-source-to-replica-set-target.md#L20

[Google.Passive] In general, use active voice instead of passive voice ('is sharded').
Raw output
{"message": "[Google.Passive] In general, use active voice instead of passive voice ('is sharded').", "location": {"path": "docs/sharded-source-to-replica-set-target.md", "range": {"start": {"line": 20, "column": 23}}}, "severity": "INFO"}

Check notice on line 20 in docs/sharded-source-to-replica-set-target.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/sharded-source-to-replica-set-target.md#L20

[Google.Passive] In general, use active voice instead of passive voice ('is created').
Raw output
{"message": "[Google.Passive] In general, use active voice instead of passive voice ('is created').", "location": {"path": "docs/sharded-source-to-replica-set-target.md", "range": {"start": {"line": 20, "column": 48}}}, "severity": "INFO"}

Check notice on line 20 in docs/sharded-source-to-replica-set-target.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/sharded-source-to-replica-set-target.md#L20

[Google.Passive] In general, use active voice instead of passive voice ('is copied').
Raw output
{"message": "[Google.Passive] In general, use active voice instead of passive voice ('is copied').", "location": {"path": "docs/sharded-source-to-replica-set-target.md", "range": {"start": {"line": 20, "column": 130}}}, "severity": "INFO"}

## What is replicated

Check notice on line 22 in docs/sharded-source-to-replica-set-target.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/sharded-source-to-replica-set-target.md#L22

[Google.Contractions] Use 'what's' instead of 'What is'.
Raw output
{"message": "[Google.Contractions] Use 'what's' instead of 'What is'.", "location": {"path": "docs/sharded-source-to-replica-set-target.md", "range": {"start": {"line": 22, "column": 4}}}, "severity": "INFO"}

Check notice on line 22 in docs/sharded-source-to-replica-set-target.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/sharded-source-to-replica-set-target.md#L22

[Google.Passive] In general, use active voice instead of passive voice ('is replicated').
Raw output
{"message": "[Google.Passive] In general, use active voice instead of passive voice ('is replicated').", "location": {"path": "docs/sharded-source-to-replica-set-target.md", "range": {"start": {"line": 22, "column": 9}}}, "severity": "INFO"}

!!! warning
`_id` values must be unique across all source shards. PCSM does not verify their uniqueness. If duplicates exist, documents may be silently skipped or overwritten without causing the synchronization to fail.

Check notice on line 25 in docs/sharded-source-to-replica-set-target.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/sharded-source-to-replica-set-target.md#L25

[Google.Acronyms] Spell out 'PCSM', if it's unfamiliar to the audience.
Raw output
{"message": "[Google.Acronyms] Spell out 'PCSM', if it's unfamiliar to the audience.", "location": {"path": "docs/sharded-source-to-replica-set-target.md", "range": {"start": {"line": 25, "column": 59}}}, "severity": "INFO"}

Check notice on line 25 in docs/sharded-source-to-replica-set-target.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/sharded-source-to-replica-set-target.md#L25

[Google.Contractions] Use 'doesn't' instead of 'does not'.
Raw output
{"message": "[Google.Contractions] Use 'doesn't' instead of 'does not'.", "location": {"path": "docs/sharded-source-to-replica-set-target.md", "range": {"start": {"line": 25, "column": 64}}}, "severity": "INFO"}

| **On the source** | **On the replica set target** |
|---|---|
| Sharded collection | Created as a regular collection. The shard key isn't applied because it doesn't apply to a replica set. |
| Unsharded collection | Created and copied as in a replica set to replica set sync. |
| Chunk distribution and primary shard | Not preserved. PCSM replicates data, not cluster metadata. |

Check notice on line 31 in docs/sharded-source-to-replica-set-target.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/sharded-source-to-replica-set-target.md#L31

[Google.Acronyms] Spell out 'PCSM', if it's unfamiliar to the audience.
Raw output
{"message": "[Google.Acronyms] Spell out 'PCSM', if it's unfamiliar to the audience.", "location": {"path": "docs/sharded-source-to-replica-set-target.md", "range": {"start": {"line": 31, "column": 57}}}, "severity": "INFO"}

## Before you start

* Ensure that `_id` values are unique across all source shards in every collection you want to replicate.
* Ensure the source and target MongoDB versions meet the version requirements.
* Configure authentication for both deployments.
* Configure the source connection string with the `mongos` hostname and port. Configure the target connection string with the replica set members.
* Verify that PCSM can connect to both the source sharded cluster and the target replica set.

Check notice on line 39 in docs/sharded-source-to-replica-set-target.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/sharded-source-to-replica-set-target.md#L39

[Google.Acronyms] Spell out 'PCSM', if it's unfamiliar to the audience.
Raw output
{"message": "[Google.Acronyms] Spell out 'PCSM', if it's unfamiliar to the audience.", "location": {"path": "docs/sharded-source-to-replica-set-target.md", "range": {"start": {"line": 39, "column": 15}}}, "severity": "INFO"}

## Connection string format

Point the source URI at the `mongos` hostname and port. Point the target URI at the replica set members and name the replica set:

**Example**

```sh
PCSM_SOURCE_URI="mongodb://source-user:password@mongos-source:27017/admin"

PCSM_TARGET_URI="mongodb://target-user:password@target1:27017,target2:27017,target3:27017/admin?replicaSet=rs0"
```

In this example, `mongos-source:27017` is the `mongos` endpoint for the source sharded cluster. The target URI lists the replica set members and identifies the replica set as `rs0`.

## Usage

The commands and API endpoints are the same as for any other topology. See [Percona ClusterSync for MongoDB commands](pcsm-commands.md) for the command reference.

??? example "Walkthrough: sharded source to replica set target"

Follow these steps:
{.power-number}

1. Create two clusters: one sharded source cluster and one target replica set.

2. Create two collections on the sharded cluster:

1. `sharded_coll` (sharded)
2. `plain_collection` (unsharded)

3. Add documents to both the collections.

4. Start replication:

```sh
pcsm start
```

5. Check the replication status. `clonedSizeBytes` matches `estimatedCloneSizeBytes`, and the state is `running`:

```{.text .no-copy}
pcsm status
{
"ok": true,
"state": "running",
"info": "Replicating Changes",
"lagTimeSeconds": 0,
"eventsRead": 0,
"eventsApplied": 0,
"lastReplicatedOpTime": {
"ts": "1787645813.1",
"isoDate": "2026-08-25T08:16:53Z"
},
"initialSync": {
"estimatedCloneSizeBytes": 7490,
"clonedSizeBytes": 7490,
"completed": true,
"cloneCompleted": true
}
}
```

6. Run the same query against both deployments and compare the results to confirm that both collections are present and that document counts match:

```javascript
db.sharded_coll.countDocuments()
db.plain_collection.countDocuments()
```

The collection that was sharded on the source appears here as a regular collection. That is expected.

7. Finalize the sync:

```{.bash data-prompt="$"}
$ pcsm finalize
```

8. Check the status again until the state is `finalized`:

```{.bash data-prompt="$"}
$ pcsm status
```

```{.json .no-copy}
{
"ok": true,
"state": "finalized",
"info": "Finalized",
"lagTimeSeconds": 1,
"eventsRead": 0,
"eventsApplied": 0,
"lastReplicatedOpTime": {
"ts": "1787645817.1",
"isoDate": "2026-08-25T08:16:57Z"
},
"initialSync": {
"estimatedCloneSizeBytes": 7490,
"clonedSizeBytes": 7490,
"completed": true,
"cloneCompleted": true
},
"finalization": {
"completed": true,
"startedAt": "2026-08-25T08:16:57.539447026Z",
"completedAt": "2026-08-25T08:16:57.539557888Z"
}
}
```

9. Check the replication logs and confirm that no errors were recorded. For details, see [Logging in Percona ClusterSync for MongoDB](logging.md).

10. Confirm that the documents for both `plain_collection` and `sharded_coll` got copied to the destination cluster.


## Next steps

* [Install {{pcsm.full_name}}](installation.md)
* [Configure authentication](install/authentication.md)
* [Start replication](install/usage.md)
* [Monitor replication status](install/usage.md#check-the-replication-status)
* [Monitor PCSM performance with Percona Monitoring and Management](pmm-setup.md)

Check notice on line 161 in docs/sharded-source-to-replica-set-target.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/sharded-source-to-replica-set-target.md#L161

[Google.Acronyms] Spell out 'PCSM', if it's unfamiliar to the audience.
Raw output
{"message": "[Google.Acronyms] Spell out 'PCSM', if it's unfamiliar to the audience.", "location": {"path": "docs/sharded-source-to-replica-set-target.md", "range": {"start": {"line": 161, "column": 12}}}, "severity": "INFO"}


## Learn more

[Shard Keys :octicons-link-external-16:](https://www.mongodb.com/docs/manual/core/sharding-shard-key/){:target="_blank"}
30 changes: 19 additions & 11 deletions docs/sharding.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,49 +4,57 @@

Sharding support is available starting with {{pcsm.full_name}} 0.7.0 and is currently in technical preview stage. We encourage you to try it out and share your feedback. This will help us improve the feature in future releases.

{{pcsm.full_name}} supports replication between sharded MongoDB clusters, enabling you to migrate or synchronize data from one sharded deployment to another. This capability allows you to migrate sharded clusters with minimal downtime and synchronize data between sharded clusters for testing or development purposes.
{{pcsm.full_name}} supports replication from a sharded MongoDB cluster to another sharded cluster or to a replica set.

With a sharded target, you can migrate or synchronize data between sharded deployments with minimal downtime. With a replica set target, {{pcsm.full_name}} copies the data and skips the source sharding configuration.
Comment thread
rasika-chivate marked this conversation as resolved.

For details about using a replica set as the target, see [Replicate from a sharded cluster to a replica set](sharded-source-to-replica-set-target.md).
Comment on lines +7 to +11

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in 929f26e.


## Overview

The workflow for sharded clusters is similar to replica sets. See [How {{pcsm.full_name}} works](intro.md#replication-workflows) for the complete workflow overview. The key difference is that {{pcsm.short}} connects to `mongos` instances on both the source and target clusters instead of replica set members.
The workflow for sharded clusters is similar to replica sets. See [How {{pcsm.full_name}} works](intro.md#replication-workflows) for the complete workflow overview. The key difference is the target topology: when the target is a sharded cluster, {{pcsm.short}} connects through `mongos` on both the source and target. When the target is a replica set, it connects through the source `mongos` and then the target replica set members instead of a target `mongos`.

Since {{pcsm.short}} connects through `mongos`, the cluster topology doesn't matter. This means the source and target clusters can have different numbers of shards.
In both cases, the source must be a sharded MongoDB deployment. When the target is a sharded cluster, the source and target can have different numbers of shards. A replica set target does not require a target `mongos` instance.

Check notice on line 17 in docs/sharding.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/sharding.md#L17

[Google.Contractions] Use 'doesn't' instead of 'does not'.
Raw output
{"message": "[Google.Contractions] Use 'doesn't' instead of 'does not'.", "location": {"path": "docs/sharding.md", "range": {"start": {"line": 17, "column": 184}}}, "severity": "INFO"}

Also, {{pcsm.short}} replicates data and not metadata. This means chunk distribution as well as the primary shard name for a collection may differ on source and target clusters.

## Prerequisites

* {{pcsm.full_name}} version 0.7.0 or later
* Source and target clusters must be sharded MongoDB deployments
* If the target is a sharded MongoDB deployment, {{pcsm.full_name}} version 0.7.0 or later.
* If the target is a replica set, {{pcsm.full_name}} version 0.10.0 or later.
* The source must be a sharded MongoDB deployment.
* The target can be either a sharded MongoDB deployment or a replica set.
Comment thread
rasika-chivate marked this conversation as resolved.
* Both clusters must be running the same MongoDB version. Check [Version requirements](deployment.md#version-requirements) for more information about supported versions.

## Connection string format

When connecting to sharded clusters, use the standard MongoDB connection string format but specify `mongos` hostname and port instead of replica set members:
When connecting to a sharded source or a sharded target, use the standard MongoDB connection string format but specify the `mongos` hostname and port instead of replica set members:

```{.text .no-copy}
mongodb://user:pwd@mongos-host:port/[authdb]?[options]
```

Since {{pcsm.short}} connects through `mongos`, you don't need to specify individual shard members or config servers in the connection string. The `mongos` router handles routing to the appropriate shards.
When the target is a replica set, specify the target replica set members in the target connection string instead of a `mongos` URI. {{pcsm.short}} does not require a target `mongos` instance in that topology.

Check notice on line 37 in docs/sharding.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/sharding.md#L37

[Google.Contractions] Use 'doesn't' instead of 'does not'.
Raw output
{"message": "[Google.Contractions] Use 'doesn't' instead of 'does not'.", "location": {"path": "docs/sharding.md", "range": {"start": {"line": 37, "column": 148}}}, "severity": "INFO"}

For detailed information about authentication and connection string configuration, see [Configure authentication in MongoDB](install/authentication.md).

## Sharding-specific behavior

The following behavior applies when both the source and target are sharded MongoDB deployments. For replica set targets, see [Replicate from a sharded cluster to a replica set](sharded-source-to-replica-set-target.md).

Check notice on line 43 in docs/sharding.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/sharding.md#L43

[Google.Passive] In general, use active voice instead of passive voice ('are sharded').
Raw output
{"message": "[Google.Passive] In general, use active voice instead of passive voice ('are sharded').", "location": {"path": "docs/sharding.md", "range": {"start": {"line": 43, "column": 64}}}, "severity": "INFO"}

### Initial sync preparation

Before starting the initial sync, {{pcsm.short}} checks which collections are sharded on the source cluster and creates corresponding sharded collections on the destination cluster. The only sharding configuration preserved from the source cluster is the sharding key; all other sharding details are handled internally by the destination cluster.
Before starting the initial sync, {{pcsm.short}} checks which collections are sharded on the source cluster and creates corresponding sharded collections on the target sharded cluster. The only sharding configuration preserved from the source cluster is the sharding key. All other sharding details are handled internally by the target sharded cluster.

Check notice on line 47 in docs/sharding.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/sharding.md#L47

[Google.Passive] In general, use active voice instead of passive voice ('are sharded').
Raw output
{"message": "[Google.Passive] In general, use active voice instead of passive voice ('are sharded').", "location": {"path": "docs/sharding.md", "range": {"start": {"line": 47, "column": 75}}}, "severity": "INFO"}

Check notice on line 47 in docs/sharding.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/sharding.md#L47

[Google.Passive] In general, use active voice instead of passive voice ('are handled').
Raw output
{"message": "[Google.Passive] In general, use active voice instead of passive voice ('are handled').", "location": {"path": "docs/sharding.md", "range": {"start": {"line": 47, "column": 300}}}, "severity": "INFO"}

### Balancer operation

{{pcsm.full_name}} connects to source and target clusters via a `mongos` instance. Therefore, you do not need to disable the balancer on either the source or target cluster before starting replication. The target cluster's balancer continues to operate normally and manages chunk distribution according to its own sharding configuration and balancer settings.
{{pcsm.full_name}} connects to the sharded source through a `mongos` instance. When the target is also sharded, {{pcsm.full_name}} connects to it through `mongos`. You do not need to disable the balancer on either sharded cluster before starting replication. The target balancer continues to operate normally and manages chunk distribution according to the target cluster's sharding configuration and balancer settings.

Check notice on line 51 in docs/sharding.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/sharding.md#L51

[Google.Contractions] Use 'don't' instead of 'do not'.
Raw output
{"message": "[Google.Contractions] Use 'don't' instead of 'do not'.", "location": {"path": "docs/sharding.md", "range": {"start": {"line": 51, "column": 169}}}, "severity": "INFO"}

Check warning on line 51 in docs/sharding.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/sharding.md#L51

[Google.WordListCase] Use 'turn off' or 'off' instead of 'disable'.
Raw output
{"message": "[Google.WordListCase] Use 'turn off' or 'off' instead of 'disable'.", "location": {"path": "docs/sharding.md", "range": {"start": {"line": 51, "column": 184}}}, "severity": "WARNING"}

### Chunk distribution

{{pcsm.short}} does not preserve chunk distribution information from the source cluster. The target cluster manages chunk distribution internally through its balancer. This means that after replication, chunks may be distributed differently on the target cluster compared to the source cluster, which is expected behavior.
For ranged shard keys, {{pcsm.short}} uses the source chunk boundaries to pre-split a sharded target before the clone begins. Collections with a hashed shard key keep the layout MongoDB creates. From there each cluster's balancer manages its own placement, so the layouts can differ.

Since the target cluster already has information about which collections are sharded, it handles sharding internally. {{pcsm.short}} does not interfere with the target cluster's sharding configuration or chunk distribution.
The target sharded cluster already knows which collections are sharded and manages their chunk distribution. {{pcsm.short}} does not interfere with the target cluster's sharding configuration or chunk distribution.

Check notice on line 57 in docs/sharding.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/sharding.md#L57

[Google.Passive] In general, use active voice instead of passive voice ('are sharded').
Raw output
{"message": "[Google.Passive] In general, use active voice instead of passive voice ('are sharded').", "location": {"path": "docs/sharding.md", "range": {"start": {"line": 57, "column": 60}}}, "severity": "INFO"}

Check notice on line 57 in docs/sharding.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/sharding.md#L57

[Google.Contractions] Use 'doesn't' instead of 'does not'.
Raw output
{"message": "[Google.Contractions] Use 'doesn't' instead of 'does not'.", "location": {"path": "docs/sharding.md", "range": {"start": {"line": 57, "column": 125}}}, "severity": "INFO"}

## Usage

Expand Down
1 change: 1 addition & 0 deletions mkdocs-base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ nav:
- compare.md
- deployment.md
- sharding.md
- sharded-source-to-replica-set-target.md
- limitations.md
- Get started:
- Quickstart: installation.md
Expand Down
Loading