Skip to content

Commit f3423ef

Browse files
author
Bob Grabar
committed
DOCS-302 migrated shard admin page
1 parent 2a9e016 commit f3423ef

File tree

4 files changed

+198
-201
lines changed

4 files changed

+198
-201
lines changed

source/administration/sharding-architectures.txt

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,10 @@ Sharded Cluster Architectures
99
.. default-domain:: mongodb
1010

1111
This document describes the organization and design of :term:`sharded
12-
cluster` deployments.
12+
cluster` deployments. For a list of all sharding
13+
documentation see :doc:`/sharding`.
1314

14-
.. seealso:: The :doc:`/administration/sharding` document, the
15-
":ref:`Sharding Requirements <sharding-requirements>`" section,
16-
and the ":ref:`Sharding Tutorials <sharding-tutorials>`" for more
17-
information on deploying and maintaining a :term:`sharded cluster`.
15+
.. seealso:: :ref:`sharding-requirements`.
1816

1917
Deploying a Test Cluster
2018
------------------------
@@ -55,17 +53,17 @@ components:
5553
- 2 or more :term:`replica sets <replica set>`, for the :term:`shards
5654
<shard>`.
5755

58-
.. see:: ":doc:`/administration/replication-architectures`"
59-
and ":doc:`/replication`" for more information on replica sets.
56+
.. see:: For more information on replica sets see
57+
:doc:`/administration/replication-architectures` and
58+
:doc:`/replication`.
6059

6160
- :program:`mongos` instances. Typically, you will deploy a single
6261
:program:`mongos` instance on each application server. Alternatively,
6362
you may deploy several `mongos` nodes and let your application connect
6463
to these via a load balancer.
6564

66-
.. seealso:: The ":ref:`sharding-procedure-add-shard`" and
67-
":ref:`sharding-procedure-remove-shard`" procedures for more
68-
information.
65+
.. seealso:: :ref:`sharding-procedure-add-shard` and
66+
:ref:`sharding-procedure-remove-shard`.
6967

7068
Sharded and Non-Sharded Data
7169
----------------------------
@@ -117,7 +115,7 @@ created subsequently, may reside on any shard in the cluster.
117115
High Availability and MongoDB
118116
-----------------------------
119117

120-
A :ref:`production <sharding-production-architecture>`
118+
A :ref:`production <sharding-production-architecture>`
121119
:term:`cluster` has no single point of failure. This section introduces the
122120
availability concerns for MongoDB deployments, and highlights
123121
potential failure scenarios and available resolutions:

source/administration/sharding.txt

Lines changed: 113 additions & 124 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,7 @@ Sharded Cluster Administration
88
.. default-domain:: mongodb
99

1010
This document describes common administrative tasks for sharded
11-
clusters. For a full introduction to sharding in MongoDB see
12-
:doc:`/core/sharding`, and for a complete overview of all sharding
13-
documentation in the MongoDB Manual, see :doc:`/sharding`. The
14-
:doc:`/administration/sharding-architectures` document provides an
15-
overview of deployment possibilities to help deploy a sharded
16-
cluster. Finally, the :doc:`/core/sharding-internals` document
17-
provides a more detailed introduction to sharding when troubleshooting
18-
issues or understanding your cluster's behavior.
11+
clusters. For a list of all sharding documentation see :doc:`/sharding`.
1912

2013
.. contents:: Sharding Procedures:
2114
:backlinks: none
@@ -26,8 +19,7 @@ issues or understanding your cluster's behavior.
2619
Set up a Sharded Cluster
2720
------------------------
2821

29-
Before deploying a cluster, see the requirements listed in
30-
:ref:`Requirements for Sharded Clusters <sharding-requirements>`.
22+
Before deploying a cluster, see :ref:`sharding-requirements`.
3123

3224
For testing purposes, you can run all the required shard :program:`mongod` processes on a
3325
single server. For production, use the configurations described in
@@ -198,99 +190,8 @@ use the following procedure as a quick starting point:
198190
Cluster Management
199191
------------------
200192

201-
Once you have a running sharded cluster, you will need to maintain it.
202-
This section describes common maintenance procedure, including: how to
203-
add and remove shards, how to manually split chunks, and how to disable
204-
the balancer for backups.
205-
206-
List Databases with Sharding Enabled
207-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
208-
209-
To list the databases for which sharding is enabled, query the
210-
``databases`` collection in the :ref:`config database
211-
<config-database>`. The databases with the ``partitioned`` field set to
212-
``true`` have sharding enabled.
213-
214-
.. example:: Run this sequence of commands to open the :ref:`config
215-
database <config-database>` and query the ``databases`` collection.
216-
217-
.. code-block:: javascript
218-
219-
use config
220-
db.databases.find()
221-
222-
Given the following example output:
223-
224-
.. code-block:: javascript
225-
226-
{ "_id" : "admin", "partitioned" : false, "primary" : "config" }
227-
{ "_id" : "foo", "partitioned" : true, "primary" : "example1.com:30001" }
228-
{ "_id" : "baz", "partitioned" : false, "primary" : "example2.com:27017" }
229-
230-
Only the database `foo` has sharding enabled because only `foo` has
231-
the ``partitioned`` field set to ``true``.
232-
233-
List Shards
234-
~~~~~~~~~~~
235-
236-
To list the current set of configured shards and verify that all shards
237-
have been committed to the system, run the :dbcommand:`listShards`
238-
command:
239-
240-
.. code-block:: javascript
241-
242-
db.runCommand( { listshards : 1 } )
243-
244-
View Cluster Details
245-
~~~~~~~~~~~~~~~~~~~~
246-
247-
To view cluster details, issue :method:`db.printShardingStatus()` or
248-
:method:`sh.status()`. Both methods return the same output.
249-
250-
.. example:: In the following example output from :method:`sh.status()`
251-
252-
- ``sharding version`` displays the version number of the shard
253-
metadata.
254-
255-
- ``shards`` displays each :program:`mongod` instance that is used as
256-
a shard.
257-
258-
- ``databases`` displays all databases living in the cluster,
259-
including databases for which sharding is not enabled.
260-
261-
- The ``chunks`` information for the ``foo`` database displays how
262-
many chunks are on each shard and displays the range of each chunk.
263-
264-
.. code-block:: javascript
265-
266-
--- Sharding Status ---
267-
sharding version: { "_id" : 1, "version" : 3 }
268-
shards:
269-
{ "_id" : "shard0000", "host" : "example1.com:40000" }
270-
{ "_id" : "shard0001", "host" : "example2.com:50000" }
271-
databases:
272-
{ "_id" : "admin", "partitioned" : false, "primary" : "config" }
273-
{ "_id" : "foo", "partitioned" : true, "primary" : "shard0000" }
274-
foo.big chunks:
275-
shard0001 1
276-
shard0000 6
277-
{ "a" : { $minKey : 1 } } -->> { "a" : "elephant" } on : shard0001 Timestamp(2000, 1) jumbo
278-
{ "a" : "elephant" } -->> { "a" : "giraffe" } on : shard0000 Timestamp(1000, 1) jumbo
279-
{ "a" : "giraffe" } -->> { "a" : "hippopotamus" } on : shard0000 Timestamp(2000, 2) jumbo
280-
{ "a" : "hippopotamus" } -->> { "a" : "lion" } on : shard0000 Timestamp(2000, 3) jumbo
281-
{ "a" : "lion" } -->> { "a" : "rhinoceros" } on : shard0000 Timestamp(1000, 3) jumbo
282-
{ "a" : "rhinoceros" } -->> { "a" : "springbok" } on : shard0000 Timestamp(1000, 4)
283-
{ "a" : "springbok" } -->> { "a" : { $maxKey : 1 } } on : shard0000 Timestamp(1000, 5)
284-
foo.large chunks:
285-
shard0001 1
286-
shard0000 5
287-
{ "a" : { $minKey : 1 } } -->> { "a" : "hen" } on : shard0001 Timestamp(2000, 0)
288-
{ "a" : "hen" } -->> { "a" : "horse" } on : shard0000 Timestamp(1000, 1) jumbo
289-
{ "a" : "horse" } -->> { "a" : "owl" } on : shard0000 Timestamp(1000, 2) jumbo
290-
{ "a" : "owl" } -->> { "a" : "rooster" } on : shard0000 Timestamp(1000, 3) jumbo
291-
{ "a" : "rooster" } -->> { "a" : "sheep" } on : shard0000 Timestamp(1000, 4)
292-
{ "a" : "sheep" } -->> { "a" : { $maxKey : 1 } } on : shard0000 Timestamp(1000, 5)
293-
{ "_id" : "test", "partitioned" : false, "primary" : "shard0000" }
193+
This section describes how to add and remove shards and how to view
194+
information about your :term:`sharded cluster`.
294195

295196
.. _sharding-procedure-add-shard:
296197

@@ -359,9 +260,8 @@ procedure:
359260
It may take some time for :term:`chunks <chunk>` to migrate to the
360261
new shard.
361262

362-
See the :ref:`Balancing and Distribution <sharding-balancing>`
363-
section for an overview of the balancing operation and the :ref:`Balancing Internals
364-
<sharding-balancing-internals>` section for additional information.
263+
For an introduction to balancing, see :ref:`sharding-balancing`. For
264+
lower level information on balancing, see :ref:`sharding-balancing-internals`.
365265

366266
.. _sharding-procedure-remove-shard:
367267

@@ -483,6 +383,95 @@ The procedure to remove a shard is as follows:
483383
Once the value of the ``stage`` field is "completed," you may safely
484384
stop the processes comprising the ``mongodb0`` shard.
485385

386+
List Databases with Sharding Enabled
387+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
388+
389+
To list the databases for which sharding is enabled, query the
390+
``databases`` collection in the :ref:`config-database`.
391+
The databases with the ``partitioned`` field set to
392+
``true`` have sharding enabled.
393+
394+
.. example:: Run this sequence of commands to open the :ref:`config
395+
database <config-database>` and query the ``databases`` collection.
396+
397+
.. code-block:: javascript
398+
399+
use config
400+
db.databases.find()
401+
402+
Given the following example output:
403+
404+
.. code-block:: javascript
405+
406+
{ "_id" : "admin", "partitioned" : false, "primary" : "config" }
407+
{ "_id" : "foo", "partitioned" : true, "primary" : "example1.com:30001" }
408+
{ "_id" : "baz", "partitioned" : false, "primary" : "example2.com:27017" }
409+
410+
Only the database `foo` has sharding enabled because only `foo` has
411+
the ``partitioned`` field set to ``true``.
412+
413+
List Shards
414+
~~~~~~~~~~~
415+
416+
To list the current set of configured shards and verify that all shards
417+
have been committed to the system, run the :dbcommand:`listShards`
418+
command:
419+
420+
.. code-block:: javascript
421+
422+
db.runCommand( { listshards : 1 } )
423+
424+
View Cluster Details
425+
~~~~~~~~~~~~~~~~~~~~
426+
427+
To view cluster details, issue :method:`db.printShardingStatus()` or
428+
:method:`sh.status()`. Both methods return the same output.
429+
430+
.. example:: In the following example output from :method:`sh.status()`
431+
432+
- ``sharding version`` displays the version number of the shard
433+
metadata.
434+
435+
- ``shards`` displays each :program:`mongod` instance that is used as
436+
a shard.
437+
438+
- ``databases`` displays all databases living in the cluster,
439+
including databases for which sharding is not enabled.
440+
441+
- The ``chunks`` information for the ``foo`` database displays how
442+
many chunks are on each shard and displays the range of each chunk.
443+
444+
.. code-block:: javascript
445+
446+
--- Sharding Status ---
447+
sharding version: { "_id" : 1, "version" : 3 }
448+
shards:
449+
{ "_id" : "shard0000", "host" : "example1.com:40000" }
450+
{ "_id" : "shard0001", "host" : "example2.com:50000" }
451+
databases:
452+
{ "_id" : "admin", "partitioned" : false, "primary" : "config" }
453+
{ "_id" : "foo", "partitioned" : true, "primary" : "shard0000" }
454+
foo.big chunks:
455+
shard0001 1
456+
shard0000 6
457+
{ "a" : { $minKey : 1 } } -->> { "a" : "elephant" } on : shard0001 Timestamp(2000, 1) jumbo
458+
{ "a" : "elephant" } -->> { "a" : "giraffe" } on : shard0000 Timestamp(1000, 1) jumbo
459+
{ "a" : "giraffe" } -->> { "a" : "hippopotamus" } on : shard0000 Timestamp(2000, 2) jumbo
460+
{ "a" : "hippopotamus" } -->> { "a" : "lion" } on : shard0000 Timestamp(2000, 3) jumbo
461+
{ "a" : "lion" } -->> { "a" : "rhinoceros" } on : shard0000 Timestamp(1000, 3) jumbo
462+
{ "a" : "rhinoceros" } -->> { "a" : "springbok" } on : shard0000 Timestamp(1000, 4)
463+
{ "a" : "springbok" } -->> { "a" : { $maxKey : 1 } } on : shard0000 Timestamp(1000, 5)
464+
foo.large chunks:
465+
shard0001 1
466+
shard0000 5
467+
{ "a" : { $minKey : 1 } } -->> { "a" : "hen" } on : shard0001 Timestamp(2000, 0)
468+
{ "a" : "hen" } -->> { "a" : "horse" } on : shard0000 Timestamp(1000, 1) jumbo
469+
{ "a" : "horse" } -->> { "a" : "owl" } on : shard0000 Timestamp(1000, 2) jumbo
470+
{ "a" : "owl" } -->> { "a" : "rooster" } on : shard0000 Timestamp(1000, 3) jumbo
471+
{ "a" : "rooster" } -->> { "a" : "sheep" } on : shard0000 Timestamp(1000, 4)
472+
{ "a" : "sheep" } -->> { "a" : { $maxKey : 1 } } on : shard0000 Timestamp(1000, 5)
473+
{ "_id" : "test", "partitioned" : false, "primary" : "shard0000" }
474+
486475
Chunk Management
487476
----------------
488477

@@ -635,7 +624,9 @@ To create and migrate chunks manually, use the following procedure:
635624
}
636625

637626
You can also let the balancer automatically distribute the new
638-
chunks.
627+
chunks. For an introduction to balancing, see
628+
:ref:`sharding-balancing`. For lower level information on balancing,
629+
see :ref:`sharding-balancing-internals`.
639630

640631
.. _sharding-balancing-modify-chunk-size:
641632

@@ -654,7 +645,7 @@ To modify the chunk size, use the following procedure:
654645
#. Connect to any :program:`mongos` in the cluster using the
655646
:program:`mongo` shell.
656647

657-
#. Issue the following command to switch to the config database:
648+
#. Issue the following command to switch to the :ref:`config-database`:
658649

659650
.. code-block:: javascript
660651

@@ -710,9 +701,9 @@ However, you may want to migrate chunks manually in a few cases:
710701
- If the balancer in an active cluster cannot distribute chunks within
711702
the balancing window, then you will have to migrate chunks manually.
712703

713-
See the :ref:`chunk migration <sharding-chunk-migration>` section to
714-
understand the internal process of how chunks move
715-
between shards.
704+
For more information on how chunks move between shards, see
705+
:ref:`sharding-balancing-internals`, in particular the section
706+
:ref:`sharding-chunk-migration`.
716707

717708
To migrate chunks, use the :dbcommand:`moveChunk` command.
718709

@@ -773,12 +764,10 @@ to pre-splitting.
773764
Balancer Operations
774765
-------------------
775766

776-
This section provides an overview of common administrative procedures
777-
related to balancing and the balancing process.
778-
779-
.. seealso:: :ref:`sharding-balancing` and the
780-
:dbcommand:`moveChunk` that provides manual :term:`chunk`
781-
migrations.
767+
This section describes provides common administrative procedures related
768+
to balancing. For an introduction to balancing, see
769+
:ref:`sharding-balancing`. For lower level information on balancing, see
770+
:ref:`sharding-balancing-internals`.
782771

783772
.. _sharding-balancing-check-lock:
784773

@@ -791,7 +780,7 @@ To see if the balancer process is active in your :term:`cluster
791780
#. Connect to any :program:`mongos` in the cluster using the
792781
:program:`mongo` shell.
793782

