Skip to content

Commit 3174974

Browse files
authored
DOCSP-50584 reShard Collection to Shard (#12452)
1 parent 5864ccf commit 3174974

File tree

4 files changed

+47
-2
lines changed

4 files changed

+47
-2
lines changed

content/manual/upcoming/source/core/reshard-to-same-key.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ Latency
7676

7777
.. include:: /includes/reshard-to-same-key/latency.rst
7878

79+
.. _reshard-to-same-key-req:
80+
7981
Additional Resource Requirements
8082
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
8183

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
2+
When you run the |shardCmd|, the balancer begins distributing
3+
the collection data to other shards in the cluster. A single
4+
shard can only participate in one chunk migration at a time,
5+
When MongoDB succeeds in copying a range of data from one shard
6+
to another, the range on the donor shard is marked for removal
7+
by the range deleter. This process is slow and resource
8+
intensive.
9+
10+
Starting in MongoDB 8.0, if your deployment meets the
11+
:ref:`resource requirements <reshard-to-same-key-req>`, it's
12+
recommended you use the |reshardCmd| to perform this initial
13+
balancing of data by resharding to the same key. This causes
14+
MongoDB to rebalance data across the shards without waiting on
15+
the balancer.
16+
17+
To use the |reshardCmd| to perform the initial balancing:
18+
19+
#. Use the |shardCmd| to configure the collection as a sharded
20+
collection.
21+
22+
#. Use the |reshardCmd| to reshard to the same shard key by
23+
setting the ``forceRedistribution`` option to ``true``.
24+
MongoDB then balances the data across the shards.
25+
26+
For more information, see :ref:`reshard-to-same-key`.
27+

content/manual/upcoming/source/reference/command/shardCollection.txt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,14 @@ Use the form ``field: "hashed"`` to specify a hashed shard key field.
237237

238238
:doc:`/core/hashed-sharding`
239239

240+
Reshard to Balance
241+
~~~~~~~~~~~~~~~~~~
242+
243+
.. |shardCmd| replace:: :dbcommand:`shardCollection` command
244+
.. |reshardCmd| replace:: :dbcommand:`reshardCollection` command
245+
246+
.. include:: /includes/fact-reshard-init-shard
247+
240248
.. _shardCollection-zones:
241249

242250
Zone Sharding and Initial Chunk Distribution
@@ -298,4 +306,4 @@ Learn More
298306
- :method:`sh.balancerCollectionStatus()`
299307
- :method:`sh.shardCollection()`
300308
- :doc:`/sharding`
301-
- :ref:`reshard-to-same-key`
309+
- :ref:`reshard-to-same-key`

content/manual/upcoming/source/reference/method/sh.shardCollection.txt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,14 @@ Write Concern
288288

289289
.. include:: /includes/extracts/mongos-operations-wc-shard-collection.rst
290290

291+
Reshard to Balance
292+
~~~~~~~~~~~~~~~~~~
293+
294+
.. |shardCmd| replace:: :method:`sh.shardCollection` method
295+
.. |reshardCmd| replace:: :method:`sh.reshardCollection` method
296+
297+
.. include:: /includes/fact-reshard-init-shard
298+
291299
Examples
292300
--------
293301

@@ -332,4 +340,4 @@ following example uses
332340
- :dbcommand:`refineCollectionShardKey`
333341
- :method:`sh.balancerCollectionStatus()`
334342
- :dbcommand:`shardCollection`
335-
- :doc:`/sharding`
343+
- :doc:`/sharding`

0 commit comments

Comments
 (0)