Percona ClusterSync for MongoDB commands¶
Overview¶
Percona ClusterSync for MongoDB is a replication tool for MongoDB clusters. It provides commands to manage and monitor the replication process between source and target MongoDB clusters.
Commands¶
Common flags¶
The following flag is available on all subcommands:
| Name | Description |
|---|---|
--port |
Port number of the running PCSM server to connect to (default: 2242). Use this when the server is listening on a non-default port (e.g., pcsm status --port 3000). |
version¶
Display the current version of Percona ClusterSync for MongoDB.
$ pcsm version
status¶
Get the status of the replication process.
$ pcsm status
If the PCSM server is running on a non-default port, specify it with --port flag:
$ pcsm status --port 3000
start¶
Starts cluster replication.
$ pcsm start
To start a filtered replication, pass the namespaces (databases and collections) that you want to include/exclude from replication.
$ pcsm start \
--include-namespaces="db1.collection1,db2.collection2" \
--exclude-namespaces="db3.collection3"
To include or exclude a specific database and all collections it includes, pass it in the format mydb.*.
Available flags:
| Name | Description |
|---|---|
--include-namespaces |
Replicate only the specified namespaces. Multiple namespaces are supported as a comma separated list. The number of namespaces to specify is unlimited |
--exclude-namespaces |
Replicate everything except the specified namespaces. Multiple namespaces are supported as a comma separated list. The number of namespaces to specify is unlimited. When both --include-namespaces and --exclude-namespaces flags are specified, the exclude filters take precedence. For example, if the --include-namespaces includes db1.* and --exclude-namespaces has db1.users, PCSM syncs all collections of db1 except db1.users. |
--clone-num-parallel-collections |
Number of collections to copy in parallel during clone. |
--clone-num-read-workers |
Number of read workers that read collection segments from the source. Shared for all collections. |
--clone-num-insert-workers |
Number of insert workers that write batches to the target. Shared for all collections. |
--repl-num-workers |
Controls how many concurrent replication worker goroutines PCSM uses to apply DML (insert/update/replace/delete) events to the target cluster. |
--repl-change-stream-batch-size |
Sets the maximum number of change stream events PCSM will request and read from MongoDB per batch while streaming changes from the source cluster. |
--repl-event-queue-size |
Controls the size of the internal event queue used by the replication subsystem. |
--repl-worker-queue-size |
Defines the maximum number of replication events that each replication worker thread can queue before processing |
--repl-bulk-ops-size |
Defines the maximum number of operations that can be grouped together into a single bulk apply batch during replication. |
reset¶
Resets the PCSM state and deletes the metadata collections from target deployment. After the command execution, you must restart the PCSM service and start the data replication from scratch. Read more about the flow in Troubleshooting guide
$ pcsm reset --target
finalize¶
Finalize cluster replication.
$ pcsm finalize
pause¶
Pause cluster replication.
$ pcsm pause
resume¶
Resume cluster replication.
$ pcsm resume
Available flags:
| Name | Description |
|---|---|
--from-failure |
Resume replication from the last failure point |
Created: April 16, 2026