Difference between revisions of "Mongodump"

From wikieduonline
Jump to navigation Jump to search
 
(19 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{Draft}}
+
{{lowercase}}
  
 +
<code>mongodump</code><ref>https://docs.mongodb.com/database-tools/mongodump/</ref> reads data from a [[MongoDB]] database and creates high fidelity [[BSON]] files which the mongorestore tool can use to populate a MongoDB database. <code>mongodump</code> provides the <code>--oplog</code> option to include in its output oplog entries that occur during the mongodump operation
  
 +
 +
 +
 +
Database backup:
 +
* <code>[[mongodump]] --archive=test.20150715.archive --db your_db_name</code> (Use: <code>[[show dbs]]</code> to view available DBs)
 +
* <code>mongodump  --db=test --[[collection]]=records</code>
 +
* <code>mongodump --dumpDbUsersAndRoles -d YOUR_DB -o /outputpaht/directory/</code>
 +
 +
 +
== [[Sharded]] Clusters ==
 +
Backups created with <code>mongodump</code> do not maintain the atomicity guarantees of transactions across shards
 +
 +
== Related commands ==
 +
* <code>[[mysqldump]]</code>
 +
* <code>[[mariabackup]]</code>
 +
* <code>[[mongorestore]]</code>
 +
* <code>[[Ops manager]]</code> requires Enterprise Advanced subscriptions
  
 
== See also ==
 
== See also ==
* [[MongoDB]]
+
* {{MongoDB}}
 
* {{dbdump}}
 
* {{dbdump}}
  
 
[[Category:Databases]]
 
[[Category:Databases]]
 
[[Category:backup]]
 
[[Category:backup]]

Latest revision as of 11:45, 18 February 2022

mongodump[1] reads data from a MongoDB database and creates high fidelity BSON files which the mongorestore tool can use to populate a MongoDB database. mongodump provides the --oplog option to include in its output oplog entries that occur during the mongodump operation



Database backup:

  • mongodump --archive=test.20150715.archive --db your_db_name (Use: show dbs to view available DBs)
  • mongodump --db=test --collection=records
  • mongodump --dumpDbUsersAndRoles -d YOUR_DB -o /outputpaht/directory/


Sharded Clusters[edit]

Backups created with mongodump do not maintain the atomicity guarantees of transactions across shards

Related commands[edit]

See also[edit]

  • https://docs.mongodb.com/database-tools/mongodump/
  • Advertising: