Alexander Mills
Alexander Mills

Reputation: 100370

replica set config is invalid but it's also already initialized?

I definitely did NOT already initialize a replica set. But I get this:

test> use admin
switched to db admin
admin> rs.status()
MongoServerError: Our replica set config is invalid or we are not a member of it
admin> 

admin> rs.initiate({
...       "_id" : "rs0",
...       "members" : [
...           { "_id" : 0, "host" : "127.0.0.1:27017" },
...       ]
...   })

MongoServerError: already initialized

does anyone know what could be going on here? Just trying to initialize a replica set, it works locally on Mac, but not working on Amazon Linux (on EC2).

Upvotes: -1

Views: 1773

Answers (1)

Alexander Mills
Alexander Mills

Reputation: 100370

I was using docker-compose. The docker volume was storing the replica-set info. So even when docker-compose restarted (docker-compose down + up), the original (and invalid) replica-set was still stored.

My only complaint is that you can't easily override the current replica-set. It would be nice if it gave you a shell option or API to do so.

Upvotes: 1

Related Questions