/
removeShardFromZone.txt
118 lines (72 loc) · 2.82 KB
/
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
===================
removeShardFromZone
===================
.. default-domain:: mongodb
.. contents:: On this page
:local:
:backlinks: none
:depth: 1
:class: singlecol
Definition
----------
.. dbcommand:: removeShardFromZone
.. versionadded:: 3.4
The :dbcommand:`removeShardFromZone` administrative command removes the
association between a shard and a :term:`zone`.
.. |command| replace:: ``removeShardFromZone``
.. include:: /includes/fact-dbcommand.rst
You must run :dbcommand:`removeShardFromZone` on the admin database.
The :dbcommand:`removeShardFromZone` command has the following syntax:
.. code-block:: javascript
{
removeShardFromZone: <string>,
zone: <string>
}
The command takes the following fields:
.. list-table::
:header-rows: 1
:widths: 20 20 80
* - Field
- Type
- Description
* - ``removeShardFromZone``
- string
- The name of the shard from which to remove association with the ``zone``.
* - ``zone``
- string
- The name of the zone from which to remove association with the ``shard``.
Only issue :dbcommand:`removeShardFromZone` when connected to a
:binary:`~bin.mongos` instance.
The :binary:`~bin.mongo` shell provides the helper method
:method:`sh.removeShardFromZone()`
Behavior
--------
:dbcommand:`removeShardFromZone` does not remove ranges associated with the
zone.
To completely remove a zone from the cluster, you must run
:dbcommand:`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 shard key ranges associated with the zone. Use
:dbcommand:`updateZoneKeyRange` to remove any existing ranges associated with
the zone before running :dbcommand:`removeShardFromZone`.
See the :ref:`zone <zone-sharding>` manual page for more information on zones
in sharded clusters.
Security
~~~~~~~~
For sharded clusters running with :ref:`authentication <authentication>`, you
must authenticate as a user whose privileges include:
- :authaction:`update` on the ``config.shards`` collection or the ``config``
database
- :authaction:`find` on the ``config.tags`` collection or the ``config``
database
The :authrole:`clusterAdmin` or :authrole:`clusterManager` built-in roles have
the appropriate permissions for issuing :dbcommand:`removeShardFromZone`. See
the :ref:`Role-Based Access Control <authorization>` manual page for more
information.
Example
-------
The following example removes the association between ``shard0000`` and zone
``NYC``:
.. code-block:: javascript
admin = db.getSiblingDB("admin")
admin.runCommand( { removeShardFromZone : "shard0000" , zone : "NYC" } )