Skip to content

DOCS-401 added topic on dupe key in slaves error #289

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 5 commits into from
Oct 5, 2012
Merged
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
33 changes: 31 additions & 2 deletions source/administration/replica-sets.txt
Original file line number Diff line number Diff line change
Expand Up @@ -398,8 +398,8 @@ directly.
Replacing a Member
~~~~~~~~~~~~~~~~~~

Use this procedure to replace a member of a replica set when the host
name has changed. This procedure preserves all existing configuration
Use this procedure to replace a member of a replica set when the hostname
has changed. This procedure preserves all existing configuration
for a member, except its hostname/location.

You may need to replace a replica set member if you want to replace an
Expand Down Expand Up @@ -928,3 +928,32 @@ use an update operation that resembles the following:
Modify the timestamp values as needed based on your oplog entry. This
operation may take some period to complete because the update must
scan and pull the entire oplog into memory.

Duplicate Key Error on local.slaves
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The *duplicate key on local.slaves* error, shown below, occurs when a
:term:`secondary` or :term:`slave` changes its hostname and the
:term:`primary` or :term:`master` tries to update its ``local.slaves``
collection with the new name. The update fails because it contains the
same `_id` value as the document containing the previous hostname.

.. example::

.. code-block:: javascript

exception 11000 E11000 duplicate key error index: local.slaves.$_id_ dup key: { : ObjectId('<object ID>') } 0ms

This is a benign error and does not affect replication operations on
the :term:`secondary` or :term:`slave`.

To stop the error from appearing, drop the ``local.slaves`` collection
from the :term:`primary` or :term:`master`, as shown here:

.. code-block:: javascript

db.slaves.drop()

The next time a :term:`secondary` or :term:`slave` polls the
:term:`primary` or :term:`master`, the :term:`primary` or :term:`master`
recreates the ``local.slaves`` collection.