我使用以下页面上的说明在ubuntu上安装了mongo:
https://docs.mongodb.org/manual/tutorial/install-mongodb-on-os-x/
deploy@stockgame-with-login:~$ mongod --dbpath ~/data/db
Sun Jan 10 15:16:22.090 [initandlisten] MongoDB starting : pid=28452 port=27017 dbpath=/home/deploy/data/db 64-bit host=stockgame-with-login
Sun Jan 10 15:16:22.091 [initandlisten] db version v2.4.14
Sun Jan 10 15:16:22.092 [initandlisten] git version: 05bebf9ab15511a71bfbded684bb226014c0a553
Sun Jan 10 15:16:22.092 [initandlisten] build info: Linux ip-10-154-253-119 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
Sun Jan 10 15:16:22.092 [initandlisten] allocator: tcmalloc
Sun Jan 10 15:16:22.093 [initandlisten] options: { dbpath: "/home/deploy/data/db" }
Sun Jan 10 15:16:22.098 [initandlisten] journal dir=/home/deploy/data/db/journal
Sun Jan 10 15:16:22.099 [initandlisten] recover : no journal files present, no recovery needed
Sun Jan 10 15:16:22.209 [initandlisten] ****
Sun Jan 10 15:16:22.210 [initandlisten] ****
Sun Jan 10 15:16:22.210 [initandlisten] need to upgrade database local with pdfile version 4.22, new version: 4.5
Sun Jan 10 15:16:22.210 [initandlisten] Not upgrading, exiting
Sun Jan 10 15:16:22.210 [initandlisten] run --upgrade to upgrade dbs, then start again
Sun Jan 10 15:16:22.210 [initandlisten] ****
Sun Jan 10 15:16:22.210 dbexit:
Sun Jan 10 15:16:22.211 [initandlisten] shutdown: going to close listening sockets...
Sun Jan 10 15:16:22.211 [initandlisten] shutdown: going to flush diaglog...
Sun Jan 10 15:16:22.211 [initandlisten] shutdown: going to close sockets...
Sun Jan 10 15:16:22.211 [initandlisten] shutdown: waiting for fs preallocator...
Sun Jan 10 15:16:22.211 [initandlisten] shutdown: lock for final commit...
Sun Jan 10 15:16:22.211 [initandlisten] shutdown: final commit...
Sun Jan 10 15:16:22.211 [initandlisten] shutdown: closing all files...
Sun Jan 10 15:16:22.213 [initandlisten] closeAllFiles() finished
Sun Jan 10 15:16:22.213 [initandlisten] journalCleanup...
Sun Jan 10 15:16:22.213 [initandlisten] removeJournalFiles
Sun Jan 10 15:16:22.214 [initandlisten] shutdown: removing fs lock...
Sun Jan 10 15:16:22.215 dbexit: really exiting now
deploy@stockgame-with-login:~$
答案 0 :(得分:0)
你需要运行
mongod --dbpath ~/data/db --upgrade
您指向的当前数据库似乎来自旧版本的Mongo,并且不推荐使用它的格式。
请注意,此--upgrade
参数很可能不会向后兼容,而较旧的Mongo版本将无法读取它。如果这是不可接受的,您将需要使用旧版本的Mongo打开数据库,例如2.6。