Replica Set primary in state OTHER

One option.

Restart with both the lan ip and 127.0.0.1 bound, you likely want 127.0.0.1 bound for convenience.

net:
  port: 27017
  bindIp: 192.168.0.1,127.0.0.1

Then you can reconfigure the replicaset:

var c = rs.conf()
//use hostnames, you'll thank yourself later
c.members[0].host='rocketchat1:27017'
rs.reconfig(c)

Another option:

Don’t bind 127.0.0.1 and reconfigure as-is:

var c = rs.conf()
//use hostnames, you'll thank yourself later
c.members[0].host='rocketchat1:27017'
rs.reconfig(c,{force:true})

Third option:

Drop the replicaset config and start again.

  1. Start mongod without replicaset enabled.
  2. Drop the local database.
use local
db.dropDatabase()
  1. Start mongod with replicaset option enabled.
  2. Initialize the replicaset.
rs.initiate({_id:'rs01',members:[{_id:0, host:'rocketchat1:27017'}]})
3 Likes