From 207e6bb37604822d47b0a5082a38148efa7fe634 Mon Sep 17 00:00:00 2001 From: kay Date: Tue, 8 Jan 2013 17:50:22 -0500 Subject: [PATCH 1/2] DOCS-920 add info to getShardDistribution method --- source/reference/javascript.txt | 2 +- .../db.collection.getShardDistribution.txt | 100 ++++++++++++++++++ .../reference/method/getShardDistribution.txt | 9 -- 3 files changed, 101 insertions(+), 10 deletions(-) create mode 100644 source/reference/method/db.collection.getShardDistribution.txt delete mode 100644 source/reference/method/getShardDistribution.txt diff --git a/source/reference/javascript.txt b/source/reference/javascript.txt index 6e8170a25de..678bf5061f4 100644 --- a/source/reference/javascript.txt +++ b/source/reference/javascript.txt @@ -282,7 +282,7 @@ that you may use with collection objects. .. include:: method/getShardVersion.txt :start-after: mongodb -.. include:: method/getShardDistribution.txt +.. include:: method/db.collection.getShardDistribution.txt :start-after: mongodb .. include:: method/db.collection.stats.txt diff --git a/source/reference/method/db.collection.getShardDistribution.txt b/source/reference/method/db.collection.getShardDistribution.txt new file mode 100644 index 00000000000..a765280f257 --- /dev/null +++ b/source/reference/method/db.collection.getShardDistribution.txt @@ -0,0 +1,100 @@ +==================================== +db.collection.getShardDistribution() +==================================== + +.. default-domain:: mongodb + +.. method:: db.collection.getShardDistribution() + + Prints the data distribution statistics for a :term:`sharded + ` collection. You must call the + :method:`~db.collection.getShardDistibution()` method on a sharded + collection, as in the following example: + + .. code-block:: javascript + + db.myShardedCollection.getShardDistribution() + + In the example, the collection ``myShardedCollection`` has two + shards. The output displays both the individual shard distribution + information as well the total shard distribution: + + .. code-block:: sh + + Shard at + data : docs : chunks : + estimated data per chunk : / + estimated docs per chunk : / + + Shard at + data : docs : chunks : + estimated data per chunk : / + estimated docs per chunk : / + + Totals + data : docs : chunks : + Shard contains % data, % docs in cluster, avg obj size on shard : stats.shards[ ].avgObjSize + Shard contains % data, % docs in cluster, avg obj size on shard : stats.shards[ ].avgObjSize + + The output information displays: + + - ```` is a string value that returns the shard name. + + - ```` is a string value that returns the host name(s). + + - ```` is a numeric value that returns the size of the data, + including the unit of measure (e.g. ``b``, ``Mb``). + + - ```` is a numeric value that returns the number of + documents in the shard. + + - ```` is a numeric value that returns the + number of chunks in the shard. + + - ``/`` is a calculated numeric value + that returns the estimated data size per chunk for the shard, + including the unit of measure (e.g. ``b``, ``Mb``). + + - ``/`` is a calculated numeric value + that returns the estimated number of documents per chunk for the + shard. + + - ```` is a numeric value that returns the total size of + the data in the sharded collection, including the unit of measure. + + - ```` is a numeric value that returns the total number + of documents in the sharded collection. + + - ```` is a calculated numeric value that adds + the number of chunks from the shards, for example: + + .. code-block:: sh + + = + + + - ```` is a calculated numeric value that + calculates, for each shard, its data size as the percentage of the + collection's total data size, for example: + + .. code-block:: sh + + = / + + - ```` is a calculated numeric value that + calculates, for each shard, the number of documents as the + percentage of the total number of documents for the collection, + for example: + + .. code-block:: sh + + = / + + - ``stats.shards[ ].avgObjSize`` is a numeric value that + returns the average object size, including the unit of measure, + for the shard. + + .. seealso:: :doc:`/sharding` + +.. COMMENT -- not sure if I should mention the source of the data: + ``shards`` collection and the ``chunks`` collection in the ``config`` database + and from the :method:`db.collection.stats()` method. diff --git a/source/reference/method/getShardDistribution.txt b/source/reference/method/getShardDistribution.txt deleted file mode 100644 index 90e9b674642..00000000000 --- a/source/reference/method/getShardDistribution.txt +++ /dev/null @@ -1,9 +0,0 @@ -====================== -getShardDistribution() -====================== - -.. default-domain:: mongodb - -.. method:: getShardDistribution() - - See :issue:`SERVER-4902` for more information. From 03164f80280f1366275c06b7fb72975c508a94b3 Mon Sep 17 00:00:00 2001 From: kay Date: Mon, 14 Jan 2013 10:56:26 -0500 Subject: [PATCH 2/2] DOCS-920 getShardDistribution method, including sample output --- .../db.collection.getShardDistribution.txt | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/source/reference/method/db.collection.getShardDistribution.txt b/source/reference/method/db.collection.getShardDistribution.txt index a765280f257..c15858daecb 100644 --- a/source/reference/method/db.collection.getShardDistribution.txt +++ b/source/reference/method/db.collection.getShardDistribution.txt @@ -93,6 +93,26 @@ db.collection.getShardDistribution() returns the average object size, including the unit of measure, for the shard. + For example, the following is a sample output for the distribution + of a sharded collection: + + .. code-block:: sh + + Shard shard-a at shard-a/MyMachine.local:30000,MyMachine.local:30001,MyMachine.local:30002 + data : 38.14Mb docs : 1000003 chunks : 2 + estimated data per chunk : 19.07Mb + estimated docs per chunk : 500001 + + Shard shard-b at shard-b/MyMachine.local:30100,MyMachine.local:30101,MyMachine.local:30102 + data : 38.14Mb docs : 999999 chunks : 3 + estimated data per chunk : 12.71Mb + estimated docs per chunk : 333333 + + Totals + data : 76.29Mb docs : 2000002 chunks : 5 + Shard shard-a contains 50% data, 50% docs in cluster, avg obj size on shard : 40b + Shard shard-b contains 49.99% data, 49.99% docs in cluster, avg obj size on shard : 40b + .. seealso:: :doc:`/sharding` .. COMMENT -- not sure if I should mention the source of the data: