Questions tagged [mongodump]

Mongodump is a utility for creating a binary export of the contents of a database.

Consider using this utility as part of an effective backup strategy. Use mongodump in conjunction with mongorestore to restore databases.

362 questions
4
votes
3 answers

Multiple databases and collections mongodump

I have something like this: dbs=$(mongo --quiet --eval "db.getMongo().getDBNames()" --host exemple.com | \ grep '"' | tr -d '"' | tr -d ',') for db in $dbs; do cols=$(mongo --quiet --eval "print(db.getCollectionNames())" $db \ …
basante
  • 515
  • 3
  • 9
  • 20
4
votes
0 answers

Authentification fail with mongodump

I try to create a backup of my MongoDB replicaset but I have an authentication problem :D . So when I try to use mongodump root@e03c2a89ac31:/# mongodump -u myBackupAccount -p 123456 --host mongo1 --out /home/backup 2017-01-17T11:00:41.069+0000 …
David
  • 1,177
  • 3
  • 11
  • 26
4
votes
1 answer

Is it necessary to perform an fsyncLock in MongoDB before creating a dump with mongodump?

In the 2.6 docs it was explicitly stated that db.fsyncLock() should not be used when running mongodump: Do not use mongodump with db.fsyncLock(). But this information has disappeared since the 3.0 version of the docs. There is actually no info at…
Ruben
  • 3,986
  • 1
  • 21
  • 34
4
votes
1 answer

mongodump and mongorestore changes order of documents

I am using mongodump command to dump mongodb data, but when I am restoring it using mongorestore it changes order of documents (order in which documents was inserted), What might be the issue? Is there any way by which I can preserve insertion…
Rushi Soni
  • 1,088
  • 1
  • 13
  • 21
4
votes
0 answers

seeding a new replica set member with mongorestore is not recommended, why?

In docs, I found the following statement: IMPORTANT Always use filesystem snapshots to create a copy of a member of the existing replica set. Do not use mongodump and mongorestore to seed a new replica set member. what do I have to do if my…
Sergey Grechin
  • 876
  • 11
  • 14
4
votes
0 answers

How to restore a single mongodb database with oplogReplay?

I'm having trouble finding if this is even a supported operation. I found things that suggest it didn't use to be, but I'm not getting any logs that indicate it's not supported (just confusing logs) and I wasn't able to find anything in mongo's docs…
RutledgePaulV
  • 2,568
  • 3
  • 24
  • 47
4
votes
1 answer

mongorestore not working. collection is empty

i am trying to dump a mongodb collection to file, and then use that to restore to another mongodb instance. dumping - mongodump --host 127.0.0.1 --port 27017 --username vespauser --password --collection vespastats --db vespa --out…
Quest Monger
  • 8,252
  • 11
  • 37
  • 43
4
votes
1 answer

mongorestore takes a lot of time, how about I just copy-paste the '/data/db' directory?

In my case, I want to backup and restore all the databases. This might sound stupid but - Instead of doing # backup mongodump # takes time # restore mongorestore # takes a lot of time Why can't I just # backup tar -cvzf /backup/mongo.tar.gz…
Optimus
  • 2,716
  • 4
  • 29
  • 49
4
votes
1 answer

mongodb mongodump mongorestore

I have executed "mongodump" on 3-shard cluster against the database with size 600GB and chunks equally distributed across all 3 shards. My mongodump command was like this: mongodump --db mydb123 --authenticationDatabase admin --journal -u root -p…
vrdba
  • 59
  • 2
  • 5
4
votes
1 answer

How do I update the mongodb binaries in my nitrous.io box to the 2.4.x versions?

I am taking the "mongodb for node.js" course and trying to import/restore data to my mongolab instance but I keep getting Auth err code 18 errors. I can connect to any instance I create using the mongo --shell from the nitrous.io box and it works…
EX0TUS
  • 43
  • 3
4
votes
1 answer

Mongodump for Daily Backups

I am considering using mongodump for daily backups. If I always perform the dump on the same directory: do I have to make sure to clear the contents from the previous day, before running mongodump? I could not find anything about this in the…
Eduardo
  • 8,362
  • 6
  • 38
  • 72
4
votes
1 answer

mongo query raises a BSONElement: bad type 65

We're running into a situation where documents that exist in our MongoDB can't be queried for without resulting in: db.collection.find({"_id":ObjectId("50d393be70a580280b117ea5")}) Wed Jan 2 12:30:44 Assertion: 10320:BSONElement: bad type…
Dougnukem
  • 14,709
  • 24
  • 89
  • 130
3
votes
0 answers

How to free memory after mongodump?

Is there a way to tell mongodump or mongod to that effect, to free the current used ram? I have an instance with a Mongo DB server which has a couple of databases which total around 2GB. The instance has 5GB of ram. Every night I have a backup cron…
wren
  • 41
  • 3
3
votes
3 answers

Read mongodump manually

I have a large dump file created by mongodump utility, for example "test.dump". I want get one exact collection from this dump, and manually read it into memory for further processing as valid BSON documents. I cannot load full dump in memory due to…
Nikolay Prokopyev
  • 1,260
  • 12
  • 22
3
votes
0 answers

mongodump - not authenticating when using secondary

I am having an issue that I cannot figure out. When I do a backup from the primary the dump works. When I do it from the secondary it always get the error "listDatabases requires authentication". If I connect with mongo using the same user I can…
sam
  • 175
  • 7