Skip to content

DOCS-1492 replSetStepDown, replSetSyncFrom, db.printShardingStatus, sh.status, param-verbose-printShardingStatus #1147

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

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 0 additions & 4 deletions source/includes/param-verbose-printShardingStatus.rst

This file was deleted.

28 changes: 28 additions & 0 deletions source/reference/command/replSetStepDown-field.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
object:
name: replSetStepDown
type: command
field:
optional: true
type: field
name: replSetStepDown
type: number
position: 1
description: |
A number of seconds for the member to avoid election to primary. If you
do not specify a value for ``<seconds>``, :dbcommand:`replSetStepDown`
will attempt to avoid reelection to primary for 60 seconds.
---
object:
name: replSetStepDown
type: command
field:
optional: true
type: field
name: force
type: Boolean
position: 2
description: |
New in version 2.0: Forces the :term:`primary` to step down even if
there are no secondary members within 10 seconds of the primary's
latest optime.
...
37 changes: 18 additions & 19 deletions source/reference/command/replSetStepDown.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,37 +4,36 @@ replSetStepDown

.. default-domain:: mongodb

.. dbcommand:: replSetStepDown
Description
-----------

:option boolean force: Forces the :term:`primary` to step down
even if there aren't any secondary
members within 10 seconds of the
primary's latest optime. This option is
not available in versions of
:program:`mongod` before 2.0.
.. dbcommand:: replSetStepDown

The :dbcommand:`replSetStepDown` command forces the :term:`primary`
Forces the :term:`primary`
of the replica set to relinquish its status as primary. This
initiates an :ref:`election for primary
<replica-set-election-internals>`. You may specify a number of
seconds for the node to avoid election to primary:

.. code-block:: javascript

