Skip to content

Commit 31a4c95

Browse files
authored
[BACKPORT] DOCS-14979 adds setAllowMigrations command (#239) (#295)
* DOCS-14979 adds setAllowMigrations command (#239) * adds setAllowMigrations command * updates 5.2 Release Notes * review * adds refs for sharding-chunk-migration-automatic and sharding-chunk-migration-manual * updates nav and release notes * updates release notes spacing * Update setAllowMigrations.txt
1 parent cf1b30d commit 31a4c95

File tree

3 files changed

+103
-0
lines changed

3 files changed

+103
-0
lines changed

source/core/sharding-data-partitioning.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,10 +167,14 @@ MongoDB migrates chunks in a :term:`sharded cluster` to distribute the
167167
chunks of a sharded collection evenly among shards. Migrations may be
168168
either:
169169

170+
.. _sharding-chunk-migration-manual:
171+
170172
- Manual. Only use manual migration in limited cases, such as
171173
to distribute data during bulk inserts. See :doc:`Migrating Chunks
172174
Manually </tutorial/migrate-chunks-in-sharded-cluster>` for more details.
173175

176+
.. _sharding-chunk-migration-automatic:
177+
174178
- Automatic. The :ref:`balancer <sharding-balancing>` process
175179
automatically migrates chunks when there is an uneven distribution of
176180
a sharded collection's chunks across the shards. See :ref:`Migration

source/reference/command/nav-sharding.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,12 @@ Sharding Commands
140140

141141
.. versionadded:: 5.0
142142

143+
* - :dbcommand:`setAllowMigrations`
144+
145+
- Prevents the start of new :ref:`automatic migrations <sharding-chunk-migration-automatic>` on a
146+
collection, prevents in-flight :ref:`manual migrations <sharding-chunk-migration-manual>` from
147+
committing, and excludes the collection from new balancer rounds.
148+
143149
* - :dbcommand:`setShardVersion`
144150

145151
- Internal command to sets the :term:`config server <config database>` version.
@@ -204,6 +210,7 @@ Sharding Commands
204210
/reference/command/removeShard
205211
/reference/command/removeShardFromZone
206212
/reference/command/reshardCollection
213+
/reference/command/setAllowMigrations
207214
/reference/command/setShardVersion
208215
/reference/command/shardCollection
209216
/reference/command/shardingState
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
==================
2+
setAllowMigrations
3+
==================
4+
5+
.. default-domain:: mongodb
6+
7+
.. contents:: On this page
8+
:local:
9+
:backlinks: none
10+
:depth: 1
11+
:class: singlecol
12+
13+
Definition
14+
----------
15+
16+
.. dbcommand:: setAllowMigrations
17+
18+
.. versionadded:: 5.1.2
19+
20+
Prevents the start of new :ref:`automatic migrations
21+
<sharding-chunk-migration-automatic>` on a collection, prevents
22+
in-flight :ref:`manual migrations <sharding-chunk-migration-manual>`
23+
from committing, and excludes the collection from new balancer
24+
rounds.
25+
26+
The command has the following syntax:
27+
28+
.. code-block:: javascript
29+
30+
db.adminCommand( {
31+
setAllowMigrations: "<db>.<collection>",
32+
allowMigrations: <true|false>
33+
} )
34+
35+
The command takes the following parameters:
36+
37+
.. list-table::
38+
:header-rows: 1
39+
:widths: 20 20 60
40+
41+
* - Field
42+
- Type
43+
- Description
44+
45+
* - :ref:`setAllowMigrations <setAllowMigrations-cmd-coll>`
46+
47+
- ``string``
48+
49+
- .. _setAllowMigrations-cmd-coll:
50+
51+
The collection to modify.
52+
53+
* - :ref:`allowMigrations <setAllowMigrations-cmd-flag>`
54+
55+
- ``boolean``
56+
57+
- .. _setAllowMigrations-cmd-flag:
58+
59+
If ``false``:
60+
61+
- MongoDB prevents new :ref:`automatic migrations
62+
<sharding-chunk-migration-automatic>` on the collection
63+
- in-flight :ref:`manual migrations
64+
<sharding-chunk-migration-manual>` will not be committed
65+
- the collection will be excluded from new balancer rounds
66+
67+
If ``true``:
68+
69+
- MongoDB allows new :ref:`automatic migrations
70+
<sharding-chunk-migration-automatic>` on the collection
71+
- in-flight :ref:`manual migrations
72+
<sharding-chunk-migration-manual>` will be committed
73+
- the collection will be included in new balancer rounds
74+
75+
Behavior
76+
--------
77+
78+
:dbcommand:`setAllowMigration` requires the same privileges as
79+
:authaction:`moveChunk`.
80+
81+
Example
82+
-------
83+
84+
This operation prevents migrations on the ``store.inventory``
85+
collection:
86+
87+
.. code-block:: javascript
88+
89+
db.adminCommand( {
90+
setAllowMigrations: "store.inventory",
91+
allowMigrations: false
92+
} )

0 commit comments

Comments
 (0)