Note that there are some explanatory texts on larger screens.

plurals
  1. POCan I force a replica set PRIMARY to recognize the optime of a newly re-synced SECONDARY member in mongodb?
    primarykey
    data
    text
    <p>I recently had a replica set member fall a few days out of sync. Using the <a href="http://www.mongodb.org/display/DOCS/Resyncing+a+Very+Stale+Replica+Set+Member" rel="nofollow">"Resyncing a Very Stale Replica Set Member" instructions,</a> I stopped <code>mongod</code> on the secondary machine, wiped out the data directories, restarted the process, and let the machine re-sync to the primary.</p> <p>Everything worked perfectly, or so it seemed. Logging suggested the sync went fine. Eventually, it showed as complete, resulting in the following <code>rs.status()</code> output on the secondary machine:</p> <pre><code># The secondary machine's status for itself and its primary: { "_id" : 0, "name" : "myprimary:myport", "health" : 1, "state" : 1, "stateStr" : "PRIMARY", "uptime" : 497, "optime" : { "t" : 1347562257000, "i" : 1 }, "optimeDate" : ISODate("2012-09-13T18:50:57Z"), "lastHeartbeat" : ISODate("2012-09-13T19:00:34Z"), "pingMs" : 3 }, { "_id" : 2, "name" : "mysecondary:myport", "health" : 1, "state" : 2, "stateStr" : "SECONDARY", "optime" : { "t" : 1347562257000, "i" : 1 }, "optimeDate" : ISODate("2012-09-13T18:50:57Z"), "self" : true } </code></pre> <p>As expected, the machines are in sync, and share an optime value. But the primary machine is a different story. It still shows the out-of-sync secondary, even though the optime for the primary advanced since the re-syncing completed.</p> <pre><code># The primary machine's status for itself and its secondary: { "_id" : 0, "name" : "myprimary:myport", "health" : 1, "state" : 1, "stateStr" : "PRIMARY", "uptime" : 497, "optime" : { "t" : 1347562257000, "i" : 1 }, "optimeDate" : ISODate("2012-09-13T18:50:57Z"), "self" : true }, { "_id" : 2, "name" : "mysecondary:myport", "health" : 1, "state" : 2, "stateStr" : "SECONDARY", "optime" : { "t" : 1347103757000, "i" : 1 }, "optimeDate" : ISODate("2012-09-08T11:29:17Z"), "lastHeartbeat" : ISODate("2012-09-11T17:27:06Z"), "pingMs" : 3 } </code></pre> <p>What am I missing? At first I thought "wait it out", but it's been nearly an hour and the database had inserts in that time. Can I force the primary to heartbeat-check the secondary, or do I need to re-sync them again?</p> <p>The only real oddity I can find on the primary is this:</p> <pre><code>PRIMARY&gt; use local; PRIMARY&gt; db.slaves.find() { "_id" : ObjectId("4f675b909d8e143a90055864"), "host" : "&lt;hostIP&gt;", "ns" : "local.oplog.rs", "syncedTo" : { "t" : 1347395837000, "i" : 1 } } { "_id" : ObjectId("50522761212b77e9637ad541"), "host" : "&lt;hostIP&gt;", "ns" : "local.oplog.rs", "syncedTo" : { "t" : 1347562257000, "i" : 1 } } </code></pre> <p>These are the same hosts (the secondary machine in question). My understanding is this should show one entry, but I'm hesitant to touch it without a better understanding of what it tracks and how it updates.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload