Skip to content

Commit 9699741

Browse files
author
Sam Kleinman
committed
merge: sharding edits #1
2 parents 026184a + 00af83e commit 9699741

File tree

1 file changed

+32
-30
lines changed

1 file changed

+32
-30
lines changed

source/tutorial/remove-shards-from-cluster.txt

Lines changed: 32 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -13,30 +13,42 @@ purpose of migration, or downsizing a cluster in response to actual
1313
use.
1414

1515
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?
1922

2023
.. DOCS-94 will lead to a tutorial about cluster migrations. In the
2124
.. mean time the above section will necessarily lack links.
2225

23-
The following list outlines the process for removing shards, from a
24-
high level:
26+
This outlines the process for removing shards:
2527

26-
- Begin moving :term:`chunks <chunk>` off of the shard.
28+
- Move :term:`chunks <chunk>` off of the shard.
2729

2830
- Ensure that this shard is not the "primary" shard for any databases
2931
in the cluster. If it is, move the "primary" status for these
3032
databases to other shards.
3133

32-
- Finally, remove the shard from the cluster's configuration.
34+
- Remove the shard from the cluster's configuration.
3335

34-
Continue reading for a more complete guide to removing and
35-
decommissioning a shard.
3636

3737
Procedure
3838
---------
3939

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+
4052
.. note::
4153

4254
To successfully migrate data from a shard, the :term:`balancer`
@@ -45,29 +57,18 @@ Procedure
4557
shell. See this section on :ref:`balancer operations
4658
<sharding-balancing-disable-temporally>` for more information.
4759

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``.
5960

6061
Remove Chunks from the Shard
6162
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
6263

6364
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.
6566

6667
.. code-block:: javascript
6768

6869
db.runCommand( { removeshard: "mongodb0" } )
6970

70-
This operation will return the following response immediately:
71+
This operation will return a response immediately. For example:
7172

7273
.. code-block:: javascript
7374

@@ -93,12 +94,13 @@ The output will resemble the following document:
9394

9495
{ msg: "draining ongoing" , state: "ongoing" , remaining: { chunks: 42, dbs : 1 }, ok: 1 }
9596

96-
In the ``remaining`` sub document, a counter displays the total number
97+
In the ``remaining`` sub document, a counter displays the remaining number
9798
of chunks that MongoDB must migrate to other shards, and the number of
9899
MongoDB databases that have "primary" status on this shard.
99100

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.
102104

103105
Move Unsharded Databases
104106
~~~~~~~~~~~~~~~~~~~~~~~~
@@ -122,8 +124,8 @@ database named ``myapp`` to the shard named ``mongodb1``.
122124
Do not run the :dbcommand:`movePrimary` until you have *finished*
123125
draining the shard.
124126

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
127129
resemble the following:
128130

129131
.. code-block:: javascript
@@ -140,11 +142,11 @@ information and finalize the removal, as follows:
140142

141143
db.runCommand( { removeshard: "mongodb0" } )
142144

143-
When successful, this command a document that resmbles the following:
145+
When successful, the response will be the following:
144146

145147
.. code-block:: javascript
146148

147149
{ msg: "remove shard completed succesfully" , stage: "completed", host: "mongodb0", ok : 1 }
148150

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

Comments
 (0)