From 8eb8c5d3642d23d6152ee9c7f31a87042c21901e Mon Sep 17 00:00:00 2001 From: Andrew Leung Date: Thu, 9 Aug 2012 10:49:39 -0400 Subject: [PATCH 1/9] minor wording revisions to intro --- source/administration/sharding.txt | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/source/administration/sharding.txt b/source/administration/sharding.txt index 2a940f627d1..34949cabe58 100644 --- a/source/administration/sharding.txt +++ b/source/administration/sharding.txt @@ -415,12 +415,13 @@ need to create and manipulate chunks directly. Splitting Chunks ~~~~~~~~~~~~~~~~ -Normally, MongoDB splits a :term:`chunk` following inserts or updates -when a chunk exceeds the :ref:`chunk size `. +Normally, MongoDB splits a :term:`chunk` when a chunk exceeds the +:ref:`chunk size ` following inserts or updates. + You may want to split chunks manually if: -- you have a large amount of data in your cluster that is *not* split, +- you have a large amount of data in your cluster that is in a single :term:`chunk`, as is the case after creating a shard cluster with existing data. - you expect to add a large amount of data that would @@ -453,8 +454,8 @@ These helpers wrap the :dbcommand:`split` command. that matches this query into two equal components. MongoDB will split the chunk so that documents that have half of the shard keys in will be in one chunk and the documents that have other half of the shard -keys will be a second chunk. The query in :func:`sh.splitFind()` need -not contain the shard key, though it almost always makes sense to +keys will be a second chunk. The query in :func:`sh.splitFind()` may +not be based on the shard key, though it almost always makes sense to query for the shard key in this case, and including the shard key will expedite the operation. From 861d11238cef37a38606d44e23a15f473c9b649a Mon Sep 17 00:00:00 2001 From: Andrew Leung Date: Sun, 19 Aug 2012 20:57:24 -0400 Subject: [PATCH 2/9] adding in split command description --- source/administration/sharding.txt | 58 +++++++++++++++++++++--------- 1 file changed, 42 insertions(+), 16 deletions(-) diff --git a/source/administration/sharding.txt b/source/administration/sharding.txt index 34949cabe58..d7576f4dc76 100644 --- a/source/administration/sharding.txt +++ b/source/administration/sharding.txt @@ -404,11 +404,11 @@ stop the processes comprising the ``mongodb0`` shard. Chunk Management ---------------- -This section describes various operations on -:term:`chunks ` in :term:`shard clusters `. In -most cases MongoDB automates these processes; however, in some cases, -particularly when you're setting up a shard cluster, you may -need to create and manipulate chunks directly. +This section describes various operations on :term:`chunks ` in +:term:`shard clusters `. MongoDB automates these +processes; however, in some cases, particularly when you're setting up +a shard cluster, you may need to create and manipulate chunks +directly. .. _sharding-procedure-create-split: @@ -416,27 +416,53 @@ Splitting Chunks ~~~~~~~~~~~~~~~~ Normally, MongoDB splits a :term:`chunk` when a chunk exceeds the -:ref:`chunk size ` following inserts or updates. - +:ref:`chunk size ` following inserts or +updates. Recently split chunks may be moved immediately to a new shard +if :program:`mongos` predicts future insertions will benefit from the move. You may want to split chunks manually if: - you have a large amount of data in your cluster that is in a single :term:`chunk`, - as is the case after creating a shard cluster with existing data. + as is the case after creating a shard cluster from existing data. - you expect to add a large amount of data that would initially reside in a single chunk or shard. .. example:: - You plan to insert a large amount of data as the result of an - import process with :term:`shard key` values between ``300`` and - ``400``, *but* all values of your shard key between ``250`` and - ``500`` are within a single chunk. + You plan to insert a large amount of data with :term:`shard key` values between ``300`` and + ``400``, *but* all values of your shard keys between ``250`` and + ``500`` are in a single chunk. -Use :func:`sh.status()` to determine the current chunks ranges across +Use :func:`sh.status()` to determine the current chunk ranges across the cluster. +---- + +Split chunks in a collection using the :dbcommand:`split` +command, the command prototype is: + +.. code-block:: + + db.runCommand( { split: , middle: { : } } ) + +:dbcommand:`split` will divide a chunk in the middle of the specified +field and value. + +Data presplitting is useful to reduce system load when a high number +of inserts are expected. The system will not have to perform splitting +as the split can be made before-hand. The :dbcommand:`split` command +can be used to perform data presplitting by running the +:dbcommand:`split` command on a non-existent shard key value. + +.. code-block:: + + db. + + + +---- + To split chunks manually, use either the :func:`sh.splitAt()` or :func:`sh.splitFind()` helpers in the :program:`mongo` shell. These helpers wrap the :dbcommand:`split` command. @@ -452,9 +478,9 @@ These helpers wrap the :dbcommand:`split` command. :func:`sh.splitFind()` will split the chunk that contains the *first* document returned that matches this query into two equal components. MongoDB will split -the chunk so that documents that have half of the shard keys in will -be in one chunk and the documents that have other half of the shard -keys will be a second chunk. The query in :func:`sh.splitFind()` may +the chunk so that documents with half of the shard keys will +be in one chunk and the documents with the other half of the shard +keys will be in the second chunk. The query in :func:`sh.splitFind()` may not be based on the shard key, though it almost always makes sense to query for the shard key in this case, and including the shard key will expedite the operation. From 0e967e220d40d369590ba5d71814fa3cd9f4fe76 Mon Sep 17 00:00:00 2001 From: Andrew Leung Date: Mon, 20 Aug 2012 16:56:24 -0400 Subject: [PATCH 3/9] added info from wiki - DOCS-304 --- source/administration/sharding.txt | 98 ++++++++++++++++++------------ 1 file changed, 59 insertions(+), 39 deletions(-) diff --git a/source/administration/sharding.txt b/source/administration/sharding.txt index d7576f4dc76..3c7e643487a 100644 --- a/source/administration/sharding.txt +++ b/source/administration/sharding.txt @@ -418,7 +418,13 @@ Splitting Chunks Normally, MongoDB splits a :term:`chunk` when a chunk exceeds the :ref:`chunk size ` following inserts or updates. Recently split chunks may be moved immediately to a new shard -if :program:`mongos` predicts future insertions will benefit from the move. +if :program:`mongos` predicts future insertions will benefit from the +move. The :program:`balancer` treats all chunks the same, whether +split manually or automatically by the system. + +.. warning:: + + You cannot merge or combine chunks once you have split them. You may want to split chunks manually if: @@ -430,51 +436,40 @@ You may want to split chunks manually if: .. example:: - You plan to insert a large amount of data with :term:`shard key` values between ``300`` and - ``400``, *but* all values of your shard keys between ``250`` and - ``500`` are in a single chunk. + You plan to insert a large amount of data with :term:`shard key` + values between ``300`` and ``400``, *but* all values of your shard + keys are between ``250`` and ``500`` are in a single chunk. -Use :func:`sh.status()` to determine the current chunk ranges across -the cluster. +To determine the current chunk ranges across the cluster, use +:func:`sh.status()` or :dbcommand:`db.printShardingStatus()`. ----- +Split chunks in a collection using the :dbcommand:`split` command with +operators: ``middle`` and ``find``. The equivalent shell helpers are +:func:`sh.splitAt()` or :func:`sh.splitFind()`. -Split chunks in a collection using the :dbcommand:`split` -command, the command prototype is: +To divide the chunk in the middle of the specified field and value, +operator is: -.. code-block:: +.. code-block:: javascript db.runCommand( { split: , middle: { : } } ) -:dbcommand:`split` will divide a chunk in the middle of the specified -field and value. - -Data presplitting is useful to reduce system load when a high number -of inserts are expected. The system will not have to perform splitting -as the split can be made before-hand. The :dbcommand:`split` command -can be used to perform data presplitting by running the -:dbcommand:`split` command on a non-existent shard key value. - -.. code-block:: - - db. - - - ----- - -To split chunks manually, use either the :func:`sh.splitAt()` or -:func:`sh.splitFind()` helpers in the :program:`mongo` shell. -These helpers wrap the :dbcommand:`split` command. - .. example:: The following command will split the chunk that contains - the value of ``63109`` for the ``zipcode`` field: + the value of ``10012`` for the ``zipcode`` field: .. code-block:: javascript - sh.splitFind( { "zipcode": 63109 } ) + sh.splitFind( { "zipcode": 10012 } ) + +Use :dbcommand:`split` with ``find`` operator or :func:`sh.splitAt()` +to split a chunk in two using the queried document as the partition +point: + +.. code-block:: javascript + + sh.splitAt( { "zipcode": 63109 } ) :func:`sh.splitFind()` will split the chunk that contains the *first* document returned that matches this query into two equal components. MongoDB will split @@ -489,16 +484,41 @@ However, the location of the document that this query finds with respect to the other documents in the chunk does not affect how the chunk splits. -Use :func:`sh.splitAt()` to split a chunk in two using the queried -document as the partition point: +Pre-splitting Chunks +~~~~~~~~~~~~~~~~~~~~ -.. code-block:: javascript +For large data migrations, pre-splitting chunks will dramatically +improve import performance. By pre-splitting chunks, system overhead +is reduced as new chunks are not created while new data is being inserted. - sh.splitAt( { "zipcode": 63109 } ) +#. Make many chunks by splitting empty chunks in your + collection. Chunks do not require data in order for them to be + split. -.. warning:: + .. example:: - You cannot merge or combine chunks once you have split them. + To pre-split chunks for 100 million user profiles sharded by + email address for 5 shards, run the following commands in the + mongo shell: + + .. code-block:: javascript + + for ( var x=97; x<97+26; x++ ){ + for( var y=97; y<97+26; y+=6 ) { + var prefix = String.fromCharCode(x) + String.fromCharCode(y); + db.runCommand( { split : , middle : { email : prefix } } ); + } + } + +#. Move chunks to different shard by letting the balancer move the + chunks or performing the move manually. + +#. Insert data by :program:`mongoimport`. + +.. note:: + + Indexing the collection after :program:`mongoimport` will also + improve performance. .. _sharding-balancing-modify-chunk-size: From e6738488135a458956ae8dfb0f7f14fcae7f3bf6 Mon Sep 17 00:00:00 2001 From: Andrew Leung Date: Mon, 20 Aug 2012 17:01:46 -0400 Subject: [PATCH 4/9] minor updates to wiki migration - DOCS-304 --- source/administration/sharding.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/administration/sharding.txt b/source/administration/sharding.txt index 3c7e643487a..eca95d07a55 100644 --- a/source/administration/sharding.txt +++ b/source/administration/sharding.txt @@ -448,7 +448,7 @@ operators: ``middle`` and ``find``. The equivalent shell helpers are :func:`sh.splitAt()` or :func:`sh.splitFind()`. To divide the chunk in the middle of the specified field and value, -operator is: +the prototype command is: .. code-block:: javascript @@ -457,11 +457,11 @@ operator is: .. example:: The following command will split the chunk that contains - the value of ``10012`` for the ``zipcode`` field: + the value of ``63109`` for the ``zipcode`` field: .. code-block:: javascript - sh.splitFind( { "zipcode": 10012 } ) + sh.splitFind( { "zipcode": 63109 } ) Use :dbcommand:`split` with ``find`` operator or :func:`sh.splitAt()` to split a chunk in two using the queried document as the partition From 236163e21b944bb059a797421ac4a65643314a8e Mon Sep 17 00:00:00 2001 From: Andrew Leung Date: Tue, 21 Aug 2012 16:41:42 -0400 Subject: [PATCH 5/9] splitting chunks revision --- source/administration/sharding.txt | 73 +++++++++++++----------------- 1 file changed, 32 insertions(+), 41 deletions(-) diff --git a/source/administration/sharding.txt b/source/administration/sharding.txt index eca95d07a55..8bce1173a62 100644 --- a/source/administration/sharding.txt +++ b/source/administration/sharding.txt @@ -416,11 +416,13 @@ Splitting Chunks ~~~~~~~~~~~~~~~~ Normally, MongoDB splits a :term:`chunk` when a chunk exceeds the -:ref:`chunk size ` following inserts or -updates. Recently split chunks may be moved immediately to a new shard +:ref:`chunk size `. +Recently split chunks may be moved immediately to a new shard if :program:`mongos` predicts future insertions will benefit from the -move. The :program:`balancer` treats all chunks the same, whether -split manually or automatically by the system. +move. + +The MongoDB treats all chunks the same, whether split manually or +automatically by the system. .. warning:: @@ -428,7 +430,8 @@ split manually or automatically by the system. You may want to split chunks manually if: -- you have a large amount of data in your cluster that is in a single :term:`chunk`, +- you have a large amount of data in your cluster and very few + :term:`chunks `, as is the case after creating a shard cluster from existing data. - you expect to add a large amount of data that would @@ -441,19 +444,12 @@ You may want to split chunks manually if: keys are between ``250`` and ``500`` are in a single chunk. To determine the current chunk ranges across the cluster, use -:func:`sh.status()` or :dbcommand:`db.printShardingStatus()`. +:func:`sh.status()` or :func:`db.printShardingStatus()`. Split chunks in a collection using the :dbcommand:`split` command with operators: ``middle`` and ``find``. The equivalent shell helpers are :func:`sh.splitAt()` or :func:`sh.splitFind()`. -To divide the chunk in the middle of the specified field and value, -the prototype command is: - -.. code-block:: javascript - - db.runCommand( { split: , middle: { : } } ) - .. example:: The following command will split the chunk that contains @@ -463,7 +459,15 @@ the prototype command is: sh.splitFind( { "zipcode": 63109 } ) -Use :dbcommand:`split` with ``find`` operator or :func:`sh.splitAt()` +:func:`sh.splitFind()` will split the chunk that contains the *first* document returned +that matches this query into two equal chunks and each will contain +approximately half of the documents with the shard key. +The query in :func:`sh.splitFind()` may +not be based on the shard key, though it almost always makes sense to +query for the shard key in this case, and including the shard key will +expedite the operation. + +Use :dbcommand:`split` with ``middle`` operator or :func:`sh.splitAt()` to split a chunk in two using the queried document as the partition point: @@ -471,14 +475,7 @@ point: sh.splitAt( { "zipcode": 63109 } ) -:func:`sh.splitFind()` will split the chunk that contains the *first* document returned -that matches this query into two equal components. MongoDB will split -the chunk so that documents with half of the shard keys will -be in one chunk and the documents with the other half of the shard -keys will be in the second chunk. The query in :func:`sh.splitFind()` may -not be based on the shard key, though it almost always makes sense to -query for the shard key in this case, and including the shard key will -expedite the operation. +.. TODO I would like to have clear explaination between splitAt and splitFind However, the location of the document that this query finds with respect to the other documents in the chunk does not affect how the @@ -487,13 +484,12 @@ chunk splits. Pre-splitting Chunks ~~~~~~~~~~~~~~~~~~~~ -For large data migrations, pre-splitting chunks will dramatically -improve import performance. By pre-splitting chunks, system overhead -is reduced as new chunks are not created while new data is being inserted. +For large data imports, pre-splitting and pre-migrating many chunks +will dramatically improve performance because the system does not need +to split and migrate new chunks during data import. #. Make many chunks by splitting empty chunks in your - collection. Chunks do not require data in order for them to be - split. + collection. .. example:: @@ -503,22 +499,17 @@ is reduced as new chunks are not created while new data is being inserted. .. code-block:: javascript - for ( var x=97; x<97+26; x++ ){ - for( var y=97; y<97+26; y+=6 ) { - var prefix = String.fromCharCode(x) + String.fromCharCode(y); - db.runCommand( { split : , middle : { email : prefix } } ); - } - } - -#. Move chunks to different shard by letting the balancer move the - chunks or performing the move manually. + for ( var x=97; x<97+26; x++ ){ + for( var y=97; y<97+26; y+=6 ) { + var prefix = String.fromCharCode(x) + String.fromCharCode(y); + db.runCommand( { split : , middle : { email : prefix } } ); + } + } -#. Insert data by :program:`mongoimport`. - -.. note:: +#. Move chunks to different shard by letting the balancer move them or + performing the move manually. - Indexing the collection after :program:`mongoimport` will also - improve performance. +#. Insert data using :program:`mongoimport` or . .. _sharding-balancing-modify-chunk-size: From f11feef855872284047d44f22446242a0f1ef413 Mon Sep 17 00:00:00 2001 From: Andrew Leung Date: Tue, 21 Aug 2012 18:22:45 -0400 Subject: [PATCH 6/9] draft for split chunks --- source/administration/sharding.txt | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/source/administration/sharding.txt b/source/administration/sharding.txt index 8bce1173a62..7bbb5f5571f 100644 --- a/source/administration/sharding.txt +++ b/source/administration/sharding.txt @@ -460,23 +460,19 @@ operators: ``middle`` and ``find``. The equivalent shell helpers are sh.splitFind( { "zipcode": 63109 } ) :func:`sh.splitFind()` will split the chunk that contains the *first* document returned -that matches this query into two equal chunks and each will contain -approximately half of the documents with the shard key. +that matches this query into two equal sized chunks. The query in :func:`sh.splitFind()` may not be based on the shard key, though it almost always makes sense to query for the shard key in this case, and including the shard key will expedite the operation. -Use :dbcommand:`split` with ``middle`` operator or :func:`sh.splitAt()` -to split a chunk in two using the queried document as the partition -point: +Use :func:`sh.splitAt()` to split a chunk in two using the queried +document as the partition point: .. code-block:: javascript sh.splitAt( { "zipcode": 63109 } ) -.. TODO I would like to have clear explaination between splitAt and splitFind - However, the location of the document that this query finds with respect to the other documents in the chunk does not affect how the chunk splits. @@ -484,9 +480,9 @@ chunk splits. Pre-splitting Chunks ~~~~~~~~~~~~~~~~~~~~ -For large data imports, pre-splitting and pre-migrating many chunks +For large imports, pre-splitting and pre-migrating many chunks will dramatically improve performance because the system does not need -to split and migrate new chunks during data import. +to split and migrate new chunks during import. #. Make many chunks by splitting empty chunks in your collection. @@ -506,10 +502,10 @@ to split and migrate new chunks during data import. } } -#. Move chunks to different shard by letting the balancer move them or - performing the move manually. +#. Move chunks to different shard by using the balancer or manually + moving chunks. -#. Insert data using :program:`mongoimport` or . +#. Insert data into the shard cluster using a custom script for your data. .. _sharding-balancing-modify-chunk-size: From 06dcd6147f6435260acc1f7b6c9e199cbb4f6d90 Mon Sep 17 00:00:00 2001 From: Andrew Leung Date: Mon, 27 Aug 2012 17:17:11 -0400 Subject: [PATCH 7/9] rewriting pre-split section and cleaning up other parts --- source/administration/sharding.txt | 90 ++++++++++++++++++++++-------- 1 file changed, 67 insertions(+), 23 deletions(-) diff --git a/source/administration/sharding.txt b/source/administration/sharding.txt index 7bbb5f5571f..62d587d7850 100644 --- a/source/administration/sharding.txt +++ b/source/administration/sharding.txt @@ -415,10 +415,10 @@ directly. Splitting Chunks ~~~~~~~~~~~~~~~~ -Normally, MongoDB splits a :term:`chunk` when a chunk exceeds the -:ref:`chunk size `. -Recently split chunks may be moved immediately to a new shard -if :program:`mongos` predicts future insertions will benefit from the +Normally, MongoDB splits a :term:`chunk` following inserts when a +chunk exceeds the :ref:`chunk size `. Recently +split chunks may be moved immediately to a new shard if +:program:`mongos` predicts future insertions will benefit from the move. The MongoDB treats all chunks the same, whether split manually or @@ -444,9 +444,9 @@ You may want to split chunks manually if: keys are between ``250`` and ``500`` are in a single chunk. To determine the current chunk ranges across the cluster, use -:func:`sh.status()` or :func:`db.printShardingStatus()`. +:func:`sh.status()` or :func:`db.printShardingStatus()`. -Split chunks in a collection using the :dbcommand:`split` command with +To split chunks manually, use the :dbcommand:`split` command with operators: ``middle`` and ``find``. The equivalent shell helpers are :func:`sh.splitAt()` or :func:`sh.splitFind()`. @@ -459,12 +459,11 @@ operators: ``middle`` and ``find``. The equivalent shell helpers are sh.splitFind( { "zipcode": 63109 } ) -:func:`sh.splitFind()` will split the chunk that contains the *first* document returned -that matches this query into two equal sized chunks. -The query in :func:`sh.splitFind()` may -not be based on the shard key, though it almost always makes sense to -query for the shard key in this case, and including the shard key will -expedite the operation. +:func:`sh.splitFind()` will split the chunk containing the queried +document into two equal sized chunks, dividing the chunk using the +balancer algorithm. The :func:`sh.splitFind()` query may not be based +on the shard key, but it makes sense to use the shard key, and +including the shard key will expedite the operation. Use :func:`sh.splitAt()` to split a chunk in two using the queried document as the partition point: @@ -477,15 +476,40 @@ However, the location of the document that this query finds with respect to the other documents in the chunk does not affect how the chunk splits. -Pre-splitting Chunks -~~~~~~~~~~~~~~~~~~~~ +Pre-Split +~~~~~~~~~ + +Splitting chunks will improve shard cluster performance when importing +data such as: + +- migrating data from another system to a shard cluster + +- performing a full shard cluster restore from back up + +In such cases, data import to an empty MongoDB shard cluster can +become slower than to a replica set. The reason for this is how +MongoDB writes data and manage chunks in a shard cluster. -For large imports, pre-splitting and pre-migrating many chunks -will dramatically improve performance because the system does not need -to split and migrate new chunks during import. +MongoDB inserts data into a chunk unti it becomes large and splits on +the same shard. If the balancer notices a chunk imbalance between +shards, a migration process will begin to evenly distribute chunks. -#. Make many chunks by splitting empty chunks in your - collection. +Migrating chunks between shards is extremely resource intensive as +shard members must notify, copy, update, and delete chunks between +each other and the configuration database. With a high volume import, +this migration process can reduce system performance so that imports +cannot occur because of migrations. + +To improve import performance, manually split and migrate chunks in an +empty shard cluster beforehand. This allows the shard cluster to only +write import data instead of trying to manage migrations and write +data. + +To prepare your shard cluster for data import, split and migrate +empty chunks. + +#. Split empty chunks in your collection by manually performing + :dbcommand:`split` command on chunks. .. example:: @@ -498,14 +522,34 @@ to split and migrate new chunks during import. for ( var x=97; x<97+26; x++ ){ for( var y=97; y<97+26; y+=6 ) { var prefix = String.fromCharCode(x) + String.fromCharCode(y); - db.runCommand( { split : , middle : { email : prefix } } ); + db.runCommand( { split : "myapp.users" , middle : { email : prefix } } ); } } -#. Move chunks to different shard by using the balancer or manually - moving chunks. +#. Move chunks to different shard manually using the + :dbcommand:`moveChunk` command. + + .. example:: + + To migrate all the chunks created for 100 million user profiles + evenly, putting each prefix chunk on the next shard from the + other , run the following commands in the mongo shell: + + .. code-block:: javascript + + var shServer = [ "sh0.example.net", "sh1.example.net", "sh2.example.net", "sh3.example.net", "sh4.example.net" ]; + for ( var x=97; x<97+26; x++ ){ + for( var y=97; y<97+26; y+=6 ) { + var prefix = String.fromCharCode(x) + String.fromCharCode(y); + db.adminCommand({moveChunk : "myapp.users", find : {email : prefix}, to : shServer[(y-97)/6]}) + } + } + + Optionally, you can also let the balancer automatically + redistribute chunks in your shard cluster. -#. Insert data into the shard cluster using a custom script for your data. +When empty chunks are distributed, data import can occur with multiple +:program:`mongos` instances, improving overall import performance. .. _sharding-balancing-modify-chunk-size: From b5942b769d13ebef8636d2e346d4ae92b208aa86 Mon Sep 17 00:00:00 2001 From: Andrew Leung Date: Mon, 27 Aug 2012 17:21:39 -0400 Subject: [PATCH 8/9] changing :func: to :method: --- source/administration/sharding.txt | 34 +++++++++++++++--------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/source/administration/sharding.txt b/source/administration/sharding.txt index 62d587d7850..9e5c7822187 100644 --- a/source/administration/sharding.txt +++ b/source/administration/sharding.txt @@ -125,7 +125,7 @@ more detail or use the following procedure as a quick starting point: replicaSetName/,, For example, if the name of the replica set is "``repl0``", then - your :func:`sh.addShard` command would be: + your :method:`sh.addShard` command would be: .. code-block:: javascript @@ -136,7 +136,7 @@ more detail or use the following procedure as a quick starting point: MongoDB enables sharding on a per-database basis. This is only a meta-data change and will not redistribute your data. To enable sharding for a given database, use the :dbcommand:`enableSharding` - command or the :func:`sh.enableSharding()` shell function. + command or the :method:`sh.enableSharding()` shell function. .. code-block:: javascript @@ -165,7 +165,7 @@ more detail or use the following procedure as a quick starting point: collections must belong to a database for which you have enabled sharding. When you shard a collection, you also choose the shard key. To shard a collection, run the :dbcommand:`shardCollection` - command or the :func:`sh.shardCollection()` shell helper. + command or the :method:`sh.shardCollection()` shell helper. .. code-block:: javascript @@ -223,7 +223,7 @@ procedure: #. First, you need to tell the cluster where to find the individual shards. You can do this using the :dbcommand:`addShard` command or - the :func:`sh.addShard()` helper: + the :method:`sh.addShard()` helper: .. code-block:: javascript @@ -266,7 +266,7 @@ procedure: following form: the replica set name, followed by a forward slash, followed by a comma-separated list of seeds for the replica set. For example, if the name of the replica set is - "myapp1", then your :func:`sh.addShard` command might resemble: + "myapp1", then your :method:`sh.addShard` command might resemble: .. code-block:: javascript @@ -312,7 +312,7 @@ The procedure to remove a shard is as follows: shard name when you first ran the :dbcommand:`addShard` command. If not, you can find out the name of the shard by running the :dbcommand:`listshards` or :dbcommand:`printShardingStatus` - commands or the :func:`sh.status()` shell helper. + commands or the :method:`sh.status()` shell helper. The following examples will remove a shard named ``mongodb0`` from the cluster. @@ -444,11 +444,11 @@ You may want to split chunks manually if: keys are between ``250`` and ``500`` are in a single chunk. To determine the current chunk ranges across the cluster, use -:func:`sh.status()` or :func:`db.printShardingStatus()`. +:method:`sh.status()` or :method:`db.printShardingStatus()`. To split chunks manually, use the :dbcommand:`split` command with operators: ``middle`` and ``find``. The equivalent shell helpers are -:func:`sh.splitAt()` or :func:`sh.splitFind()`. +:method:`sh.splitAt()` or :method:`sh.splitFind()`. .. example:: @@ -459,13 +459,13 @@ operators: ``middle`` and ``find``. The equivalent shell helpers are sh.splitFind( { "zipcode": 63109 } ) -:func:`sh.splitFind()` will split the chunk containing the queried +:method:`sh.splitFind()` will split the chunk containing the queried document into two equal sized chunks, dividing the chunk using the -balancer algorithm. The :func:`sh.splitFind()` query may not be based +balancer algorithm. The :method:`sh.splitFind()` query may not be based on the shard key, but it makes sense to use the shard key, and including the shard key will expedite the operation. -Use :func:`sh.splitAt()` to split a chunk in two using the queried +Use :method:`sh.splitAt()` to split a chunk in two using the queried document as the partition point: .. code-block:: javascript @@ -574,7 +574,7 @@ To modify the chunk size, use the following procedure: use config -#. Issue the following :func:`save() ` +#. Issue the following :method:`save() ` operation: .. code-block:: javascript @@ -718,7 +718,7 @@ Here's what this tells you: .. note:: - Use the :func:`sh.isBalancerRunning()` helper in the + Use the :method:`sh.isBalancerRunning()` helper in the :program:`mongo` shell to determine if the balancer is running, as follows: @@ -746,7 +746,7 @@ be able to migrate chunks: use config -#. Use an operation modeled on the following example :func:`update() +#. Use an operation modeled on the following example :method:`update() ` operation to modify the balancer's window: @@ -800,10 +800,10 @@ all migration, use the following procedure: If a balancing round is in progress, the system will complete the current round before the balancer is officially disabled. After - disabling, you can use the :func:`sh.getBalancerState()` shell + disabling, you can use the :method:`sh.getBalancerState()` shell function to determine whether the balancer is in fact disabled. -The above process and the :func:`sh.setBalancerState()` helper provide a +The above process and the :method:`sh.setBalancerState()` helper provide a wrapper on the following process, which may be useful if you need to run this operation from a driver that does not have helper functions: @@ -1168,6 +1168,6 @@ operation: for the duration of the backup procedure. Confirm that the balancer is not active using the -:func:`sh.getBalancerState()` method before starting a backup +:method:`sh.getBalancerState()` method before starting a backup operation. When the backup procedure is complete you can reactivate the balancer process. From 519432a72c0d7c859885578bf9b848fa02747620 Mon Sep 17 00:00:00 2001 From: Andrew Leung Date: Wed, 29 Aug 2012 17:01:55 -0400 Subject: [PATCH 9/9] fixing typo s/uti/until --- source/administration/sharding.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/administration/sharding.txt b/source/administration/sharding.txt index 9e5c7822187..3c58c0db013 100644 --- a/source/administration/sharding.txt +++ b/source/administration/sharding.txt @@ -490,7 +490,7 @@ In such cases, data import to an empty MongoDB shard cluster can become slower than to a replica set. The reason for this is how MongoDB writes data and manage chunks in a shard cluster. -MongoDB inserts data into a chunk unti it becomes large and splits on +MongoDB inserts data into a chunk until it becomes large and splits on the same shard. If the balancer notices a chunk imbalance between shards, a migration process will begin to evenly distribute chunks.