Search code examples
mongodbsharding

MongoDB 'This node was not started with the replSet option


First of all I know this has the same title as mine, but in my case it's not the wrong port.

I want to setup sharding on my local machine I start with the following command:

mongod --shardsvr --replSet rs1 --port 27017 --dbpath D:\mongo\data1\db

Then do the following:

mongo --port 27017
rs.initiate({_id : "rs1", version: 1, members: [ {_id : 0, "host" : "localhost:27017"} ] })

I'm still getting the following:

{
        "ok" : 0,
        "errmsg" : "This node was not started with the replSet option",
        "code" : 76,
        "codeName" : "NoReplicationEnabled"
}

I already tried by changing localhost with 127.0.0.1 but doesn't work. I've searched for a while now, but the only solution people are giving the wrong port, while i'm 100% certain that this isn't the case here.

Anyone know how to fix?

Thanks in advance!


Solution

  • Problem was that mongoDB automatically launches an instance apperently. If i use ports >= 20 it works, but 17-19 not. I can only connect to 27017 though, 18 & 19 doesn't work.

    But my 100% sure that it wasn't about ports was obviously wrong!