diff --git a/source/administration/master-slave.txt b/source/administration/master-slave.txt index 37d74289822..7a7b6193525 100644 --- a/source/administration/master-slave.txt +++ b/source/administration/master-slave.txt @@ -240,7 +240,7 @@ See :doc:`/reference/replica-configuration` for more information about replica set configurations. .. [#host-are-hostnames] In replica set configurations, the - :data:`~local.system.replset.settings.members[n].host` field must hold a resolvable + :data:`~local.system.replset.members[n].host` field must hold a resolvable hostname. Failing over to a Slave (Promotion) diff --git a/source/administration/replica-sets.txt b/source/administration/replica-sets.txt index 911525f8849..832934ed4e0 100644 --- a/source/administration/replica-sets.txt +++ b/source/administration/replica-sets.txt @@ -74,15 +74,15 @@ Secondary-Only Members The secondary-only configuration prevents a :term:`secondary` member in a :term:`replica set` from ever becoming a :term:`primary` in a :term:`failover`. You can set secondary-only mode for any member of -the set. +the set except the current primary. For example, you may want to configure all members of a replica sets located outside of the main data centers as secondary-only to prevent these members from ever becoming primary. To configure a member as secondary-only, set its -:data:`~local.system.replset.settings.members[n].priority` value to ``0``. Any member with a -:data:`~local.system.replset.settings.members[n].priority` equal to ``0`` will never seek +:data:`~local.system.replset.members[n].priority` value to ``0``. Any member with a +:data:`~local.system.replset.members[n].priority` equal to ``0`` will never seek :ref:`election ` and cannot become primary in any situation. For more information on priority levels, see :ref:`replica-set-node-priority`. @@ -96,26 +96,28 @@ replica set. Use the following sequence of operations in the .. code-block:: javascript cfg = rs.conf() - cfg.members[0].priority = 0 - cfg.members[1].priority = 0.5 - cfg.members[2].priority = 1 - cfg.members[3].priority = 2 + cfg.members[0].priority = 2 + cfg.members[1].priority = 1 + cfg.members[2].priority = 0.5 + cfg.members[3].priority = 0 rs.reconfig(cfg) -This configures the set, with the following priority settings: +This reconfigures the set, with the following priority settings: + +- Member ``0`` to a priority of ``2`` so that it becomes primary, under + most circumstances. -- Member ``0`` to a priority of ``0`` so that it can never become :term:`primary`. +- Member ``1`` to a priority of ``1``, which is the default value. + Member ``1`` becomes primary if no member with a *higher* priority is + eligible. -- Member ``1`` to a priority of ``0.5``, which makes it less likely to +- Member ``2`` to a priority of ``0.5``, which makes it less likely to become primary than other members but doesn't prohibit the possibility. -- Member ``2`` to a priority of ``1``, which is the default value. - Member ``2`` becomes primary if no member with a *higher* priority is - eligible. - -- Member ``3`` to a priority of ``2``. Member ``3`` becomes primary, if - eligible, under most circumstances. +- Member ``3`` to a priority of ``0``. + Member ``3`` cannot become the :term:`primary` member under any + circumstances. .. note:: @@ -124,8 +126,17 @@ This configures the set, with the following priority settings: members can quickly obtain a majority of votes in an election for primary. -.. seealso:: :data:`~local.system.replset.settings.members[n].priority` and :ref:`Replica Set - Reconfiguration `. +.. note:: + + The current :term:`primary` cannot be assigned a + :data:`~local.system.replset.members[n].priority` of 0. + If you want to prevent the current primary from being elected + primary again, you must demote it using + :method:`rs.stepDown()` and then set the appropriate priority + with the :method:`rs.reconfig()` method. + +.. seealso:: :data:`~local.system.replset.members[n].priority` and + :ref:`Replica Set Reconfiguration `. .. index:: replica set members; hidden .. _replica-set-hidden-members: @@ -144,8 +155,8 @@ from normal traffic. Typically, hidden members provide reporting, dedicated backups, and dedicated read-only testing and integration support. -Hidden members have :data:`~local.system.replset.settings.members[n].priority` set -``0`` and have :data:`~local.system.replset.settings.members[n].hidden` set to ``true``. +Hidden members have :data:`~local.system.replset.members[n].priority` set +``0`` and have :data:`~local.system.replset.members[n].hidden` set to ``true``. To configure a :term:`hidden member`, use the following sequence of operations in the :program:`mongo` shell: @@ -158,7 +169,7 @@ operations in the :program:`mongo` shell: rs.reconfig(cfg) After re-configuring the set, the first member of the set in the -:data:`~local.system.replset.settings.members` array will have a priority of ``0`` +:data:`~local.system.replset.members` array will have a priority of ``0`` so that it cannot become primary. The other members in the set will not advertise the hidden member in the :dbcommand:`isMaster` or :method:`db.isMaster()` output. @@ -168,7 +179,7 @@ not advertise the hidden member in the :dbcommand:`isMaster` or You must send the :method:`rs.reconfig()` command to a set member that *can* become :term:`primary`. In the above example, if you issue the :method:`rs.reconfig()` operation to a member with a - :data:`~local.system.replset.members.[n].priority` of ``0`` the operation will + :data:`~local.system.replset.members[n].priority` of ``0`` the operation will fail. .. note:: @@ -228,24 +239,24 @@ following sequence of operations in the :program:`mongo` shell: rs.reconfig(cfg) After the replica set reconfigures, the first member of the set in the -:data:`~local.system.replset.settings.members` array will have a priority +:data:`~local.system.replset.members` array will have a priority of ``0`` and cannot become :term:`primary`. The :data:`slaveDelay ` value delays both replication and the member's :term:`oplog` by 3600 seconds (1 -hour). Setting :data:`~local.system.replset.settings.members[n].slaveDelay` to a -non-zero value also sets :data:`~local.system.replset.settings.members[n].hidden` to +hour). Setting :data:`~local.system.replset.members[n].slaveDelay` to a +non-zero value also sets :data:`~local.system.replset.members[n].hidden` to ``true`` for this replica set so that it does not receive application queries in normal operations. .. warning:: The length of the secondary - :data:`~local.system.replset.settings.members[n].slaveDelay` must + :data:`~local.system.replset.members[n].slaveDelay` must fit within the window of the oplog. If the oplog is shorter than - the :data:`~local.system.replset.settings.members[n].slaveDelay` + the :data:`~local.system.replset.members[n].slaveDelay` window, the delayed member cannot successfully replicate operations. -.. seealso:: :data:`~local.system.replset.settings.members[n].slaveDelay`, :ref:`Replica Set Reconfiguration +.. seealso:: :data:`~local.system.replset.members[n].slaveDelay`, :ref:`Replica Set Reconfiguration `, :ref:`replica-set-oplog-sizing`, :ref:`replica-set-procedure-change-oplog-size` in this document, and the :doc:`/tutorial/change-oplog-size` tutorial. @@ -320,7 +331,7 @@ command sequence in the :program:`mongo` shell. This sequence gives ``0`` votes to the fourth, fifth, and sixth members of the set according to the order of the -:data:`~local.system.replset.settings.members` array in the output of +:data:`~local.system.replset.members` array in the output of :method:`rs.conf()`. This setting allows the set to elect these members as :term:`primary` but does not allow them to vote in elections. If you have three non-voting members, you can add three @@ -336,7 +347,7 @@ the event of a network partition. ` to control which members are more likely to become primary. -.. seealso:: :data:`~local.system.replset.settings.members[n].votes` and :ref:`Replica Set +.. seealso:: :data:`~local.system.replset.members[n].votes` and :ref:`Replica Set Reconfiguration `. .. _replica-set-chained-replication: @@ -440,7 +451,7 @@ You can re-add a removed member to a replica set at any time using the :ref:`procedure for adding replica set members `. Additionally, consider using the :ref:`replica set reconfiguration procedure ` to change the -:data:`~local.system.replset.settings.members[n].host` value to rename a member in a replica set +:data:`~local.system.replset.members[n].host` value to rename a member in a replica set directly. .. _replica-set-admin-procedure-replace-member: @@ -458,9 +469,9 @@ completely replace all configured options related to the previous member. Use :method:`rs.reconfig()` to change the value of the -:data:`~local.system.replset.settings.members[n].host` field to reflect the new hostname or port +:data:`~local.system.replset.members[n].host` field to reflect the new hostname or port number. :method:`rs.reconfig()` will not change the value of -:data:`~local.system.replset.settings.members[n]._id`. +:data:`~local.system.replset.members[n]._id`. .. code-block:: javascript @@ -481,7 +492,7 @@ number. :method:`rs.reconfig()` will not change the value of Adjusting Priority ~~~~~~~~~~~~~~~~~~ -To change the value of the :data:`~local.system.replset.settings.members[n].priority` in the +To change the value of the :data:`~local.system.replset.members[n].priority` in the replica set configuration, use the following sequence of commands in the :program:`mongo` shell: @@ -496,7 +507,7 @@ the :program:`mongo` shell: The first operation uses :method:`rs.conf()` to set the local variable ``cfg`` to the contents of the current replica set configuration, which is a :term:`document`. The next three operations change the -:data:`~local.system.replset.settings.members[n].priority` value in the ``cfg`` document for the +:data:`~local.system.replset.members[n].priority` value in the ``cfg`` document for the first three members configured in the :data:`members ` array. The final operation calls :method:`rs.reconfig()` with the argument of ``cfg`` to initialize @@ -504,24 +515,24 @@ the new configuration. .. include:: /includes/note-rs-conf-array-index.rst -If a member has :data:`~local.system.replset.settings.members[n].priority` set to ``0``, it is +If a member has :data:`~local.system.replset.members[n].priority` set to ``0``, it is ineligible to become :term:`primary` and will not seek election. :ref:`Hidden members `, :ref:`delayed members `, and -:ref:`arbiters ` all have :data:`~local.system.replset.settings.members[n].priority` +:ref:`arbiters ` all have :data:`~local.system.replset.members[n].priority` set to ``0``. -All members have a :data:`~local.system.replset.settings.members[n].priority` equal to ``1`` by default. +All members have a :data:`~local.system.replset.members[n].priority` equal to ``1`` by default. -The value of :data:`~local.system.replset.settings.members[n].priority` can be any floating point +The value of :data:`~local.system.replset.members[n].priority` can be any floating point (i.e. decimal) number between ``0`` and ``1000``. Priorities are only used to determine the preference in election. The priority value is used only in relation to other members. With the exception of members with a priority of ``0``, the absolute value of the -:data:`~local.system.replset.settings.members[n].priority` value is irrelevant. +:data:`~local.system.replset.members[n].priority` value is irrelevant. Replica sets will preferentially elect and maintain the primary status -of the member with the highest :data:`~local.system.replset.settings.members[n].priority` setting. +of the member with the highest :data:`~local.system.replset.members[n].priority` setting. .. warning:: @@ -667,7 +678,7 @@ You can use the following sequence of commands: cfg.settings.chainingAllowed = true rs.reconfig(cfg) -.. note:: +.. note:: If chained replication is disabled, you still can use :dbcommand:`replSetSyncFrom` to specify that a secondary replicates @@ -745,11 +756,11 @@ To resync the stale member: At this point, the :program:`mongod` will perform an initial sync. The length of the initial sync may process depends on the size of the database and network connection between members of the - replica set. + replica set. Initial sync operations can impact the other members of the set and create additional traffic to the primary, and can only occur if - another member of the set is accessible and up to date. + another member of the set is accessible and up to date. .. index:: replica set; resync .. _replica-set-resync-by-copying: @@ -758,14 +769,14 @@ Resync by Copying All Datafiles from Another Member ``````````````````````````````````````````````````` This approach uses a copy of the data files from an existing member of -the replica set, or a back of the data files to "seed" the stale member. +the replica set, or a back of the data files to "seed" the stale member. The copy or backup of the data files **must** be sufficiently recent to allow the new member to catch up with the :term:`oplog`, otherwise the member would need to perform an initial sync. -.. note:: - +.. note:: + In most cases you cannot copy data files from a running :program:`mongod` instance to another, because the data files will change during the file copy operation. Consider the @@ -775,7 +786,7 @@ the member would need to perform an initial sync. After you have copied the data files from the "seed" source, start the :program:`mongod` instance and allow it to apply all operations from -the oplog until it refelcts the current state of the replica set. +the oplog until it reflects the current state of the replica set. .. _replica-set-security: @@ -795,12 +806,12 @@ Additionally, MongoDB provides an authentication mechanism for replica sets. These instances enable authentication but specify a shared key file that serves as a shared password. -.. versionadded:: 1.8 +.. versionadded:: 1.8 Added support authentication in replica set deployments. .. versionchanged:: 1.9.1 Added support authentication in sharded replica set deployments. - + To enable authentication add the following option to your configuration file: @@ -1155,9 +1166,9 @@ the oplog has the wrong data type in the ``ts`` field. .. code-block:: javascript { "ts" : {t: 1347982456000, i: 1}, - "h" : NumberLong("8191276672478122996"), - "op" : "n", - "ns" : "", + "h" : NumberLong("8191276672478122996"), + "op" : "n", + "ns" : "", "o" : { "msg" : "Reconfig set", "version" : 4 } } And the second query returns this as the last entry where ``ts`` @@ -1165,10 +1176,10 @@ the oplog has the wrong data type in the ``ts`` field. .. code-block:: javascript - { "ts" : Timestamp(1347982454000, 1), - "h" : NumberLong("6188469075153256465"), - "op" : "n", - "ns" : "", + { "ts" : Timestamp(1347982454000, 1), + "h" : NumberLong("6188469075153256465"), + "op" : "n", + "ns" : "", "o" : { "msg" : "Reconfig set", "version" : 3 } } Then the value for the ``ts`` field in the last oplog entry is of the @@ -1179,7 +1190,7 @@ use an update operation that resembles the following: .. code-block:: javascript - db.oplog.rs.update( { ts: { t:1347982456000, i:1 } }, + db.oplog.rs.update( { ts: { t:1347982456000, i:1 } }, { $set: { ts: new Timestamp(1347982456000, 1)}}) Modify the timestamp values as needed based on your oplog entry. This diff --git a/source/reference/command/addShard.txt b/source/reference/command/addShard.txt index 25428cba365..26e62893de2 100644 --- a/source/reference/command/addShard.txt +++ b/source/reference/command/addShard.txt @@ -12,11 +12,10 @@ addShard automatically provided to uniquely identify the shard. - :param integer maxSize: Optional. Unless specified, shards will consume - the total amount of available space on their - machines if necessary. Use the ``maxSize`` value - to limit the amount of space the database can - use. Specify this value in megabytes. + :param integer maxSize: Optional, megabytes. Limits the maximum size + of a shard. + If ``maxSize`` is ``0`` then MongoDB will not + limit the size of the shard. Use the :dbcommand:`addShard` command to add a database instance or replica set to a :term:`sharded cluster`. diff --git a/source/reference/connection-pool-stats.txt b/source/reference/connection-pool-stats.txt index 1c5bc521205..8076deb3542 100644 --- a/source/reference/connection-pool-stats.txt +++ b/source/reference/connection-pool-stats.txt @@ -105,7 +105,7 @@ Output .. versionadded:: 2.2 :data:`~connPoolStats.replicaSets.[shard].host[n].tags` reports the - :data:`~local.system.replset.settings.members[n].tags`, if this member of the set has tags + :data:`~local.system.replset.members[n].tags`, if this member of the set has tags configured. .. data:: connPoolStats.replicaSets.[shard].master diff --git a/source/reference/limits.txt b/source/reference/limits.txt index 28d06a83cb0..df954a4bd63 100644 --- a/source/reference/limits.txt +++ b/source/reference/limits.txt @@ -109,14 +109,8 @@ Replica Sets Only 7 members of a replica set can have votes at any given time. See can vote :ref:`replica-set-non-voting-members` for more information -Operations -~~~~~~~~~~ - -.. _limit-sort: -.. limit:: Sorted Documents - - MongoDB will only return sorted results on fields without an index - *if* the sort operation uses less than 32 megabytes of memory. +Sharded Clusters +~~~~~~~~~~~~~~~~~~~ .. _limit-sharding-limitations: .. limit:: Operations Unavailable in Sharded Environments @@ -137,6 +131,22 @@ Operations :operator:`$snapshot` queries do not work in sharded environments. +.. limit:: Size of Sharded Collection + + MongoDB only permits sharding an existing collection that holds + fewer than 256 gigabytes of data. + +.. seealso:: :limit:`Unique Indexes in Sharded Collections` + +Operations +~~~~~~~~~~ + +.. _limit-sort: +.. limit:: Sorted Documents + + MongoDB will only return sorted results on fields without an index + *if* the sort operation uses less than 32 megabytes of memory. + .. limit:: 2d Geospatial queries cannot use the $or operator .. see:: :operator:`$or` and :doc:`/core/geospatial-indexes`. diff --git a/source/reference/method/sh._adminCommand.txt b/source/reference/method/sh._adminCommand.txt new file mode 100644 index 00000000000..dd366f69e5b --- /dev/null +++ b/source/reference/method/sh._adminCommand.txt @@ -0,0 +1,18 @@ +================== +sh._adminCommand() +================== + +.. default-domain:: mongodb + +.. method:: sh._adminCommand(cmd, checkMongos) + + :param string dbcommand: A database command to run against the ``admin`` + database. + + :param Boolean checkMongos: Verify whether or not the shell is connected + to a :program:`mongos` instance. + + The :method:`sh._adminCommand` method runs a database command against + the admin database of a :program:`mongos` instance. + +.. seealso:: :method:`db.runCommand()` diff --git a/source/reference/method/sh._checkFullName.txt b/source/reference/method/sh._checkFullName.txt new file mode 100644 index 00000000000..b4cf171366e --- /dev/null +++ b/source/reference/method/sh._checkFullName.txt @@ -0,0 +1,16 @@ +=================== +sh._checkFullName() +=================== + +.. default-domain:: mongodb + +.. method:: sh._checkFullName(namespace) + + :param string namespace: Specify a complete namespace. + + :throws: "name needs to be fully qualified ." + + The :method:`sh._checkFullName()` method verifies that a namespace + name is well-formed. If the name has a period ``.`` then the + :method:`sh._checkFullName()` method exits, otherwise it throws + an error. diff --git a/source/reference/method/sh._checkMongos.txt b/source/reference/method/sh._checkMongos.txt new file mode 100644 index 00000000000..fac8dfe395c --- /dev/null +++ b/source/reference/method/sh._checkMongos.txt @@ -0,0 +1,15 @@ +================= +sh._checkMongos() +================= + +.. default-domain:: mongodb + +.. method:: sh._checkMongos() + + :returns: nothing + + :throws: "not connected to a mongos" + + The :method:`sh._checkMongos()` method throws an error message if the + :program:`mongo` shell is not connected to a :program:`mongos` instance. + Otherwise it exits (no return document or return code). diff --git a/source/reference/method/sh._lastMigration.txt b/source/reference/method/sh._lastMigration.txt new file mode 100644 index 00000000000..9c926fd3d56 --- /dev/null +++ b/source/reference/method/sh._lastMigration.txt @@ -0,0 +1,36 @@ +=================== +sh._lastMigration() +=================== + +.. default-domain:: mongodb + +.. method:: sh._lastMigration(namespace) + + :param string namespace: The name of a database or collection within the + current database. + + :returns: A document with fields detailing the most recent migration + in the specified namespace. + + :method:`sh._lastMigration()` returns a document with details about + the last migration performed on the database or collection you specify. + + Document details: + + :field string _id: The id of the migration task + + :field string server: The name of the server + + :field string clientAddr: The IP address and port number of the server. + + :field ISODate time: The time of the last migration. + + :field string what: The specific type of migration. + + :field string ns: The complete namespace of the collection affected + by the migration. + + :field document details: A document containing details about the + migrated chunk. Includes ``min`` and ``max`` + sub-documents with the bounds of the migrated + chunk. diff --git a/source/reference/method/sh.addTagRange.txt b/source/reference/method/sh.addTagRange.txt index 284e5f847bc..7ed440ed968 100644 --- a/source/reference/method/sh.addTagRange.txt +++ b/source/reference/method/sh.addTagRange.txt @@ -8,22 +8,22 @@ sh.addTagRange() .. versionadded:: 2.2 - :param namespace: Specifies the namespace, in the form of - ``.`` of the sharded - collection that you would like to tag. - - :param minimum: Specifies the minimum value of the - :term:`shard key` range to include in the tag. - Specify the minimum value in the form of - ``:``. - This value must be of the same BSON type or types - as the shard key. - - :param maximum: Specifies the maximum value of the shard key range - to include in the tag. Specify the maximum value - in the form of ``:``. - This value must be of the same BSON type or types - as the shard key. + :param string namespace: Specifies the namespace, in the form of + ``.`` of the sharded + collection that you would like to tag. + + :param document minimum: Specifies the minimum value of the + :term:`shard key` range to include in the tag. + Specify the minimum value in the form of + ``:``. + This value must be of the same BSON type or types + as the shard key. + + :param document maximum: Specifies the maximum value of the shard key range + to include in the tag. Specify the maximum value + in the form of ``:``. + This value must be of the same BSON type or types + as the shard key. :param string tag: Specifies the name of the tag to attach the range specified by the ``minimum`` and ``maximum`` @@ -37,7 +37,21 @@ sh.addTagRange() Always issue :method:`sh.addTagRange()` when connected to a :program:`mongos` instance. - + + .. example:: + + Given a shard key of ``{STATE:1,ZIP:1}``, create a tag range covering + ZIP codes in New York State: + + .. code-block:: javascript + + sh.addTagRange( "exampledb.collection", + {STATE: "NY", ZIP: {minKey:1}}, + {STATE:"NY", ZIP: {maxKey:1}}, + "NY" + ) + + .. seealso:: :method:`sh.addShardTag()`, diff --git a/source/reference/method/sh.disableBalancing.txt b/source/reference/method/sh.disableBalancing.txt new file mode 100644 index 00000000000..72a4afefced --- /dev/null +++ b/source/reference/method/sh.disableBalancing.txt @@ -0,0 +1,24 @@ +===================== +sh.disableBalancing() +===================== + +.. default-domain:: mongodb + +.. method:: sh.disableBalancing(collection) + + :param string collection: The name of a collection. + + :method:`sh.disableBalancing()` disables the balancer for the specified + sharded collection. + +.. seealso:: + + - :method:`sh.enableBalancing()` + - :method:`sh.getBalancerHost()` + - :method:`sh.getBalancerState()` + - :method:`sh.isBalancerRunning()` + - :method:`sh.setBalancerState()` + - :method:`sh.startBalancer()` + - :method:`sh.stopBalancer()` + - :method:`sh.waitForBalancer()` + - :method:`sh.waitForBalancerOff()` diff --git a/source/reference/method/sh.enableBalancing.txt b/source/reference/method/sh.enableBalancing.txt new file mode 100644 index 00000000000..0f86f788361 --- /dev/null +++ b/source/reference/method/sh.enableBalancing.txt @@ -0,0 +1,24 @@ +===================== +sh.enableBalancing() +===================== + +.. default-domain:: mongodb + +.. method:: sh.enableBalancing(collection) + + :param string collection: The name of a collection. + + :method:`sh.enableBalancing()` enables the balancer for the specified + sharded collection. + +.. seealso:: + + - :method:`sh.disableBalancing()` + - :method:`sh.getBalancerHost()` + - :method:`sh.getBalancerState()` + - :method:`sh.isBalancerRunning()` + - :method:`sh.setBalancerState()` + - :method:`sh.startBalancer()` + - :method:`sh.stopBalancer()` + - :method:`sh.waitForBalancer()` + - :method:`sh.waitForBalancerOff()` diff --git a/source/reference/method/sh.enableSharding.txt b/source/reference/method/sh.enableSharding.txt index 824edffb541..8fd05b1549c 100644 --- a/source/reference/method/sh.enableSharding.txt +++ b/source/reference/method/sh.enableSharding.txt @@ -6,8 +6,11 @@ sh.enableSharding() .. method:: sh.enableSharding(database) - :param name database: Specify a database name to shard. + :param string database: Specify a database name to shard. Enables sharding on the specified database. This does not automatically shard any collections, but makes it possible to begin sharding collections using :method:`sh.shardCollection()`. + +.. seealso:: :method:`sh.shardCollection()` + diff --git a/source/reference/method/sh.getBalancerHost.txt b/source/reference/method/sh.getBalancerHost.txt new file mode 100644 index 00000000000..dbadc86c0d4 --- /dev/null +++ b/source/reference/method/sh.getBalancerHost.txt @@ -0,0 +1,24 @@ +==================== +sh.getBalancerHost() +==================== + +.. default-domain:: mongodb + +.. method:: sh.getBalancerHost() + + :returns: String in form :samp:`{hostname}:{port}` + + :method:`sh.getBalancerHost()` returns the name of the server that is + running the balancer. + +.. seealso:: + + - :method:`sh.enableBalancing()` + - :method:`sh.disableBalancing()` + - :method:`sh.getBalancerState()` + - :method:`sh.isBalancerRunning()` + - :method:`sh.setBalancerState()` + - :method:`sh.startBalancer()` + - :method:`sh.stopBalancer()` + - :method:`sh.waitForBalancer()` + - :method:`sh.waitForBalancerOff()` diff --git a/source/reference/method/sh.getBalancerState.txt b/source/reference/method/sh.getBalancerState.txt index 447948874c1..c39ffdd5fc7 100644 --- a/source/reference/method/sh.getBalancerState.txt +++ b/source/reference/method/sh.getBalancerState.txt @@ -6,10 +6,22 @@ sh.getBalancerState() .. method:: sh.getBalancerState() - :returns: boolean. + :returns: boolean :method:`sh.getBalancerState()` returns ``true`` when the :term:`balancer` is enabled and false if the balancer is disabled. This does not reflect the current state of balancing operations: use :method:`sh.isBalancerRunning()` to check the balancer's current state. + +.. seealso:: + + - :method:`sh.enableBalancing()` + - :method:`sh.disableBalancing()` + - :method:`sh.getBalancerHost()` + - :method:`sh.isBalancerRunning()` + - :method:`sh.setBalancerState()` + - :method:`sh.startBalancer()` + - :method:`sh.stopBalancer()` + - :method:`sh.waitForBalancer()` + - :method:`sh.waitForBalancerOff()` diff --git a/source/reference/method/sh.isBalancerRunning.txt b/source/reference/method/sh.isBalancerRunning.txt index b1d9e7d8f66..8e112a6aa68 100644 --- a/source/reference/method/sh.isBalancerRunning.txt +++ b/source/reference/method/sh.isBalancerRunning.txt @@ -6,9 +6,21 @@ sh.isBalancerRunning() .. method:: sh.isBalancerRunning() - :returns: boolean. + :returns: boolean Returns true if the :term:`balancer` process is currently running and migrating chunks and false if the balancer process is not running. Use :method:`sh.getBalancerState()` to determine if the balancer is enabled or disabled. + +.. seealso:: + + - :method:`sh.enableBalancing()` + - :method:`sh.disableBalancing()` + - :method:`sh.getBalancerHost()` + - :method:`sh.getBalancerState()` + - :method:`sh.setBalancerState()` + - :method:`sh.startBalancer()` + - :method:`sh.stopBalancer()` + - :method:`sh.waitForBalancer()` + - :method:`sh.waitForBalancerOff()` diff --git a/source/reference/method/sh.setBalancerState.txt b/source/reference/method/sh.setBalancerState.txt index 2dda05a7e73..49c7facbd94 100644 --- a/source/reference/method/sh.setBalancerState.txt +++ b/source/reference/method/sh.setBalancerState.txt @@ -13,3 +13,15 @@ sh.setBalancerState() :method:`sh.getBalancerState()` to determine if the balancer is currently enabled or disabled and :method:`sh.isBalancerRunning()` to check its current state. + +.. seealso:: + + - :method:`sh.enableBalancing()` + - :method:`sh.disableBalancing()` + - :method:`sh.getBalancerHost()` + - :method:`sh.getBalancerState()` + - :method:`sh.isBalancerRunning()` + - :method:`sh.startBalancer()` + - :method:`sh.stopBalancer()` + - :method:`sh.waitForBalancer()` + - :method:`sh.waitForBalancerOff()` diff --git a/source/reference/method/sh.shardCollection.txt b/source/reference/method/sh.shardCollection.txt index 719c886c49f..29ebef38c17 100644 --- a/source/reference/method/sh.shardCollection.txt +++ b/source/reference/method/sh.shardCollection.txt @@ -6,9 +6,9 @@ sh.shardCollection() .. method:: sh.shardCollection(collection,key,unique) - :param name collection: The name of the collection to shard. + :param string collection: The namespace of the collection to shard. - :param document key: A :term:`document` containing :term:`shard key` + :param document key: A :term:`document` containing a :term:`shard key` that the sharding system uses to :term:`partition` and distribute objects among the shards. @@ -22,3 +22,5 @@ sh.shardCollection() :term:`shard key`. Specify shard keys in the form of a :term:`document`. Shard keys may refer to a single document field, or more typically several document fields to form a "compound shard key." + + .. see:: :limit:`Size of Sharded Collection` diff --git a/source/reference/method/sh.startBalancer.txt b/source/reference/method/sh.startBalancer.txt new file mode 100644 index 00000000000..27c81a87aa6 --- /dev/null +++ b/source/reference/method/sh.startBalancer.txt @@ -0,0 +1,26 @@ +================== +sh.startBalancer() +================== + +.. default-domain:: mongodb + +.. method:: sh.startBalancer(timeout, interval) + + :param integer timeout: Milliseconds to wait. + + :param integer interval: Milliseconds to sleep each cycle of waiting. + + The :method:`sh.startBalancer()` enables the balancer in a sharded + cluster and waits for balancing to initiate. + +.. seealso:: + + - :method:`sh.enableBalancing()` + - :method:`sh.disableBalancing()` + - :method:`sh.getBalancerHost()` + - :method:`sh.getBalancerState()` + - :method:`sh.isBalancerRunning()` + - :method:`sh.setBalancerState()` + - :method:`sh.stopBalancer()` + - :method:`sh.waitForBalancer()` + - :method:`sh.waitForBalancerOff()` diff --git a/source/reference/method/sh.stopBalancer.txt b/source/reference/method/sh.stopBalancer.txt new file mode 100644 index 00000000000..86f395a8c91 --- /dev/null +++ b/source/reference/method/sh.stopBalancer.txt @@ -0,0 +1,26 @@ +================= +sh.stopBalancer() +================= + +.. default-domain:: mongodb + +.. method:: sh.stopBalancer(timeout, interval) + + :param integer timeout: Milliseconds to wait. + + :param integer interval: Milliseconds to sleep each cycle of waiting. + + The :method:`sh.stopBalancer()` disables the balancer in a sharded + cluster and waits for balancing to complete. + +.. seealso:: + + - :method:`sh.enableBalancing()` + - :method:`sh.disableBalancing()` + - :method:`sh.getBalancerHost()` + - :method:`sh.getBalancerState()` + - :method:`sh.isBalancerRunning()` + - :method:`sh.setBalancerState()` + - :method:`sh.startBalancer()` + - :method:`sh.waitForBalancer()` + - :method:`sh.waitForBalancerOff()` diff --git a/source/reference/method/sh.waitForBalancer.txt b/source/reference/method/sh.waitForBalancer.txt new file mode 100644 index 00000000000..705498eaa88 --- /dev/null +++ b/source/reference/method/sh.waitForBalancer.txt @@ -0,0 +1,30 @@ +==================== +sh.waitForBalancer() +==================== + +.. default-domain:: mongodb + +.. method:: sh.waitForBalancer(onOrNot, timeout, interval) + + :param Boolean onOrNot: Whether to wait for the lock to be + on (``true``) or off (``false``). + + :param integer timeout: Milliseconds to wait. + + :param integer interval: Milliseconds to sleep. + + + :method:`sh.waitForBalancer()` is an internal method that waits for + a change in the state of the balancer. + +.. seealso:: + + - :method:`sh.enableBalancing()` + - :method:`sh.disableBalancing()` + - :method:`sh.getBalancerHost()` + - :method:`sh.getBalancerState()` + - :method:`sh.isBalancerRunning()` + - :method:`sh.setBalancerState()` + - :method:`sh.startBalancer()` + - :method:`sh.stopBalancer()` + - :method:`sh.waitForBalancerOff()` diff --git a/source/reference/method/sh.waitForBalancerOff.txt b/source/reference/method/sh.waitForBalancerOff.txt new file mode 100644 index 00000000000..6f878017cbb --- /dev/null +++ b/source/reference/method/sh.waitForBalancerOff.txt @@ -0,0 +1,26 @@ +======================= +sh.waitForBalancerOff() +======================= + +.. default-domain:: mongodb + +.. method:: sh.waitForBalancerOff() + + :param integer timeout: Milliseconds to wait. + + :param integer interval: Milliseconds to sleep. + + :method:`sh.waitForBalancerOff()` is an internal method that waits + until the balancer is not running. + +.. seealso:: + + - :method:`sh.enableBalancing()` + - :method:`sh.disableBalancing()` + - :method:`sh.getBalancerHost()` + - :method:`sh.getBalancerState()` + - :method:`sh.isBalancerRunning()` + - :method:`sh.setBalancerState()` + - :method:`sh.startBalancer()` + - :method:`sh.stopBalancer()` + - :method:`sh.waitForBalancer()` diff --git a/source/reference/method/sh.waitForDLock.txt b/source/reference/method/sh.waitForDLock.txt new file mode 100644 index 00000000000..290a4872060 --- /dev/null +++ b/source/reference/method/sh.waitForDLock.txt @@ -0,0 +1,19 @@ +==================== +sh.waitForDLock() +==================== + +.. default-domain:: mongodb + +.. method:: sh.waitForDLock(lockId, onOrNot, timeout, interval) + + :param string lockId: The name of the lock. + + :param Boolean onOrNot: Optional, whether to wait for the lock to be + on (``true``) or off (``false``). + + :param integer timeout: Milliseconds to wait. + + :param integer interval: Milliseconds to sleep in each waiting cycle. + + :method:`sh.waitForDLock()` is an internal method that waits until + the specified lock is changes state. diff --git a/source/reference/method/sh.waitForPingChange.txt b/source/reference/method/sh.waitForPingChange.txt new file mode 100644 index 00000000000..58e3257669e --- /dev/null +++ b/source/reference/method/sh.waitForPingChange.txt @@ -0,0 +1,17 @@ +====================== +sh.waitForPingChange() +====================== + +.. default-domain:: mongodb + +.. method:: sh.waitForPingChange(activepings, timeout, interval) + + :param array activepings: An array of active pings from the + ``config.mongos`` collection. + + :param integer timeout: Milliseconds to wait for a change in ping state. + + :param integer interval: Milliseconds to sleep in each waiting cycle. + + :method:`sh.waitForPingChange()` waits for a change in ping state + of the one of the ``activepings``.