@@ -407,8 +407,8 @@ directly.
407
407
Replacing a Member
408
408
~~~~~~~~~~~~~~~~~~
409
409
410
- Use this procedure to replace a member of a replica set when the host
411
- name has changed. This procedure preserves all existing configuration
410
+ Use this procedure to replace a member of a replica set when the hostname
411
+ has changed. This procedure preserves all existing configuration
412
412
for a member, except its hostname/location.
413
413
414
414
You may need to replace a replica set member if you want to replace an
@@ -937,3 +937,32 @@ use an update operation that resembles the following:
937
937
Modify the timestamp values as needed based on your oplog entry. This
938
938
operation may take some period to complete because the update must
939
939
scan and pull the entire oplog into memory.
940
+
941
+ Duplicate Key Error on local.slaves
942
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
943
+
944
+ The *duplicate key on local.slaves* error, shown below, occurs when a
945
+ :term:`secondary` or :term:`slave` changes its hostname and the
946
+ :term:`primary` or :term:`master` tries to update its ``local.slaves``
947
+ collection with the new name. The update fails because it contains the
948
+ same `_id` value as the document containing the previous hostname.
949
+
950
+ .. example::
951
+
952
+ .. code-block:: javascript
953
+
954
+ exception 11000 E11000 duplicate key error index: local.slaves.$_id_ dup key: { : ObjectId('<object ID>') } 0ms
955
+
956
+ This is a benign error and does not affect replication operations on
957
+ the :term:`secondary` or :term:`slave`.
958
+
959
+ To stop the error from appearing, drop the ``local.slaves`` collection
960
+ from the :term:`primary` or :term:`master`, as shown here:
961
+
962
+ .. code-block:: javascript
963
+
964
+ db.slaves.drop()
965
+
966
+ The next time a :term:`secondary` or :term:`slave` polls the
967
+ :term:`primary` or :term:`master`, the :term:`primary` or :term:`master`
968
+ recreates the ``local.slaves`` collection.
0 commit comments