@@ -6,22 +6,64 @@ moveChunk
6
6
7
7
.. dbcommand:: moveChunk
8
8
9
- :dbcommand:`moveChunk` is an internal command that supports the
10
- sharding. Use the :method:`sh.moveChunk()` helper in the
11
- :program:`mongo` shell for manual chunk migrations.
9
+ :dbcommand:`moveChunk` is an internal command that moves
10
+ :term:`chunks <chunk>` between :term:`shards <shard>`. The command
11
+ uses the following syntax:
12
+
13
+ .. code-block:: javascript
14
+
15
+ db.runCommand( { moveChunk : <namespace> ,
16
+ find : <query> ,
17
+ to : <destination>,
18
+ <options> } )
19
+
20
+ :param moveChunk: the name of the :term:`collection` which the :term:`chunk`
21
+ exists. The collection's full namespace must be given, including
22
+ the database name, for example: ``"test.blog.posts"``
23
+
24
+ :param find: a query expression that specifies a document of the chunk
25
+ to be moved, for example: ``{ author: "eliot" }``
26
+
27
+ :param to: the shard ID where the chunk will be moved to, for
28
+ example: ``"shard1"``
29
+
12
30
13
31
:option _secondaryThrottle: Set to ``false`` by default. Provides
14
- :ref:`write concern <write-concern>`
15
- support for chunk migrations.
16
-
17
- If ``_secondaryThrottle`` is set to ``true``, during chunk
18
- migrations when a :term:`shard` hosted by a :term:`replica set`,
19
- the :program:`mongod` will wait until the :term:`secondary` members
20
- replicate the migration operations continuing to migrate chunk
21
- data. In the balancer configuration, the ``replThrottle``
22
- configuration provides ``_secondaryThrottle`` behavior.
23
-
24
- For details on chunk migrations see the :ref:`Chunk Migration
25
- <sharding-chunk-migration>` section.
32
+ :ref:`write concern <write-concern>` support for chunk
33
+ migrations.
34
+
35
+ If ``_secondaryThrottle`` is set to ``true``, during chunk
36
+ migrations when a :term:`shard` hosted by a :term:`replica set`,
37
+ the :program:`mongod` will wait until the :term:`secondary`
38
+ members replicate the migration operations continuing to migrate
39
+ chunk data. In the balancer configuration, the ``replThrottle``
40
+ configuration provides ``_secondaryThrottle`` behavior.
41
+
42
+ Use the :method:`sh.moveChunk()` helper in the :program:`mongo`
43
+ shell for manual chunk migrations.
44
+
45
+ For details on how chunks move within MongoDB see the :ref:`chunk
46
+ migration <sharding-chunk-migration>` section.
47
+
48
+ :dbcommand:`moveChunk` will return the following ``errmsg`` if the
49
+ :term:`chunk` to be moved is in use by another :term:`cursor`:
50
+
51
+ .. code-block:: none
52
+
53
+ The collection's metadata lock is already taken.
54
+
55
+ These errors usually occur when there are too many open
56
+ :term:`cursors <cursor>` accessing the chunk you are migrating. You
57
+ can either wait until the cursors complete their operation or close
58
+ the cursors manually.
59
+
60
+ .. note::
61
+
62
+ This command should not be used except in special circumstances
63
+ such as preparing your :term:`shard cluster` for an initial
64
+ ingest of data.
65
+
66
+ .. seealso:: ":ref:`Create chunk <sharding-administration-create-chunks>`"
67
+
26
68
27
69
.. admin-only
0 commit comments