mongorestore

Mongodb data files become smaller after migration

南笙酒味 提交于 2019-12-23 10:21:57
问题 On my first server I get: root@prod ~ # du -hs /var/lib/mongodb/ 909G /var/lib/mongodb/ After migration this database with mongodump/mongorestore On my second server I get: root@prod ~ # du -hs /var/lib/mongodb/ 30G /var/lib/mongodb/ After I waited a few hours, mongo finished indexing I got: root@prod ~ # du -hs /var/lib/mongodb/ 54G /var/lib/mongodb/ I tested database and there's no corrupted or missed data. Why there's so big difference in size before and after migration? 回答1: MongoDB does

mongorestore fails due to invalid BSONSize

我们两清 提交于 2019-12-20 18:06:06
问题 I have a script which dumps a mongodb mongodump --archive=$MONGODB_PATH --host $MONGODB_HOST --port $MONGODB_PORT --username $MONGODB_USER --password $MONGODB_PASS --db $MONGODB_NAME but when I try to restore it with mongorestore -d db_name backup/dump it fails with: Failed: dump_name: error restoring from backup/dump/dump_name: reading bson input: invalid BSONSize: -2120621459 bytes I tried --batchSize=100 but it didn't solve the issue for me. What's going wrong here? Solution was:

How to mongodump from OpenShift and mongorestore locally on MongoDB 2.4.9?

可紊 提交于 2019-12-18 13:25:13
问题 I just did this myself (as a RockMongo export and import was corrupted) so just posting here. Note this was for MongoDB verison 2.4.9 with corresponding versions of mongodump and mongorestore . 回答1: Read the documentation relevant to your versions first, backup, make sure the solution below is relevant to your scenario etc. http://docs.mongodb.org/v2.4/reference/program/mongodump/ http://docs.mongodb.org/v2.4/reference/program/mongorestore/ BEGIN 20/11/18 update I just had to revisit these

Mongorestore to a different database

我只是一个虾纸丫 提交于 2019-12-18 11:15:42
问题 In MongoDB, is it possible to dump a database and restore the content to a different database? For example like this: mongodump --db db1 --out dumpdir mongorestore --db db2 --dir dumpdir But it doesn't work. Here's the error message: building a list of collections to restore from dumpdir dir don't know what to do with subdirectory "dumpdir/db1", skipping... done 回答1: You need to actually point at the "database name" container directory "within" the output directory from the previous dump:

Mongodb monogorestore “root directory must be a dump of a single database”

℡╲_俬逩灬. 提交于 2019-12-18 09:02:13
问题 I'm trying to restore a mongodump to a differently named database (which should be possible via --db <dbname> switch). My working directory contains a single dump folder, which contains a single db dump. However, when I try this command: mongorestore --port xxxxx --db some_destination_db I get the following error: ERROR: ERROR: root directory must be a dump of a single database ERROR: when specifying a db name with --db I have no idea why I'm getting this, and can't find any help on google.

Mongodb monogorestore “root directory must be a dump of a single database”

只愿长相守 提交于 2019-12-18 09:02:09
问题 I'm trying to restore a mongodump to a differently named database (which should be possible via --db <dbname> switch). My working directory contains a single dump folder, which contains a single db dump. However, when I try this command: mongorestore --port xxxxx --db some_destination_db I get the following error: ERROR: ERROR: root directory must be a dump of a single database ERROR: when specifying a db name with --db I have no idea why I'm getting this, and can't find any help on google.

How to use the dumped data by mongodump?

我与影子孤独终老i 提交于 2019-12-17 15:34:28
问题 I have used mongodump to dump my database of mongodb, it created some bson files under dump/mydb But I don't know how to use them. I tried mongoimport , but seems it can't import bson data. Then how to use these bson files? How to import them to another mongodb? 回答1: You need to use mongorestore , not mongoimport ... which is used for things like importing json, or csv, etc. From the back-up-with-mongodump docs: mongodump reads data from a MongoDB database and creates high fidelity BSON files

Failed: no intent for collection in archive

你说的曾经没有我的故事 提交于 2019-12-13 16:23:04
问题 Since i dropped my MongoDB database i get this error ]1 Failed: no intent for collection in archive: 回答1: Apparently it's a limitation of mongodump and mongorestore that they won't work if there is a forward-slash in the collection name, because it is a path separator character at the OS level: https://jira.mongodb.org/browse/TOOLS-1163 来源: https://stackoverflow.com/questions/34796469/failed-no-intent-for-collection-in-archive

mongorestore issue : Cannot restore users with schema version 1 to a system with server version 2.5.4 or greater

人盡茶涼 提交于 2019-12-13 00:42:03
问题 I have a mongodb production database running on mongo 2.4.8 and I would like to upgrade to 2.6.x. The way we want to do that is first load the data to another server running 2.6.3 using mongorestore . However when running the mongorestore command we get the following error: Cannot restore users with schema version 1 to a system with server version 2.5.4 or greater I cannot find anything related to this issue and do't know what to do. In case it matters, the database itself was not created

mongodb dump and pipe to other db name

别说谁变了你拦得住时间么 提交于 2019-12-11 05:49:14
问题 Mongodb version 3.2.12. I have two local databases, "base1" and "base2" I want to copy all data (all collections) from base1 over to base2, replacing everything there (like when dumping production to a dev environment). Any pipe command (or other simple way) to do this? I tried mongodump --archive --db base1 | mongorestore --db base2 --archive lists a lot of "writing base1.collectionname to archive on stdout", but nothing gets written to base2. I also tried mongodump --db base1 --gzip -