794-
#. Issue the following command to switch to the config database:
783+
#. Issue the following command to switch to the :ref:`config-database`:
795784

796785
.. code-block:: javascript
797786

@@ -856,7 +845,7 @@ be able to migrate chunks:
856845
#. Connect to any :program:`mongos` in the cluster using the
857846
:program:`mongo` shell.
858847

859-
#. Issue the following command to switch to the config database:
848+
#. Issue the following command to switch to the :ref:`config-database`:
860849

861850
.. code-block:: javascript
862851

@@ -942,7 +931,7 @@ run this operation from a driver that does not have helper functions:
942931
#. Connect to any :program:`mongos` in the cluster using the
943932
:program:`mongo` shell.
944933

945-
#. Issue the following command to switch to the config database:
934+
#. Issue the following command to switch to the :ref:`config-database`:
946935

947936
.. code-block:: javascript
948937

@@ -1000,7 +989,7 @@ three config servers.
1000989
#. Copy the entire :setting:`dbpath` file system tree from the
1001990
existing config server to the two machines that will provide the
1002991
additional config servers. These commands, issued on the system
1003-
with the existing config database, ``mongo-config0.example.net`` may
992+
with the existing :ref:`config-database`, ``mongo-config0.example.net`` may
1004993
resemble the following:
1005994