{ replSetStepDown: <seconds> }
<replica-set-election-internals>`.

If you do not specify a value for ``<seconds>``,
:dbcommand:`replSetStepDown` will attempt to avoid reelection to primary for
60 seconds.
.. include:: /reference/command/replSetStepDown-field.rst

.. warning:: :dbcommand:`replSetStepDown` forces all clients
currently connected to the database to disconnect. This helps
ensure that clients maintain an accurate view of the replica
set.

.. versionadded:: 2.0
If there is no :term:`secondary`, within 10 seconds of the
If there is no :term:`secondary` within 10 seconds of the
primary, :dbcommand:`replSetStepDown` will not succeed to
prevent long running elections.

.. slave-ok, admin-only
Example
-------

The following example specifies that the former primary avoids
reelection to primary for 120 seconds:

.. code-block:: javascript

db.runCommand( { replSetStepDown: 120 } )

.. slave-ok, admin-only
13 changes: 13 additions & 0 deletions source/reference/command/replSetSyncFrom-field.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
object:
name: replSetSyncFrom
type: command
field:
optional: false
type: field
name: replSetSyncFrom
type: string
position: 1
description: |
The name and port number of the replica set member that this member
should replicate from. Use the ``[hostname]:[port]`` form.
...
55 changes: 33 additions & 22 deletions source/reference/command/replSetSyncFrom.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,43 +4,54 @@ replSetSyncFrom

.. default-domain:: mongodb

Description
-----------

.. dbcommand:: replSetSyncFrom

.. versionadded:: 2.2

:option host: Specifies the name and port number of the replica set member
that this member should replicate from. Use
the ``[hostname]:[port]`` form.

:dbcommand:`replSetSyncFrom` allows you to explicitly configure
which host the current :program:`mongod` will pull :term:`oplog`
entries from. This operation may be useful for testing different
Explicitly configures
which host the current :program:`mongod` pulls :term:`oplog`
entries from. This operation is useful for testing different
patterns and in situations where a set member is not replicating from
the host you want. The member to replicate from must be a valid
source for data in the set.
the desired host.

The :dbcommand:`replSetSyncFrom` command has the following form:

.. code-block:: javascript

{ replSetSyncFrom: "hostname<:port>" }

A member cannot replicate from:
The :dbcommand:`replSetSyncFrom` command has the following field:

- itself.
- an arbiter, because arbiters do not hold data.
- a member that does not build indexes.
- an unreachable member.
- a :program:`mongod` instance that is not a member of the same
.. include:: /reference/command/replSetSyncFrom-field.rst

The Target Member
-----------------

The member to replicate from must be a valid source for data in the
set. The member cannot be:

- The same as the :program:`mongod` on which you run
:dbcommand:`replSetSyncFrom`. In other words, a member cannot
replicate from itself.
- An arbiter, because arbiters do not hold data.
- A member that does not build indexes.
- An unreachable member.
- A :program:`mongod` instance that is not a member of the same
replica set.

If you attempt to replicate from a member that is more than 10 seconds
behind the current member, :program:`mongod` will log a
warning, but it will still replicate from the member that is lagging.
warning but will still replicate from the lagging member.

If you run :dbcommand:`replSetSyncFrom` during initial sync, MongoDB
produces no error messages, but the sync target will not change
until after the initial sync operation.

The command has the following prototype form:

.. code-block:: javascript

{ replSetSyncFrom: "hostname<:port>" }
Run from the ``mongo`` Shell
----------------------------

To run the command in the :program:`mongo` shell, use the following
invocation:
Expand All @@ -50,7 +61,7 @@ replSetSyncFrom
db.adminCommand( { replSetSyncFrom: "hostname<:port>" } )

You may also use the :method:`rs.syncFrom()` helper in the
:program:`mongo` shell, in an operation with the following form:
:program:`mongo` shell in an operation with the following form:

.. code-block:: javascript

Expand Down
13 changes: 13 additions & 0 deletions source/reference/method/db.printShardingStatus-param.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
object:
name: db.printShardingStatus
type: method
field:
optional: true
type: param
name: verbose
type: Boolean
position: 1
description: |
If ``true``, the method displays details of the document distribution
across chunks when you have 20 or more chunks.
...
8 changes: 7 additions & 1 deletion source/reference/method/db.printShardingStatus.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ db.printShardingStatus()

.. default-domain:: mongodb

Definition
----------

.. method:: db.printShardingStatus()

Prints a formatted report of the sharding configuration and the
Expand All @@ -12,7 +15,10 @@ db.printShardingStatus()
Only use :method:`db.printShardingStatus()` when connected to a
:program:`mongos` instance.

.. include:: /includes/param-verbose-printShardingStatus.rst
The :method:`db.printShardingStatus()` method has the following
parameter:

.. include:: /reference/method/db.printShardingStatus-param.rst

See :doc:`/reference/method/sh.status` for details of the output.

Expand Down
13 changes: 13 additions & 0 deletions source/reference/method/sh.status-param.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
object:
name: sh.status
type: method
field:
optional: true
type: param
name: verbose
type: Boolean
position: 1
description: |
If ``true``, the method displays details of the document
distribution across chunks when you have 20 or more chunks.
...
14 changes: 8 additions & 6 deletions source/reference/method/sh.status.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,17 @@ Definition
information regarding existing chunks in a :term:`sharded cluster`.
The default behavior suppresses the detailed chunk information if
the total number of chunks is greater than or equal to 20.

.. include:: /includes/param-verbose-printShardingStatus.rst

The :method:`sh.status()` method has the following parameter:

.. include:: /reference/method/sh.status-param.rst

.. seealso:: :method:`db.printShardingStatus()`

.. end-include-here

Example Output
--------------
Output Examples
---------------

The :ref:`sharding-status-version-fields` section displays information on the
:term:`config database`:
Expand Down Expand Up @@ -95,8 +97,8 @@ range(s).
tag: <tag1> { <shard key> : <min range1> } -->> { <shard key> : <max range1> }
...

Output
------
Output Fields
-------------

.. _sharding-status-version-fields:

Expand Down