Error when initiating replica set with some old data in local database:
rs.initiate()
{
"errmsg" : "local.oplog.rs is not empty on the initiating member. cannot initiate.",
"ok" : 0
}
Solution:
use local
db.oplog.rs.drop()
Error when initiating replica set with some old data in local database:
rs.initiate()
{
"errmsg" : "local.oplog.rs is not empty on the initiating member. cannot initiate.",
"ok" : 0
}
Solution:
use local
db.oplog.rs.drop()
Error when initiate replicaset in MongoDB:
“errmsg” : “replSet error loading set config (BADCONFIG)”, “ok” : 0 }
Solution:
1. Stop mongod, delete all local.* files in DBPath, start mongod or delete database local directly in mongo shell:
use local
db.dropDatabase()
2. Reconfigure replica set members:
config = {_id: “repl1″, members:[
{_id: 0, host: ‘192.168.2.1:27017′},
{_id: 1, host: ‘192.168.2.2:27017′}]
}
rs.reconfig(config, {force: true})