@@ -932,40 +932,29 @@ scan and pull the entire oplog into memory.
932
932
Duplicate Key Error on local.slaves
933
933
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
934
934
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.
938
941
939
942
.. example::
940
943
941
944
.. code-block:: javascript
942
945
943
946
exception 11000 E11000 duplicate key error index: local.slaves.$_id_ dup key: { : ObjectId('<object ID>') } 0ms
944
947
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`.
951
950
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:
965
953
966
954
.. code-block:: javascript
967
955
968
956
db.slaves.drop()
969
957
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