1

I'm trying to repair a mongo database and am running into the following error early on:

Wed Jul 24 16:55:21 [initandlisten] ERROR: error: exception cloning object in local.system.replset 
E11000 duplicate key error index: local.system.replset.$_id_  dup key: { : "replicaset-name" } 
obj:{ _id: "replicaset-name", version: 92, members: [ { _id: 16, host: "host1:27032" },
 { _id: 17, host: "host2:27032" },
 { _id: 18, host: "host3:27032", priority: 0.0, hidden: true },
 { _id: 19, host: "host4:27032", priority: 6.0 },
 { _id: 20, host: "host5:27032", priority: 7.0 },
 { _id: 22, host: "host6:27032", priority: 4.0 },
 { _id: 23, host: "host7:27032", priority: 3.0 },
 { _id: 24, host: "host8:27032", votes: 0, priority: 0.0 } ] }

(replica set and host names have been sanitized for public posting)

To attempt the repair I shut down the mongod and started it up with

/usr/bin/mongod-2.2 -f /var/local/mongo/mongod.conf --nojournal --repair --repairpath /mnt/mongo_repair/

My mongod.conf consists of just two lines:

dbpath = /var/local/mongo/data/replicaset-name
port = 17000

The .conf normally did have a replSet declaration, but this was removed for the repair as I'm trying to run the repair on a secondary. (Per the docs repairs can only be done on primaries or standalones; so need to make it look like a standalone temporarily).

Any idea what the problem could be?

1 Answer 1

1

ReplSet configuration exists on many other members of that replica set. You can safely drop the local db collections (you can even drop the whole DB but then you will just end up syncing from another replica and there is no point to repairing this entire DB). So drop the troublesome collection - it will be recreated when the host rejoins its replica set. The only local collection you need to keep will be the oplog.rs collection - this would allow this member to know where to start catching up for operations it misses while you are doing repairs.

3
  • What I ended up doing was starting the mongo up w/o the --repair option, and did a .repairDatabase() from the console. I'm not entirely sure why but that seemed to work w/o issue.
    – atxdba
    Jul 31, 2013 at 23:40
  • Further, I was really trying to avoid letting mongo do a sync from scratch as the replset is quite large and the mongods span datacenters.
    – atxdba
    Jul 31, 2013 at 23:47
  • deleting local collections other than oplog.rs would NOT make the replica resync. Aug 2, 2013 at 8:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.