From 57a8cd7f97e0aa370db750f67e6c572e23d5b428 Mon Sep 17 00:00:00 2001 From: Zack Brown Date: Wed, 14 Aug 2013 14:09:13 -0400 Subject: [PATCH] DOCS-1775: Add some caution notes regarding creating a new hashed collection --- ...ard-collection-with-a-hashed-shard-key.txt | 29 ++++++++++++------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/source/tutorial/shard-collection-with-a-hashed-shard-key.txt b/source/tutorial/shard-collection-with-a-hashed-shard-key.txt index 53cfbdfaa15..1a0d74be62e 100644 --- a/source/tutorial/shard-collection-with-a-hashed-shard-key.txt +++ b/source/tutorial/shard-collection-with-a-hashed-shard-key.txt @@ -4,6 +4,10 @@ Shard a Collection Using a Hashed Shard Key .. default-domain:: mongodb +.. contents:: + :backlinks: none + :local: + .. versionadded:: 2.4 :ref:`Hashed shard keys ` use a :ref:`hashed @@ -14,11 +18,15 @@ For tips on choosing the right field as your hashed shard key, see :ref:`sharding-hashed-sharding`. For limitations on hashed indexes, see :ref:`index-hashed-index`. -Basic Procedure ---------------- +.. note:: If chunk migrations are in progress while creating a hashed shard key + collection, the initial chunk distribution may be unbalanced until the + balancer automatically balances the collection. + +Shard the Collection +-------------------- -To shard a collection using a hashed shard key, issue an operation in -the :program:`mongo` shell that resembles the following: +Do an operation in the :program:`mongo` shell that resembles the +following: .. code-block:: javascript @@ -31,14 +39,15 @@ Specify the Initial Number of Chunks ------------------------------------ If you shard an empty collection using a hashed shard key, MongoDB -automatically creates and migrate chunks so that each shard has two -chunks. You can control how many chunks MongoDB creates sharding the -collection using :dbcommand:`shardCollection` with the +automatically creates and migrates empty chunks so that each shard +has two chunks. To control how many chunks MongoDB creates when +sharding the collection, use :dbcommand:`shardCollection` with the ``numInitialChunks`` parameter. -.. include:: /includes/warning-hashed-index-floating-point.rst - -.. important:: MongoDB 2.4 add support for hashed shard keys. After +.. important:: MongoDB 2.4 adds support for hashed shard keys. After sharding a collection with a hashed shard key, you must use the MongoDB 2.4 or higher :program:`mongos` and :program:`mongod` instances in your sharded cluster. + +.. include:: /includes/warning-hashed-index-floating-point.rst +