1006995
.. code-block:: sh
@@ -1062,7 +1051,7 @@ as needed.
10621051
Migrate Config Servers with Different Hostnames
10631052
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
10641053

1065-
Use this process when you need to migrate a config database to a new
1054+
Use this process when you need to migrate a :ref:`config-database` to a new
10661055
server and it *will not* be accessible via the same hostname. If
10671056
possible, avoid changing the hostname so that you can use the
10681057
:ref:`previous procedure <sharding-process-config-server-migrate-same-hostname>`.
@@ -1088,7 +1077,7 @@ possible, avoid changing the hostname so that you can use the
10881077
that provide your shards.
10891078

10901079
- the :program:`mongod` instances that provide your existing
1091-
config databases.
1080+
:ref:`config databases <config-database>`.
10921081

10931082
- all :program:`mongos` instances in your cluster.
10941083

@@ -1139,7 +1128,7 @@ Backup Cluster Metadata
11391128
~~~~~~~~~~~~~~~~~~~~~~~
11401129

11411130
The cluster will remain operational [#read-only]_ without one
1142-
of the config databases :program:`mongod` instances, creating a backup
1131+
of the config database's :program:`mongod` instances, creating a backup
11431132
of the cluster metadata from the config database is straight forward:
11441133

11451134
#. Shut down one of the :term:`config databases <config database>`.

0 commit comments

Comments
 (0)