Replica set error "errmsg" : "Our replica set config is invalid or we are not a member of it", "code" : 93, "codeName" : "InvalidReplicaSetConfig"

9,174 views
Skip to first unread message

Pooja Parab

unread,
Jan 13, 2017, 5:09:27 AM1/13/17
to mongodb-user
 
HI,

I having mongodb with 3 replica set members on aws. Initially it was working fine. Then i have changed port number other than 27017 , restart the mongodb service and trying to initiate replication again but I am getting below error.

{
        "info" : "try querying local.system.replset to see current configuration",
        "ok" : 0,
        "errmsg" : "already initialized",
        "code" : 23,
        "codeName" : "AlreadyInitialized"
}
bdg-mongodb:OTHER> rs.status()
{
        "state" : 10,
        "stateStr" : "REMOVED",
        "uptime" : 79,
        "optime" : {
                "ts" : Timestamp(1484289332, 1),
                "t" : NumberLong(3)
        },
        "optimeDate" : ISODate("2017-01-13T06:35:32Z"),
        "ok" : 0,
        "errmsg" : "Our replica set config is invalid or we are not a member of it",
        "code" : 93,
        "codeName" : "InvalidReplicaSetConfig"
}

can anybody help me here to recover this error.


Thanks,
Pooja 

Attila Tozser

unread,
Jan 13, 2017, 8:25:59 AM1/13/17
to mongod...@googlegroups.com
Hi,

What rs.config() says?

You may just need to change the replicaset config on the primary, to reflect the new port: https://docs.mongodb.com/manual/reference/method/rs.reconfig/

Best,
Attila 

--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.
 
For other MongoDB technical support options, see: https://docs.mongodb.com/manual/support/
---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user+unsubscribe@googlegroups.com.
To post to this group, send email to mongod...@googlegroups.com.
Visit this group at https://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/cf109868-9de6-4963-aa71-05ad129628e5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Pooja Parab

unread,
Jan 14, 2017, 12:33:44 AM1/14/17
to mongodb-user
yes i tried to change config on primary. But it is saying  "stateStr" : "REMOVED", It is not master. How i can make it master?

-pooja
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user...@googlegroups.com.

Attila Tozser

unread,
Jan 14, 2017, 2:19:45 AM1/14/17
to mongod...@googlegroups.com
In case you changed the ports on all servers for sure all will show this message. On two from your three servers, you need to set the port back to the old one and than you will have a primary. You may look into the collection:

set1:OTHER> use local
set1:OTHER> db.system.replset.findOne()
{
"_id" : "set1",
"version" : 1,
"protocolVersion" : NumberLong(1),
"members" : [
{
"_id" : 0,
"host" : "xxxxxxxxx:27017",
"arbiterOnly" : false,
"buildIndexes" : true,
"hidden" : false,
"priority" : 1,
......

Once you have a primary, you can change the port one-by-one on the processes, not all at once, as the link describing. In the example above, i have a 1 node set, with replicaset configuration on port 27017 but i started the service on the port 27018 it is in the state as you described:

set1:OTHER> rs.status()
{
"state" : 10,
"stateStr" : "REMOVED",
"uptime" : 282,
"optime" : {
"ts" : Timestamp(1484377715, 1),
"t" : NumberLong(1)
},
"optimeDate" : ISODate("2017-01-14T07:08:35Z"),
"ok" : 0,
"errmsg" : "Our replica set config is invalid or we are not a member of it",
"code" : 93,
"codeName" : "InvalidReplicaSetConfig"
}

After flipping back to the original port (27017):

set1:PRIMARY> rs.status()
{
"set" : "set1",
"date" : ISODate("2017-01-14T07:14:36.974Z"),
"myState" : 1,
"term" : NumberLong(2),
"heartbeatIntervalMillis" : NumberLong(2000),
"optimes" : {
"lastCommittedOpTime" : {
"ts" : Timestamp(1484378072, 1),
"t" : NumberLong(2)
},
"appliedOpTime" : {
"ts" : Timestamp(1484378072, 1),
"t" : NumberLong(2)
},
"durableOpTime" : {
"ts" : Timestamp(1484378072, 1),
"t" : NumberLong(2)
}
},
"members" : [
{
"_id" : 0,
"name" : "xxxxxxx:27017",
"health" : 1,
"state" : 1,
"stateStr" : "PRIMARY",
"uptime" : 26,
"optime" : {
"ts" : Timestamp(1484378072, 1),
"t" : NumberLong(2)
},
"optimeDate" : ISODate("2017-01-14T07:14:32Z"),
"infoMessage" : "could not find member to sync from",
"electionTime" : Timestamp(1484378051, 1),
"electionDate" : ISODate("2017-01-14T07:14:11Z"),
"configVersion" : 1,
"self" : true
}
],
"ok" : 1
}

Your port number maybe different, and you need the majority of your nodes to be healthy to have a primary, but you find the right settings in local.db.system.replset

Best,
Attila

To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user+unsubscribe@googlegroups.com.

To post to this group, send email to mongod...@googlegroups.com.
Visit this group at https://groups.google.com/group/mongodb-user.
Reply all
Reply to author
Forward
0 new messages