Skip to content
This repository was archived by the owner on May 1, 2025. It is now read-only.

Commit 87a08e6

Browse files
committed
commit
1 parent ea1e4b5 commit 87a08e6

File tree

3 files changed

+57
-15
lines changed

3 files changed

+57
-15
lines changed
Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,24 @@
11
.. important::
22

33
When the source or destination cluster is a sharded cluster, you must stop
4-
the balancer on both clusters and not run the :dbcommand:`moveChunk` or
5-
:dbcommand:`moveRange` commands for the duration of the migration. To stop
6-
the balancer, run the :dbcommand:`balancerStop` command and wait for the
7-
command to complete.
4+
the source cluster's balancer on collections within the :ref:`namespace
5+
filter <c2c-filtered-sync>`. You can enable the source cluster's balancer on
6+
the cluster level and for collections outside the namespace filter.
7+
You must also stop the destination cluster's balancer.
8+
9+
If you enable the source cluster's balancer but do not use a
10+
namespace filter, or if you disable the balancer for all
11+
collections within the namespace filter, ``mongosync`` fails.
12+
13+
During migration, do not run the :dbcommand:`moveChunk` or
14+
:dbcommand:`moveRange` commands. If you have enabled the source cluster's
15+
balancer, but disabled it for collections within the namespace
16+
filter, do not run :dbcommand:`shardCollection` on collections
17+
within the namespace filter.
18+
19+
To stop the balancer, run the :dbcommand:`balancerStop` command
20+
and wait for the command to complete.
21+
22+
After stopping the balancer, wait fifteen minutes before
23+
starting ``mongosync``. This gives the cluster time to
24+
finish any in progress chunk migrations.

source/reference/limitations.txt

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -124,16 +124,18 @@ Sharded Clusters
124124
To check for index inconsistencies, see :ref:`Find Inconsistent
125125
Indexes Across Shards <manage-indexes-find-inconsistent-indexes>`.
126126

127-
- You must stop the balancer on sharded source and destination clusters
128-
for the entire lifetime of a migration. To stop the balancer, run the
129-
:dbcommand:`balancerStop` command and wait for the command to
130-
complete.
131-
132-
.. note::
133-
134-
After stopping the balancer, wait fifteen minutes before
135-
starting ``mongosync``. This gives the cluster time to
136-
finish any in progress chunk migrations.
127+
- When the source or destination cluster is a sharded cluster, you must stop
128+
the source cluster's balancer on collections within the :ref:`namespace
129+
filter <c2c-filtered-sync>`. You can enable the source cluster's balancer on
130+
the cluster level and for collections outside the namespace filter.
131+
You must also stop the destination cluster's balancer. See
132+
:ref:`enabling-balancer-filtered` to learn how to enable the balancer during
133+
filtered sync.
134+
135+
- If you have enabled the source cluster's
136+
balancer, but disabled it for collections within the namespace
137+
filter, do not run :dbcommand:`shardCollection` on collections
138+
within the namespace filter.
137139

138140
- You must not run the :dbcommand:`moveChunk` and
139141
:dbcommand:`moveRange` commands on the source or destination clusters.

source/reference/mongosync/mongosync-behavior.txt

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,29 @@ preserve the source cluster's sharding configuration.
102102

103103
.. include:: /includes/fact-mongosync-balancer.rst
104104

105+
.. _enabling-balancer-filtered:
106+
107+
Enabling Balancer in Filtered Sync
108+
''''''''''''''''''''''''''''''''''
109+
110+
Before starting ``mongosync`` with a :ref:`namespace filter
111+
<c2c-filtered-sync>`, enable the balancer for the source cluster
112+
by running the :method:`sh.startBalancer()` method in ``mongosh``.
113+
Then, disable the balancer for each collection within the
114+
namespace filter by running the :dbcommand:`setAllowMigrations` command:
115+
116+
.. code-block:: shell
117+
118+
db.adminCommand(
119+
{
120+
setAllowMigrations: “<db>.<collection>”,
121+
allowMigrations: false
122+
}
123+
)
124+
125+
Run the preceding command for every collection within the
126+
namespace filter.
127+
105128
Pre-Split Chunks
106129
''''''''''''''''
107130

@@ -131,7 +154,7 @@ primary shard to each database by means of a round-robin.
131154

132155
.. warning::
133156

134-
Running :dbcommand:`movePrimary` on the source or desintation cluster
157+
Running :dbcommand:`movePrimary` on the source or destination cluster
135158
during migration may result in a fatal error or require you to
136159
restart the migration from the start. For more information, see
137160
:ref:`c2c-sharded-limitations`.

0 commit comments

Comments
 (0)