Skip to main content

Replicaset troubleshooting

We are getting continous timeout and duplicate index key error:

After checking to the replica set status [rs.status()] , it was found that secondaries are out of sync and stale. And one of the replica set has no Primary

Check if secondaries were lagging by
rs.printSlaveReplicationInfo()

Then we end up with refresh all the secondaries.






Comments

Popular posts from this blog

Recover Recently Deleted documents

use recoverDoc ; for ( i = 0 ; i < 100 ; i ++){ db . col1 . insert ({ _id : i })}; for ( i = 100 ; i < 200 ; i ++){ db . col1 . insert ({ _id : i , name : "some_x_name" })}; > db . col1 . remove ({ "name" : "some_x_name" }) WriteResult ({ "nRemoved" : 100 }) use local ; db . oplog . rs . find ({ op : "i" , ns : "recoverDoc .col1" , "o.name" : "some_x_name" }). count (); 100 db . oplog . rs . find ({ op : "i" , ns : "recoverDoc .col1 " , "o.name" : "some_x_name" }, { "o" : 1 }); { "o" : { "_id" : 100 , "name" : "some_x_name" } } { "o" : { "_id" : 101 , "name" : "some_x_name" } } { "o" : { "_id" : 102 , "name" : "some_x_name" } } { "o" : { ...

Mongod log is growing too large.

We have log append true in config file. Every day log is appended to the single log file. We are facing issue in space and we were also not able to purge the log file completely. So we need logs file for every day, if we have space issue then we can remove the old logs. Only thing we need to do is: In config file make sure we have: logappend = true Then login to mongo shell, run the below command against the admin database. use admin db.runCommand({logRotate:1})