Skip to content

Commit 2a9e016

Browse files
author
Bob Grabar
committed
302 view shard info procedures
1 parent 6dc5e78 commit 2a9e016

File tree

1 file changed

+44
-25
lines changed

1 file changed

+44
-25
lines changed

source/administration/sharding.txt

Lines changed: 44 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ use the following procedure as a quick starting point:
7777

7878
mongo mongos0.example.net
7979

80-
#. Add shards to the cluster.
80+
#. Add shards to the cluster.
8181

8282
.. note:: In production deployments, all shards should be replica sets.
8383

@@ -217,25 +217,19 @@ To list the databases for which sharding is enabled, query the
217217
.. code-block:: javascript
218218

219219
use config
220-
221220
db.databases.find()
222221

223222
Given the following example output:
224223

225224
.. code-block:: javascript
226225

227226
{ "_id" : "admin", "partitioned" : false, "primary" : "config" }
228-
229227
{ "_id" : "foo", "partitioned" : true, "primary" : "example1.com:30001" }
230-
231228
{ "_id" : "baz", "partitioned" : false, "primary" : "example2.com:27017" }
232229

233230
Only the database `foo` has sharding enabled because only `foo` has
234231
the ``partitioned`` field set to ``true``.
235232

236-
.. note:: If a database in a sharded environment does not have sharding
237-
enabled, all its data is on the first shard of the cluster.
238-
239233
List Shards
240234
~~~~~~~~~~~
241235

@@ -247,33 +241,58 @@ command:
247241

248242
db.runCommand( { listshards : 1 } )
249243

250-
.. _sharding-procedure-add-shard:
251-
252-
253-
254-
255-
256-
257-
258-
259-
260-
261-
262-
263-
264-
265-
266-
267-
244+
View Cluster Details
245+
~~~~~~~~~~~~~~~~~~~~
268246

247+
To view cluster details, issue :method:`db.printShardingStatus()` or
248+
:method:`sh.status()`. Both methods return the same output.
269249

250+
.. example:: In the following example output from :method:`sh.status()`
270251

252+
- ``sharding version`` displays the version number of the shard
253+
metadata.
271254

255+
- ``shards`` displays each :program:`mongod` instance that is used as
256+
a shard.
272257

258+
- ``databases`` displays all databases living in the cluster,
259+
including databases for which sharding is not enabled.
273260

261+
- The ``chunks`` information for the ``foo`` database displays how
262+
many chunks are on each shard and displays the range of each chunk.
274263

264+
.. code-block:: javascript
275265

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" }
276294

295+
.. _sharding-procedure-add-shard:
277296

278297
Add a Shard to a Cluster
279298
~~~~~~~~~~~~~~~~~~~~~~~~

0 commit comments

Comments
 (0)