@@ -13,30 +13,42 @@ purpose of migration, or downsizing a cluster in response to actual
13
13
use.
14
14
15
15
This process is only required if you need to migrate all data from an
16
- existing shard and decommission that shard. If you need to migrate an
17
- entire shard to new hardware, *do not* use this procedure. Rather,
18
- migrate individual shards as if they were independent replica sets.
16
+ existing shard cluster and decommission that cluster.
17
+
18
+ *Do not* use this procedure to migrate an entire shard to new
19
+ hardware. To migrate an entire shard to new hardware, migrate
20
+ individual shards as if they were independent replica sets.
21
+ .. TODO do we have a document outlining this in more detail?
19
22
20
23
.. DOCS-94 will lead to a tutorial about cluster migrations. In the
21
24
.. mean time the above section will necessarily lack links.
22
25
23
- The following list outlines the process for removing shards, from a
24
- high level:
26
+ This outlines the process for removing shards:
25
27
26
- - Begin moving :term:`chunks <chunk>` off of the shard.
28
+ - Move :term:`chunks <chunk>` off of the shard.
27
29
28
30
- Ensure that this shard is not the "primary" shard for any databases
29
31
in the cluster. If it is, move the "primary" status for these
30
32
databases to other shards.
31
33
32
- - Finally, remove the shard from the cluster's configuration.
34
+ - Remove the shard from the cluster's configuration.
33
35
34
- Continue reading for a more complete guide to removing and
35
- decommissioning a shard.
36
36
37
37
Procedure
38
38
---------
39
39
40
+ .. TODO: Does this note have to be at the beginning? If so, it should not be a 'note'
41
+
42
+ Complete this procedure by connecting to any :program:`mongos` in the
43
+ cluster using the :program:`mongo` shell.
44
+
45
+ You can only remove a shard by its shard name. To discover or
46
+ confirm the name of a shard using the :dbcommand:`listshards` or
47
+ :dbcommand:`printShardingStatus` commands or the :func:`sh.status()`
48
+ shell helper.
49
+
50
+ The following example will remove shard named ``mongodb0``.
51
+
40
52
.. note::
41
53
42
54
To successfully migrate data from a shard, the :term:`balancer`
@@ -45,29 +57,18 @@ Procedure
45
57
shell. See this section on :ref:`balancer operations
46
58
<sharding-balancing-disable-temporally>` for more information.
47
59
48
- Complete this procedure by connecting to any :program:`mongos` in the
49
- cluster using the :program:`mongo` shell.
50
-
51
- To remove a shard you must know it's name. If you specified a name
52
- when you added the shard using the :dbcommand:`addShard` command. If
53
- you did not specify a name at this point, MongoDB automatically
54
- assigned a name. You can discover or confirm the name of a shard using
55
- the :dbcommand:`listshards` or :dbcommand:`printShardingStatus`
56
- commands or the :func:`sh.status()` shell helper.
57
-
58
- The following examples will remove a shard named ``mongodb0``.
59
60
60
61
Remove Chunks from the Shard
61
62
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
62
63
63
64
Start by running the :dbcommand:`removeShard` command. This
64
- begins "draining" chunks from the shard you''re removing.
65
+ begins "draining" chunks from the shard you are removing.
65
66
66
67
.. code-block:: javascript
67
68
68
69
db.runCommand( { removeshard: "mongodb0" } )
69
70
70
- This operation will return the following response immediately:
71
+ This operation will return a response immediately. For example :
71
72
72
73
.. code-block:: javascript
73
74
@@ -93,12 +94,13 @@ The output will resemble the following document:
93
94
94
95
{ msg: "draining ongoing" , state: "ongoing" , remaining: { chunks: 42, dbs : 1 }, ok: 1 }
95
96
96
- In the ``remaining`` sub document, a counter displays the total number
97
+ In the ``remaining`` sub document, a counter displays the remaining number
97
98
of chunks that MongoDB must migrate to other shards, and the number of
98
99
MongoDB databases that have "primary" status on this shard.
99
100
100
- Continue checking the status of the `removeshard` command until
101
- the number of chunks remaining is 0. Then you can proceed to the next step.
101
+ Continue checking the status of the `removeshard` command until the
102
+ number of chunks remaining is 0, then you can proceed to the next
103
+ step.
102
104
103
105
Move Unsharded Databases
104
106
~~~~~~~~~~~~~~~~~~~~~~~~
@@ -122,8 +124,8 @@ database named ``myapp`` to the shard named ``mongodb1``.
122
124
Do not run the :dbcommand:`movePrimary` until you have *finished*
123
125
draining the shard.
124
126
125
- This command can be long-running. It will not return until MongoDB
126
- completes moving all data . The response from this command will
127
+ This command will not return until MongoDB completes moving all data,
128
+ which may take a long time . The response from this command will
127
129
resemble the following:
128
130
129
131
.. code-block:: javascript
@@ -140,11 +142,11 @@ information and finalize the removal, as follows:
140
142
141
143
db.runCommand( { removeshard: "mongodb0" } )
142
144
143
- When successful, this command a document that resmbles the following:
145
+ When successful, the response will be the following:
144
146
145
147
.. code-block:: javascript
146
148
147
149
{ msg: "remove shard completed succesfully" , stage: "completed", host: "mongodb0", ok : 1 }
148
150
149
- Once the value if "state" is "completed", you may safely stop the
150
- processes that comprise the ``mongodb0`` shard.
151
+ When the value of "state" is "completed", you may safely stop the
152
+ ``mongodb0`` shard.
0 commit comments