Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mongodb : could not find member to sync from

I'm fairly new with mongodb

I have a replica set 3 nodes 1 primary (A) 1 secondary (B) 1 Arbiter (C)

The replica set was created using MMS the 3 node are in 3 different cities

I keep on getting the following error on the secondary that last for lest then a second each time

  1. is it normal
  2. if not any idea how to correct it

           {
                    "_id" : 1,
                    "name" : "B:27017",
                    "health" : 1,
                    "state" : 2,
                    "stateStr" : "SECONDARY",
                    "uptime" : 1213371,
                    "optime" : Timestamp(1434051221, 1),
                    "optimeDate" : ISODate("2015-06-11T19:33:41Z"),
                    "infoMessage" : **"could not find member to sync from"**,
                    "configVersion" : 4,
                    "self" : true
            },
    

Thank you

Regards

Philippe Courtois

like image 748
Philippe Courtois Avatar asked Jun 12 '15 17:06

Philippe Courtois


3 Answers

You need to make sure that A, B, C resolves on each of the nodes.

Add them in /etc/hosts

a x.x.x.x b x.x.x.x c x.x.x.x

and do this on every node, then restart mongod, this should fix it

like image 127
Tim Avatar answered Nov 08 '22 18:11

Tim


make sure the secondary has at minimum the same priority value as the primary or lower. in my case, i had the secondary priority value higher than the primary's priority

you can check this by running

mongodcluster:PRIMARY> rs.conf()

https://docs.mongodb.com/manual/tutorial/adjust-replica-set-member-priority/

like image 38
bobby Avatar answered Nov 08 '22 19:11

bobby


May your oplog is full. You can increase the oplog size.

Try do this

  1. Shut down the primary
  2. Create a backup of the oplog using direct access to the data files
  3. Restart the mongod in standalone mode
  4. Copy the current oplog to a temporary collection
  5. Delete the current oplog
  6. Recreate the oplog with the desired size
  7. Copy back the oplog entries from the temporary collection to the shiny new oplog
  8. Restart mongod as part of the replica set

You can find more on: Change the Size of the Oplog

like image 1
Igor Carvalho Avatar answered Nov 08 '22 18:11

Igor Carvalho