Skip to content

Commit 8c08e46

Browse files
author
Bob Grabar
committed
DOCS-401 major edits: dupe key in local.slaves
1 parent 2a31f63 commit 8c08e46

File tree

1 file changed

+13
-24
lines changed

1 file changed

+13
-24
lines changed

source/administration/replica-sets.txt

Lines changed: 13 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -932,40 +932,29 @@ scan and pull the entire oplog into memory.
932932
Duplicate Key Error on local.slaves
933933
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
934934

935-
The duplicate key error on local.slaves, shown below, occurs when a
936-
connected host changes its hostname. This is a benign error and does not
937-
affect operations.
935+
The *duplicate key on local.slaves* error, shown below, occurs when a
936+
:term:`secondary` or :term:`slave` changes its hostname and the
937+
:term:`primary` or :term:`master` tries to update its ``local.slaves``
938+
collection with the new name but runs into a duplicate `_id` field. The
939+
duplicate `_id` field exists in a document containing the previous
940+
hostname.
938941

939942
.. example::
940943

941944
.. code-block:: javascript
942945

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

945-
The error occurs when a host connected to the current host, either
946-
through :term:`replica sets <replica set>` or through :term:`master`- :term:`slave`
947-
configuration, changes its hostname. The ``local.slaves`` collection
948-
creates a new document with the new hostname but also keeps the old
949-
document with the old hostname. The local.slaves`` collection now has
950-
two documents with the same ``_id`` field.
948+
This is a benign error and does not affect replication operations on
949+
the :term:`secondary` or :term:`slave`.
951950

952-
.. example:: This example shows a ``local.slaves`` collection where the
953-
hostname for ``mdb1.example.net`` changed to ``db1.example.net``. Both
954-
hostnames still exist in the collection, and both have the same ``_id``.
955-
956-
.. code-block:: javascript
957-
958-
PRIMARY> db.slaves.find()
959-
{ "_id" : "101", "host" : "mdb1.example.net", "ns" : "local.oplog.rs", "syncedTo" : Timestamp(1338775234001, 1) }
960-
{ "_id" : "102", "host" : "mdb2.example.net", "ns" : "local.oplog.rs", "syncedTo" : Timestamp(1338775234002, 1) }
961-
{ "_id" : "101", "host" : "db1.example.net", "ns" : "local.oplog.rs", "syncedTo" : Timestamp(1349290750000, 1) }
962-
963-
To stop the error from appearing, drop the ``local.slaves`` collection, as
964-
shown here:
951+
To stop the error from appearing, drop the ``local.slaves`` collection
952+
from the :term:`primary` or :term:`master`, as shown here:
965953

966954
.. code-block:: javascript
967955

968956
db.slaves.drop()
969957

970-
At the next synchronization of the replica set or the master-slave configuration, MongoDB re-creates the
971-
``local.slaves`` collection and records only the current hostnames.
958+
The next time a :term:`secondary` or :term:`slave` polls the
959+
:term:`primary` or :term:`master`, the :term:`primary` or :term:`master`
960+
recreates the ``local.slaves`` collection.

0 commit comments

Comments
 (0)