My mongodb sharded cluster is set with 1-member
replica set for config server with 6 shards
, 1 mongos
. All these components are hosted on a single server with mongos on 0.0.0.0:27017
and rest on 127.0.0.1
. All addresses have been configured through hostnames in /etc/hosts
i.e 127.0.0.1
as configrs
, 0.0.0.0
as mongos
and bindIP in mongo config holds these hostnames and not IP addresses.
I want to host a mongos on separate server. Since config server was hosted on 127.0.0.1:27018
, to make it reachable I stopped the config mongo, updated /etc/hosts contents from 127.0.0.1 configrs
to 0.0.0.0 configrs
and restarted the config mongo. But now, rs.status()
returns
"state" : 10,
"stateStr" : "REMOVED",
"uptime" : 12,
"optime" : { "ts" : Timestamp(1521449062, 2),
"t" : NumberLong(3)
},
"optimeDate" : ISODate("2018-03-19T08:44:22Z"),
"ok" : 0,
"errmsg" : "Our replica set config is invalid or we are not a member of it",
"code" : 93,
"codeName" : "InvalidReplicaSetConfig"
How do I move my config server from 127.0.0.1
to 0.0.0.0
? I went through hostname change documentation for mongo, but it lists down steps to change hostnames whereas I am not changing hostname.