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..c15858daecb --- /dev/null +++ b/source/reference/method/db.collection.getShardDistribution.txt @@ -0,0 +1,120 @@ +==================================== +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. + + 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: + ``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.