Skip to content

DOCS-1016 document additional sharding shell helpers #659

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 29 commits into from
Feb 22, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
ac1016f
DOCS-1016 document missing sharding shell helpers
Feb 13, 2013
fa18288
DOCS-1016 copy edits & more for shard helpers
Feb 14, 2013
b55eca7
DOCS-1016 remove several commands which are internal and rarely used
Feb 14, 2013
3bddf1c
DOCS-1016 document missing sharding shell helpers
Feb 13, 2013
7b66530
DOCS-1016 copy edits & more for shard helpers
Feb 14, 2013
284a5a5
DOCS-1016 remove several commands which are internal and rarely used
Feb 14, 2013
f2365f5
DOCS-1016 minor cleanup
Feb 15, 2013
827f482
DOCS-1016 minor cleanup
Feb 15, 2013
b1c75ee
Merge branch 'master' of github.com:mongodb/docs into mongodb-2.2
Feb 15, 2013
0ba77e4
Merge branch 'mongodb-2.2' of github.com:epc/docs into mongodb-2.2
Feb 15, 2013
a177563
DOCS-1016 document missing sharding shell helpers
Feb 13, 2013
27b678f
DOCS-1016 copy edits & more for shard helpers
Feb 14, 2013
04eed5e
DOCS-1016 remove several commands which are internal and rarely used
Feb 14, 2013
4a795a8
DOCS-1016 document missing sharding shell helpers
Feb 13, 2013
f948658
DOCS-1016 copy edits & more for shard helpers
Feb 14, 2013
031c296
DOCS-1016 remove several commands which are internal and rarely used
Feb 14, 2013
a8cb672
DOCS-1016 minor cleanup
Feb 15, 2013
73c8a07
DOCS-1016 minor cleanup
Feb 15, 2013
9cccccc
fix merge conflicts
Feb 15, 2013
9418571
DOCS-1131 maxSize=0
Feb 18, 2013
f09ae17
Merge branch 'mongodb-2.2' of github.com:epc/docs into mongodb-2.2
Feb 18, 2013
278602c
DOCS-1133 document size limit on collection to be sharded
Feb 18, 2013
7943cd0
DOCS-1120 improve example of replica set priorities when primary
Feb 18, 2013
90fdc0b
DOCS-1120 replica set priorities / fix intradocument links
Feb 18, 2013
a4d8496
Fix broken links, replset.settings.members is not valid
Feb 18, 2013
4a1143f
DOCS-1131 incorporate code review comments
Feb 22, 2013
f349cbb
DOCS-1120 improve replica set priority documentation
Feb 22, 2013
0d61d5c
DOCS-1133 document size limit on collection to be sharded
Feb 22, 2013
737d706
DOCS-1016 final update/copy edits to undocumented sharding methods
Feb 22, 2013
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion source/administration/master-slave.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
127 changes: 69 additions & 58 deletions source/administration/replica-sets.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 <replica-set-elections>` and cannot become primary in any
situation. For more information on priority levels, see
:ref:`replica-set-node-priority`.
Expand All @@ -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::

Expand All @@ -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 <replica-set-reconfiguration-usage>`.
.. 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 <replica-set-reconfiguration-usage>`.

.. index:: replica set members; hidden
.. _replica-set-hidden-members:
Expand All @@ -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:
Expand All @@ -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.
Expand All @@ -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::
Expand Down Expand Up @@ -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 <members[n].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
<replica-set-reconfiguration-usage>`, :ref:`replica-set-oplog-sizing`,
:ref:`replica-set-procedure-change-oplog-size` in this document,
and the :doc:`/tutorial/change-oplog-size` tutorial.
Expand Down Expand Up @@ -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
Expand All @@ -336,7 +347,7 @@ the event of a network partition.
<replica-set-node-priority>` 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-reconfiguration-usage>`.

.. _replica-set-chained-replication:
Expand Down Expand Up @@ -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 <replica-set-admin-procedure-add-member>`.
Additionally, consider using the :ref:`replica set reconfiguration procedure
<replica-set-reconfiguration-usage>` 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:
Expand All @@ -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

Expand All @@ -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:

Expand All @@ -496,32 +507,32 @@ 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
<rs.conf.members>` array. The final operation
calls :method:`rs.reconfig()` with the argument of ``cfg`` to initialize
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 <replica-set-hidden-members>`,
:ref:`delayed members <replica-set-delayed-members>`, and
:ref:`arbiters <replica-set-arbiters>` all have :data:`~local.system.replset.settings.members[n].priority`
:ref:`arbiters <replica-set-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::

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand All @@ -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
Expand All @@ -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:

Expand All @@ -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:

Expand Down Expand Up @@ -1155,20 +1166,20 @@ 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``
has the ``Timestamp`` type:

.. 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
Expand All @@ -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
Expand Down
9 changes: 4 additions & 5 deletions source/reference/command/addShard.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down
2 changes: 1 addition & 1 deletion source/reference/connection-pool-stats.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading