Skip to content

Commit f10e058

Browse files
authored
DOCS-14979 adds setAllowMigrations command (#239) (#300)
* 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 569b78b commit f10e058

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
@@ -169,10 +169,14 @@ MongoDB migrates chunks in a :term:`sharded cluster` to distribute the
169169
chunks of a sharded collection evenly among shards. Migrations may be
170170
either:
171171

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

178+
.. _sharding-chunk-migration-automatic:
179+
176180
- Automatic. The :ref:`balancer <sharding-balancing>` process
177181
automatically migrates chunks when there is an uneven distribution of
178182
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
@@ -100,6 +100,12 @@ Sharding Commands
100100

101101
- Removes the association between a shard and a :term:`zone`. Supports configuring :ref:`zones <zone-sharding>` in sharded clusters.
102102

103+
* - :dbcommand:`setAllowMigrations`
104+
105+
- Prevents the start of new :ref:`automatic migrations <sharding-chunk-migration-automatic>` on a
106+
collection, prevents in-flight :ref:`manual migrations <sharding-chunk-migration-manual>` from
107+
committing, and excludes the collection from new balancer rounds.
108+
103109
* - :dbcommand:`setShardVersion`
104110

105111
- Internal command to sets the :term:`config server <config database>` version.
@@ -157,6 +163,7 @@ Sharding Commands
157163
/reference/command/mergeChunks
158164
/reference/command/removeShard
159165
/reference/command/removeShardFromZone
166+
/reference/command/setAllowMigrations
160167
/reference/command/setShardVersion
161168
/reference/command/shardCollection
162169
/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:: 4.2.18
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)