vijaidhas
vijaidhas

Reputation: 94

mongodb - not able to access data by copying /data/db files to new machine

I am a newbie to mongodb and I need a help on mongodb data restoration.

Earlier, I had been running mongo instance (2.6.4) in my windows 7 64bit and had different dbs and collections in it. currently I bought a laptop with windows 8 64 bit.

Now I want to use the same db in windows 8. I tried copying all data files (/data/db) from old laptop to new one and tried starting the mongod instance.

(Note: I am using same version of mongodb in my old and new laptop)

It did not start properly and getting below error. kindly help to resolve.

Thanks in Advance

C:\Users\vijaidhas>mongod --dbpath E:\Mongo\data\db

2015-01-11T20:54:36.787+0530 [initandlisten] MongoDB starting : pid=5420 port=27017 dbpath=E:\Mongo\data\db 64-bit host=vinayag

2015-01-11T20:54:36.788+0530 [initandlisten] targetMinOS: Windows 7/Windows Server 2008 R2

2015-01-11T20:54:36.788+0530 [initandlisten] db version v2.6.4

2015-01-11T20:54:36.789+0530 [initandlisten] build info: windows sys.getwindowsversion(major=6, minor=1, build=7601, platform=2, service_pack='Service Pack 1') BOOST_LIB_VERSION=1_49

2015-01-11T20:54:36.789+0530 [initandlisten] allocator: system

2015-01-11T20:54:36.789+0530 [initandlisten] options: { storage: { dbPath: "E:\Mongo\data\db" } }

2015-01-11T20:54:36.843+0530 [initandlisten] journal dir=E:\Mongo\data\db\journal

2015-01-11T20:54:36.844+0530 [initandlisten] recover : no journal files present, no recovery needed

2015-01-11T20:54:36.945+0530 [initandlisten] blog Assertion failure isOk() D:\data\mci\shell\src\src\mongo/db/storage/extent.h 80

2015-01-11T20:54:37.460+0530 [initandlisten] mongod.exe ...\src\mongo\util\stacktrace.cpp(169) mongo::printStackTrace+0x43

2015-01-11T20:54:37.460+0530 [initandlisten] mongod.exe ...\src\mongo\util\log.cpp(127) mongo::logContext+0x9c

2015-01-11T20:54:37.461+0530 [initandlisten] mongod.exe ...\src\mongo\util\assert_util.cpp(115) mongo::verifyFailed+0x14a

2015-01-11T20:54:37.461+0530 [initandlisten] mongod.exe ...\src\mongo\db\storage\extent_manager.cpp(229) mongo::ExtentManager::getExtent+0x66

2015-01-11T20:54:37.461+0530 [initandlisten] mongod.exe ...\src\mongo\db\structure\collection_iterator.cpp(58) mongo::FlatIterator::FlatIterator+0x93

2015-01-11T20:54:37.461+0530 [initandlisten] mongod.exe ...\src\mongo\db\catalog\collection.cpp(137) mongo::Collection::getIterator+0xad

2015-01-11T20:54:37.461+0530 [initandlisten] mongod.exe ...\src\mongo\db\exec\collection_scan.cpp(92) mongo::CollectionScan::work+0xc7

2015-01-11T20:54:37.461+0530 [initandlisten] mongod.exe ...\src\mongo\db\query\plan_executor.cpp(91) mongo::PlanExecutor::getNext+0x16b

2015-01-11T20:54:37.461+0530 [initandlisten] mongod.exe ...\src\mongo\db\catalog\database.cpp(325) mongo::Database::clearTmpCollections+0x12d

2015-01-11T20:54:37.462+0530 [initandlisten] mongod.exe ...\src\mongo\db\db.cpp(383) mongo::repairDatabasesAndCheckVersion+0x2b9

2015-01-11T20:54:37.462+0530 [initandlisten] mongod.exe ...\src\mongo\db\db.cpp(734) mongo::_initAndListen+0xae1

2015-01-11T20:54:37.462+0530 [initandlisten] mongod.exe ...\src\mongo\db\db.cpp(781) mongo::initAndListen+0x27

2015-01-11T20:54:37.462+0530 [initandlisten] mongod.exe ...\src\mongo\db\db.cpp(1019) mongoDbMain+0x255

2015-01-11T20:54:37.462+0530 [initandlisten] mongod.exe ...\src\mongo\db\db.cpp(824) wmain+0x35

2015-01-11T20:54:37.462+0530 [initandlisten] mongod.exe f:\dd\vctools\crt_bld\self_64_amd64\crt\src\crt0.c(278) __tmainCRTStartup+0x13b

2015-01-11T20:54:37.462+0530 [initandlisten] KERNEL32.DLL BaseThreadInitThunk+0xd

2015-01-11T20:54:37.462+0530 [initandlisten] blog

2015-01-11T20:54:37.463+0530 [initandlisten] exception in initAndListen: 0 assertion D:\data\mci\shell\src\src\mongo/db/storage/extent.h:80, terminating

2015-01-11T20:54:37.463+0530 [initandlisten] dbexit:

2015-01-11T20:54:37.463+0530 [initandlisten] shutdown: going to close listening sockets...

2015-01-11T20:54:37.463+0530 [initandlisten] shutdown: going to flush diaglog...

2015-01-11T20:54:37.463+0530 [initandlisten] shutdown: going to close sockets...

2015-01-11T20:54:37.463+0530 [initandlisten] shutdown: waiting for fs preallocator...

2015-01-11T20:54:37.463+0530 [initandlisten] shutdown: lock for final commit...

2015-01-11T20:54:37.463+0530 [initandlisten] shutdown: final commit...

2015-01-11T20:54:37.486+0530 [initandlisten] shutdown: closing all files...

2015-01-11T20:54:37.489+0530 [initandlisten] closeAllFiles() finished

2015-01-11T20:54:37.489+0530 [initandlisten] journalCleanup...

2015-01-11T20:54:37.489+0530 [initandlisten] removeJournalFiles

2015-01-11T20:54:37.504+0530 [initandlisten] shutdown: removing fs lock...

2015-01-11T20:54:37.504+0530 [initandlisten] dbexit: really exiting now

Upvotes: 0

Views: 902

Answers (1)

NoOutlet
NoOutlet

Reputation: 1969

You should use the mongodump and mongorestore commands to create and restore data from and to mongodb.

I don't know technically why mongodb can't read the files that were in the data directories, but even if it had appeared to work, it would be much safer to do data migration the official way.

Upvotes: 4

Related Questions