Mongodb replica set state showing "RECOVERY"

I installed a replica set on 3 mongo servers and imported 5 GB of data. now the status of the secondary server shows "RECOVERY". Could you tell me what “RESTORATION” means and how to solve this problem.

Status below

rs.status() { "set" : "kutendarep", "date" : ISODate("2013-01-15T05:04:18Z"), "myState" : 3, "members" : [ { "_id" : 0, "name" : "10.1.4.138:27017", "health" : 1, "state" : 3, "stateStr" : "RECOVERING", "uptime" : 86295, "optime" : Timestamp(1357901076000, 4), "optimeDate" : ISODate("2013-01-11T10:44:36Z"), "errmsg" : "still syncing, not yet to minValid optime 50f04941:2", "self" : true }, { "_id" : 1, "name" : "10.1.4.21:27017", "health" : 1, "state" : 1, "stateStr" : "PRIMARY", "uptime" : 86293, "optime" : Timestamp(1358160135000, 18058), "optimeDate" : ISODate("2013-01-14T10:42:15Z"), "lastHeartbeat" : ISODate("2013-01-15T05:04:18Z"), "pingMs" : 0 }, { "_id" : 2, "name" : "10.1.4.88:27017", "health" : 1, "state" : 3, "stateStr" : "RECOVERING", "uptime" : 86291, "optime" : Timestamp(1357900674000, 10), "optimeDate" : ISODate("2013-01-11T10:37:54Z"), "lastHeartbeat" : ISODate("2013-01-15T05:04:16Z"), "pingMs" : 0, "errmsg" : "still syncing, not yet to minValid optime 50f04941:2" } ], "ok" : 1 
+8
source share
2 answers

A message on the nodes of the REPAIR replica set means that they are still performing initial synchronization. These nodes are not readable until they transition to the Secondary state.

There are several steps in the initial synchronization.

See here for more information on the replica set synchronization process: http://docs.mongodb.org/manual/core/replica-set-sync/

+10
source

Log in to the RECOVERING instance.
Verify the REPAIR instance of the replication state with
db.printReplicationInfo()
You will get such a result,

First Opel Time: Tuesday, July 30, 2019 5:26:37 PM GMT + 0000 (UTC)
Opportunity time of the last event: Wed 31 July 2019 16:46:53 GMT + 0000
Now: Thursday, August 22, 2019 7:36:38 AM GMT + 0000 (UTC)

If you find the difference between the time of the last plow and now .

This means that this particular instance is not PRIMARY and SECONDARY and is not an active member from the replica set.

Now there are two solutions for this.
First
1. Log in to the recovery instance
. 2. Delete the data from the existing db , which will be / data / db
3. Restart this instance of RECOVERY
4. ( optional ) If you find the following error. Delete this mongod.pid file from the specified location.

 Error starting mongod. /var/run/mongod/mongod.pid 


5. Restart the instance.
6. Now your recovering instance will be able to
, and instead of RESET, PRIMARY or SECONDARY will be displayed.

Second
Copy another working instance of the data to the OBTAIN instance and restart mongodb .

0
source

All Articles