Reputation: 1608
I have difficulty updating mongodb from version 2.0.6 to the current 2.4. Please help
Below is the log file that i get:
Tue May 14 08:02:03.339 [initandlisten] MongoDB starting : pid=1906 port=27017 dbpath=/mnt2/var/lib/mongodb/ 64-bit host=ip-10-131-65-73
Tue May 14 08:02:03.339 [initandlisten] db version v2.4.3
Tue May 14 08:02:03.339 [initandlisten] git version: fe1743177a5ea03e91e0052fb5e2cb2945f6d95f
Tue May 14 08:02:03.340 [initandlisten] build info: Linux ip-10-2-29-40 2.6.21.7-2.ec2.v1.2.fc8xen #1 SMP Fri Nov 20 17:48:28 EST 2009 x86_64 BOOST_LIB_VERSION=1_49
Tue May 14 08:02:03.340 [initandlisten] allocator: tcmalloc
Tue May 14 08:02:03.340 [initandlisten] options: { dbpath: "/mnt2/var/lib/mongodb/" }
Tue May 14 08:02:03.347 [initandlisten] journal dir=/mnt2/var/lib/mongodb/journal
Tue May 14 08:02:03.347 [initandlisten] recover : no journal files present, no recovery needed
Tue May 14 08:02:03.554 [initandlisten] build index backendtemp.system.users { user: 1, userSource: 1 }
Tue May 14 08:02:03.557 [initandlisten] Duplicate key exception while trying to build unique index on backendtemp.system.users. You most likely have user documents with duplicate "user" fields. To resolve this, start up with a version of MongoDB prior to 2.4, drop the duplicate user documents, then start up again with the current version.
Tue May 14 08:02:03.557 [initandlisten] exception in initAndListen: 11000 E11000 duplicate key error index: backendtemp.system.users.$user_1_userSource_1 dup key: { : "ad", : null }, terminating
Tue May 14 08:02:03.557 dbexit:
Tue May 14 08:02:03.557 [initandlisten] shutdown: going to close listening sockets...
Tue May 14 08:02:03.557 [initandlisten] shutdown: going to flush diaglog...
Tue May 14 08:02:03.557 [initandlisten] shutdown: going to close sockets...
Tue May 14 08:02:03.558 [initandlisten] shutdown: waiting for fs preallocator...
Tue May 14 08:02:03.558 [initandlisten] shutdown: lock for final commit...
Tue May 14 08:02:03.558 [initandlisten] shutdown: final commit...
Tue May 14 08:02:03.572 [initandlisten] shutdown: closing all files...
Tue May 14 08:02:03.573 [initandlisten] closeAllFiles() finished
Tue May 14 08:02:03.573 [initandlisten] journalCleanup...
Tue May 14 08:02:03.573 [initandlisten] removeJournalFiles
Tue May 14 08:02:03.575 [initandlisten] shutdown: removing fs lock...
Tue May 14 08:02:03.575 dbexit: really exiting now
Upvotes: 2
Views: 1392
Reputation: 146
If you can't or won't downgrade mongodb, you can also use mongodump
and then mongorestore
. You will loose every mongo user but get your data back.
mongodump --dbpath OLD_DB_PATH -d DATABASENAME -o /tmp/dumps
mongorestore --dbpath NEW_DB_PATH -d DATABASENAME /tmp/dumps/DATABASENAME/
dbpath
option has been removed, forcing you to have a running mongod on the dbpath to run those commands, which is precisely what's not working right now...mongod --dbpath NEW_DB_PATH --repair
Upvotes: 0
Reputation: 5940
Small script pasties regarding this (ubuntu):
NOTE: replace CAPS by you vars...
sudo apt-get install mongodb-10gen=2.2.7
<- reduce version, probably want 2.2.7 its the latest pre-2.4 (as of May 2014)mongo
CONFIG_SERVER_HOST:CONFIG_SERVER_PORT/admin
# <- connect to mongo config server,
db.system.users.find().sort({_id:1})
<- would display the admin users sorted by id which is like sorting ascending by time here, coz its bson.db.system.users.remove({_id : ObjectId('
ID_TO_BE_REMOVED')})
<- remove the culprit, USE WITH CARE. if you not sure, start by creating another admin user for backup.sudo apt-get install mongodb-10gen
<- will upgrade back to latest 2.4.X. not it will not upgrade to 2.6 (which is good, coz you want to ensure 2.4 is working first) because its a different apt-get package for 2.6 (mongodb-org).HTH
Upvotes: 1
Reputation: 2175
In version 2.4 MongoDB introduced a role-based access control which requires uniqueness of the user in user privilege documents per database. Previous versions of MongoDB didn't have this requirement, so that your database may have duplicate user entries in system.users.
You can either:
See: MongoDB 2.4 Upgrade Recommendations and Checklist
Upvotes: 3