@@ -374,7 +374,7 @@ chunks. The balancer has the following thresholds:
374
374
Number of Chunks Migration Threshold
375
375
---------------- -------------------
376
376
Greater than 80 8
377
- 80-21 4
377
+ 21-80 4
378
378
Less than 20 2
379
379
================ ===================
380
380
@@ -449,3 +449,50 @@ to the shard when the value of :status:`mem.mapped` exceeds the
449
449
``maxSize`` setting.
450
450
451
451
.. seealso:: ":doc:`/administration/monitoring`."
452
+
453
+ .. _sharding-chunk-migration:
454
+
455
+ Chunk Migration
456
+ ~~~~~~~~~~~~~~~
457
+
458
+ MongoDB migrates chunks in a :term:`shard cluster` to distribute data
459
+ evenly among shards. Migrations may be either:
460
+
461
+ - Manual. In these migrations you must specify the chunk that you want
462
+ to migrate and the destination shard. Only migrate chunks manually
463
+ after initiating sharding, to distribute data during bulk inserts,
464
+ or if the cluster becomes uneven. See :doc:`Migrating Chunks
465
+ <sharding-balancing-manual-migration>` for more details.
466
+
467
+ - Automatic. The balancer process handles most migrations when
468
+ distribution of chunks between shards becomes uneven. See
469
+ :doc:`Migration Thresholds <sharding-migration-thresholds>` for more
470
+ details.
471
+
472
+ All chunk migrations use the following procedure:
473
+
474
+ #. The balancer process sends the :dbCommand:`moveChunk` command to
475
+ the source shard for the chunk. In this operation the balancer
476
+ passes the name of the destination shard to the source shard.
477
+
478
+ #. The source initaties the move with an internal
479
+ :dbcommand:`moveChunk` command with the destination shard.
480
+
481
+ #. The destination shard begins requesting documents in the chunk, and
482
+ begins receiving these chunks.
483
+
484
+ #. After receving the final document in the chunk, the destination
485
+ shard initiates a synchronization process to ensure that all
486
+ changes to the documents in the chunk on the source shard during
487
+ the migration process exist on the destination shard.
488
+
489
+ When fully synchronized, the destination shard connects to the
490
+ :term:`config database` and updates the chunk location in the
491
+ cluster metadata. After completing this operation, once there are
492
+ no open cursors on the chunk, the source shard starts deleting
493
+ its copy of documents from the migrated chunk.
494
+
495
+ When the ``_secondaryThrottle`` option is set ``true`` for
496
+ :dbcommand:`moveChunk` or the :term:`balancer`, MongoDB will ensure
497
+ secondary members have replicated changes before allowing new chunk
498
+ migrations to occur.
0 commit comments