Skip to content
This repository was archived by the owner on May 1, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
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
17 changes: 13 additions & 4 deletions source/includes/fact-mongosync-balancer.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
.. important::

When the source or destination cluster is a sharded cluster, you must stop
the balancer on both clusters and not run the :dbcommand:`moveChunk` or
:dbcommand:`moveRange` commands for the duration of the migration. To stop
the balancer, run the :dbcommand:`balancerStop` command and wait for the
command to complete.
the source cluster's balancer on collections within the :ref:`namespace
filter <c2c-filtered-sync>`. You can enable the source cluster's balancer on
the cluster level and for collections outside the namespace filter.
You must also stop the destination cluster's balancer.

During migration, do not run the :dbcommand:`moveChunk` or
:dbcommand:`moveRange` commands. If you have enabled the source cluster's
balancer, but disabled it for collections within the namespace
filter, do not run :dbcommand:`shardCollection` on collections
within the namespace filter. If you run :dbcommand:`shardCollection` on
collections within the namespace filter during the migration, ``mongosync``
Comment on lines +27 to +29

Choose a reason for hiding this comment

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

Suggested change
filter, do not run :dbcommand:`shardCollection` on collections
within the namespace filter. If you run :dbcommand:`shardCollection` on
collections within the namespace filter during the migration, ``mongosync``
filter, running :dbcommand:`shardCollection` on collections within the namespace filter during the migration causes ``mongosync`` to return

If possible to make these two sentences into one I think it might be cleaner, but up to your judgement–if you like to be explicit "do not run X command" that's ok too.

returns an error and stops, which requires you to start the migration
from scratch.
24 changes: 14 additions & 10 deletions source/reference/limitations.txt
Original file line number Diff line number Diff line change
Expand Up @@ -124,16 +124,20 @@ Sharded Clusters
To check for index inconsistencies, see :ref:`Find Inconsistent
Indexes Across Shards <manage-indexes-find-inconsistent-indexes>`.

- You must stop the balancer on sharded source and destination clusters
for the entire lifetime of a migration. To stop the balancer, run the
:dbcommand:`balancerStop` command and wait for the command to
complete.

.. note::

After stopping the balancer, wait fifteen minutes before
starting ``mongosync``. This gives the cluster time to
finish any in progress chunk migrations.
- When the source or destination cluster is a sharded cluster, you must stop
the source cluster's balancer on collections within the :ref:`namespace
filter <c2c-filtered-sync>`. You can enable the source cluster's balancer on
the cluster level and for collections outside the namespace filter.
If you are not running a filtered sync, you must stop the source cluster's
balancer.
You must also stop the destination cluster's balancer. See
:ref:`enabling-balancer-filtered` to learn how to enable the balancer during
filtered sync.

- If you have enabled the source cluster's
balancer, but disabled it for collections within the namespace
filter, do not run :dbcommand:`shardCollection` on collections
within the namespace filter.

- You must not run the :dbcommand:`moveChunk` and
:dbcommand:`moveRange` commands on the source or destination clusters.
Expand Down
36 changes: 35 additions & 1 deletion source/reference/mongosync/mongosync-behavior.txt
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,40 @@ preserve the source cluster's sharding configuration.

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

.. _enabling-balancer-filtered:

Enabling Balancer in Filtered Sync
''''''''''''''''''''''''''''''''''

Before starting ``mongosync`` with a :ref:`namespace filter
<c2c-filtered-sync>`, enable the balancer for the source cluster
by running the :method:`sh.startBalancer()` method in ``mongosh``.
Then, disable the balancer for each collection within the
namespace filter by running the :dbcommand:`setAllowMigrations` command:

.. code-block:: shell

db.adminCommand(
{
setAllowMigrations: “<db>.<collection>”,
allowMigrations: false
}
)

Run the preceding command for every collection within the
namespace filter.

Then, run the :dbcommand:`balancerStop` command to stop
the balancer on the destination cluster and wait for the command to complete.

After stopping the balancer, wait fifteen minutes before
starting ``mongosync``. This gives the cluster time to
finish any in progress chunk migrations.

If you enable the source cluster's balancer but do not use a
namespace filter, or if you disable the balancer for all
collections within the namespace filter, ``mongosync`` fails.

Pre-Split Chunks
''''''''''''''''

Expand Down Expand Up @@ -131,7 +165,7 @@ primary shard to each database by means of a round-robin.

.. warning::

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