From 0bbd1c78584ea0313702175be103a723cd9e8b99 Mon Sep 17 00:00:00 2001 From: Bob Grabar Date: Fri, 21 Jun 2013 15:02:27 -0400 Subject: [PATCH] separate procedure to enable balancer --- .../manage-sharded-cluster-balancer.txt | 93 +++++++++---------- 1 file changed, 44 insertions(+), 49 deletions(-) diff --git a/source/tutorial/manage-sharded-cluster-balancer.txt b/source/tutorial/manage-sharded-cluster-balancer.txt index 0d88dd135b3..33a2f274ecb 100644 --- a/source/tutorial/manage-sharded-cluster-balancer.txt +++ b/source/tutorial/manage-sharded-cluster-balancer.txt @@ -151,34 +151,31 @@ all migration, use the following procedure: .. code-block:: javascript - sh.stopBalancer() - -#. Later, issue the following operation to enable the balancer: - - .. code-block:: javascript - - sh.startBalancer() + sh.setBalancerState(false) .. note:: If a migration is in progress, the system will complete the - in-progress migration before stopping. After disabling, you can use the following - operation in the :program:`mongo` shell to determine if there are - no migrations in progress: + in-progress migration before stopping. - .. code-block:: javascript +#. To later re-enable the balancer, see :ref:`sharding-balancing-re-enable`. - use config - while( sh.isBalancerRunning() ) { - print("waiting..."); - sleep(1000); - } +After disabling, you can use the following +operation in the :program:`mongo` shell to determine if there are +no migrations in progress: - The above process and the :method:`sh.setBalancerState()`, - :method:`sh.startBalancer()`, and :method:`sh.stopBalancer()` helpers - provide wrappers on the following process, which may be useful if you - need to run this operation from a driver that does not have helper - functions: +.. code-block:: javascript + + use config + while( sh.isBalancerRunning() ) { + print("waiting..."); + sleep(1000); + } + +The :method:`sh.setBalancerState()` helper provides +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: #. Connect to any :program:`mongos` in the cluster using the :program:`mongo` shell. @@ -195,11 +192,34 @@ all migration, use the following procedure: db.settings.update( { _id: "balancer" }, { $set : { stopped: true } } , true ); -#. To enable the balancer again, alter the value of "stopped" as follows: +#. To later re-enable the balancer, see :ref:`sharding-balancing-re-enable`. - .. code-block:: javascript +.. _sharding-balancing-re-enable: +.. _sharding-balancing-enable: + +Enable the Balancer +------------------- + +Use this procedure if you have disabled the balancer and are ready to +re-enable it: + +#. Connect to any :program:`mongos` in the cluster using the + :program:`mongo` shell. + +#. Issue one of the following operations to enable the balancer: + + - From the :program:`mongo` shell, issue: + + .. code-block:: javascript + + sh.startBalancer(true) - db.settings.update( { _id: "balancer" }, { $set : { stopped: false } } , true ); + - From a driver that does not have the :method:`sh.startBalancer()` helper, + issue the following from the ``config`` database: + + .. code-block:: javascript + + db.settings.update( { _id: "balancer" }, { $set : { stopped: false } } , true ) Disable Balancing During Backups -------------------------------- @@ -231,28 +251,3 @@ is active: When the backup procedure is complete you can reactivate the balancer process. - -.. _sharding-balancing-re-enable: - -Re-enable the Balancer after Temporarily Disabling It ------------------------------------------------------ - -Use this procedure if you have temporarily disabled the balancer and are -ready to re-enable it: - -#. Connect to any :program:`mongos` in the cluster using the - :program:`mongo` shell. - -#. Issue one of the following operations to enable the balancer: - - - From the :program:`mongo` shell, issue: - - .. code-block:: javascript - - sh.startBalancer() - - - From a driver that does not have the :method:`sh.startBalancer()` helper: - - .. code-block:: javascript - - db.settings.update( { _id: "balancer" }, { $set : { stopped: false } } , true );