django - Node is not in primary or recovering state upon removal of instance from replication set -
i have 4 mongo instances in replication set, 1 of them obsolete , needs removed, when run rs.remove("hostname")
django application instantly starts throwing node not in primary or recovering state upon removal of instance replication set
until add instance in.
this rs.status()
rs_pimapi:primary> rs.status() { "set" : "rs_pimapi", "date" : isodate("2017-07-28t01:27:05.607z"), "mystate" : 1, "term" : numberlong(-1), "heartbeatintervalmillis" : numberlong(2000), "optimes" : { "lastcommittedoptime" : { "ts" : timestamp(1501205225, 1), "t" : numberlong(-1) }, "appliedoptime" : timestamp(1501205225, 1), "durableoptime" : timestamp(1501205222, 1) }, "members" : [ { "_id" : 25, "name" : "10.231.158.108:27017", "health" : 1, "state" : 1, "statestr" : "primary", "uptime" : 7212131, "optime" : timestamp(1501205225, 1), "optimedate" : isodate("2017-07-28t01:27:05z"), "electiontime" : timestamp(1500629818, 1), "electiondate" : isodate("2017-07-21t09:36:58z"), "configversion" : 278273, "self" : true }, { "_id" : 29, "name" : "10.0.1.95:27017", "health" : 1, "state" : 2, "statestr" : "secondary", "uptime" : 20216, "optime" : timestamp(1501205222, 1), "optimedurable" : timestamp(1501205222, 1), "optimedate" : isodate("2017-07-28t01:27:02z"), "optimedurabledate" : isodate("2017-07-28t01:27:02z"), "lastheartbeat" : isodate("2017-07-28t01:27:04.286z"), "lastheartbeatrecv" : isodate("2017-07-28t01:27:04.373z"), "pingms" : numberlong(1), "syncingto" : "10.231.158.108:27017", "configversion" : 278273 }, { "_id" : 30, "name" : "10.0.0.213:27017", "health" : 1, "state" : 2, "statestr" : "secondary", "uptime" : 14382, "optime" : timestamp(1501205222, 1), "optimedurable" : timestamp(1501205222, 1), "optimedate" : isodate("2017-07-28t01:27:02z"), "optimedurabledate" : isodate("2017-07-28t01:27:02z"), "lastheartbeat" : isodate("2017-07-28t01:27:04.380z"), "lastheartbeatrecv" : isodate("2017-07-28t01:27:04.401z"), "pingms" : numberlong(1), "syncingto" : "10.0.1.95:27017", "configversion" : 278273 }, { "_id" : 31, "name" : "10.124.225.51:27017", "health" : 1, "state" : 2, "statestr" : "secondary", "uptime" : 6595, "optime" : timestamp(1501205222, 1), "optimedurable" : timestamp(1501205222, 1), "optimedate" : isodate("2017-07-28t01:27:02z"), "optimedurabledate" : isodate("2017-07-28t01:27:02z"), "lastheartbeat" : isodate("2017-07-28t01:27:03.679z"), "lastheartbeatrecv" : isodate("2017-07-28t01:27:03.716z"), "pingms" : numberlong(0), "syncingto" : "10.0.0.213:27017", "configversion" : 278273 } ], "ok" : 1 }
and rs.config()
{ "_id" : "rs_pimapi", "version" : 278273, "members" : [ { "_id" : 25, "host" : "10.231.158.108:27017", "arbiteronly" : false, "buildindexes" : true, "hidden" : false, "priority" : 1, "tags" : { }, "slavedelay" : numberlong(0), "votes" : 1 }, { "_id" : 29, "host" : "10.0.1.95:27017", "arbiteronly" : false, "buildindexes" : true, "hidden" : false, "priority" : 0.5, "tags" : { }, "slavedelay" : numberlong(0), "votes" : 1 }, { "_id" : 30, "host" : "10.0.0.213:27017", "arbiteronly" : false, "buildindexes" : true, "hidden" : false, "priority" : 1, "tags" : { }, "slavedelay" : numberlong(0), "votes" : 1 }, { "_id" : 31, "host" : "10.124.225.51:27017", "arbiteronly" : false, "buildindexes" : true, "hidden" : false, "priority" : 1, "tags" : { }, "slavedelay" : numberlong(0), "votes" : 1 } ], "settings" : { "chainingallowed" : true, "heartbeatintervalmillis" : 2000, "heartbeattimeoutsecs" : 10, "electiontimeoutmillis" : 10000, "catchuptimeoutmillis" : 2000, "getlasterrormodes" : { }, "getlasterrordefaults" : { "w" : 1, "wtimeout" : 0 } } }
and in django settings have set replica set replica_hosts = 'mongodb://10.231.158.108,10.0.1.95,10.0.0.51'
the problem appears when try remove 10.124.225.51
which, isn't referenced in config, , understanding of replication sets, should able taken out safely.
Comments
Post a Comment