/
sh.removeShardFromZone.txt
122 lines (78 loc) · 3.2 KB
/
sh.removeShardFromZone.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
========================
sh.removeShardFromZone()
========================
.. default-domain:: mongodb
.. contents:: On this page
:local:
:backlinks: none
:depth: 1
:class: singlecol
Definition
----------
.. method:: sh.removeShardFromZone(shard, zone)
.. versionadded:: 3.4
Removes the association between a :term:`zone` and a shard.
.. list-table::
:header-rows: 1
:widths: 20 20 80
* - Parameter
- Type
- Description
* - :ref:`shard <method-removeShardFromZone-shard>`
- string
- .. _method-removeShardFromZone-shard:
The name of the shard from which to remove the :ref:`zone
<method-removeShardFromZone-zone>` association.
* - :ref:`zone <method-removeShardFromZone-zone>`
- string
- .. _method-removeShardFromZone-zone:
The name of the zone whose association with the :ref:`shard
<method-removeShardFromZone-shard>` you want to remove.
Only issue :method:`sh.removeShardFromZone()` when connected to a
:binary:`~bin.mongos` instance.
Behavior
--------
:method:`sh.removeShardFromZone()` does not remove ranges associated with the
zone.
To completely remove a zone from the cluster, you must run
:method:`sh.removeShardFromZone()` on each shard associated with the zone.
If the shard specified is the last shard associated with the zone, you
must ensure there are no remaining ranges associated with the zone. Use
:dbcommand:`updateZoneKeyRange` to remove any existing ranges associated to
the zone before running :method:`sh.removeShardFromZone()`.
See the :ref:`zone <zone-sharding>` manual page for more information on zones
in sharded clusters.
Balancer
~~~~~~~~
Removing the association between a zone and a shard removes the constraints
keeping chunks covered by the zone on the shard. During the next balancer
round, the balancer may migrate chunks that previously covered by the zone.
See the :ref:`sharded cluster balancer <sharding-balancing>` manual page
for more information on how migrations work in a sharded cluster.
Security
~~~~~~~~
For sharded clusters that enforce :doc:`access control
</tutorial/enable-authentication>`, you must authenticate either as:
- a user whose privileges include:
- :authaction:`update` on the ``shards`` collection in the ``config``
database, and
- :authaction:`find` on the ``tags`` collection in the ``config``
database;
or, alternatively,
- a user whose privileges include :authaction:`enableSharding` on the
:ref:`cluster <resource-specific-collection>` resource (available starting in
version 4.0.14 and 3.6.16).
The :authrole:`clusterAdmin` or :authrole:`clusterManager` built-in roles have
the appropriate permissions for issuing :method:`sh.removeShardFromZone()`.
See the :ref:`Role-Based Access Control <authorization>` manual page for more
information.
Example
-------
The following example removes the association between ``shard0000`` and the
``NYC`` zone:
.. code-block:: javascript
sh.removeShardFromZone("shard0000", "NYC")
.. seealso::
:method:`sh.addShardToZone()`,
:method:`sh.updateZoneKeyRange()`,
:method:`sh.removeRangeFromZone()`