Discover mongodb backup and restore, include the articles, news, trends, analysis and practical advice about mongodb backup and restore on alibabacloud.com
Configure MongoDB configuration items in the configuration file and back up and restore the database, mongodb backup and recoveryI. mongoDB command line startup option Configuration
When mongodb is started using the command line,
--headerline CSV,TSV Only-use first line as H Eaders--upsert Insert or update objects that already exist--upsertfields arg comma-separated fields for the Q Uery part of the Upsert. Should make sure this is indexed--stoponerror stop importing at first error rather than continuing--jsonarray Load a JSON array, not one item per line. Currently limited to 16MB. Additional import and export operations: 1. mongoimport-d my_mongodb-c User User.datParameter description:-d indicates which library
The principle of mongodump.exe backup is to get the current server snapshot through a single query. The snapshot is written to disk, so it is not stored in real time, because the server will have data writes after the snapshot is taken, and in order to secure the backup, we can also use the Fsync lock to temporarily write the server data to the cache.
Efficient open source database (
[[emailprotected] mongodb]# mongorestore -d tank /home/zhangy/mongodb/tank/ #tank这个数据库的备份路径 [[emailprotected] mongodb]# mongorestore -d tank_new /home/zhangy/mongodb/tank/ #将tank还有tank_new数据库中
These two commands can be implemented to backup and
Tags: god represents file HTML common category name cat stringZhang Ying published in 2013-12-03 Category list: NoSQL Tags: mongodb, backup, import, export, restore MongoDB data backup and restore is mainly divided into two kinds,
Label:MongoDB data backup and restore is mainly divided into two kinds, one is for the library of Mongodump and Mongorestore, one is for the table in the library mongoexport and Mongoimport. One, Mongodump backup database 1, Common command grid
Mongodump-h IP--port Port-u user name-p password-d database-o file exists path
If there is no user who
MongoDB data backup and restore is mainly divided into two kinds, one is for the library of Mongodump and Mongorestore, one is for the table in the library mongoexport and Mongoimport.One, Mongodump backup database1, Common command gridMongodump-h IP--port Port-u user name-p password-d database-o file exists pathIf the
Reference Official Documentation: MongoDB Backup MethodsA backup restore was made using a snapshot of the operating system, and the restore did not succeed after the backup was successful (refer to:
These two commands enable the database to be backed up and restored, and the file format is JSON and Bson. Cannot point to write to table backup or restore.
Four, Mongoexport export tables, or some of the fields in the table
1, commonly used command format
Mongoexport-h IP--port Port-u username-p password-D database-C table name-F field-Q condition export--csv-o file name
The above pa
)--journal enable journaling (relevant only ifDBPath specified)-d [--DB] arg database to use-c [--collection] arg collection to use (some commands)-O [--out] arg (=dump) output directory or "-" for stdout-Q [--query] arg JSON query--oplog use Oplog for Point-in-timeSnapshotting--repair try to recover a crashed database--forcetablescan Force a table scan$snapshot)Export Database[Email protected] ~]# mongodump-h 127.0.0.1--port 30216-d test-uxxxx-pxxxxx-o home/
One, MongoDB Backup 1, mongodb backup backup data using the following command mongodump-h dbhost-d Dbname-o dbdirectory back up the user database [[email protected] bin]#. mongodump-h127.0.0.1-d User-o/home/[[email protected] bin]# Ls/home/user/b3.bson B3.metadata.json C1.bs
One: Back up the databaseG:\Program files\mongodb\server\3.0\bin>mongodump-d Mydb-o G:/data/backMongodump-h IP--port Port-u user name-p password-d database-o file exists pathIf there are no users, you can remove-u and-P.If you export the native database, you can remove-H.If it is the default port, you can remove--port.If you want to export all databases, you can remove-D.Export all databasesCommand: Mongodump-h 127.0.0.1-o/home/zhangy/
Database backup –mongodump
Back up all local MongoDB databases:
Copy Code code as follows:
# mongodump-h 127.0.0.1--port 27017-o/root/db/alldb
To back up a remote specified database:
Copy Code code as follows:
# mongodump-h 192.168.1.233--port 27018-d yourdb-o/root/db/yourdb
More Mongodump Detailed
Database Restore
heterogeneous data migrationData backup MongodumpYou can use Mongodump to make a library or table-level backup of MongoDB, as illustrated below:1. Backing Up the Iflashbuy_log database>c:\mongo\bin\mongodump-d Iflashbuy_logA dump directory is created in the current directory to hold the backed-up files, or to specify the directory where the
MongoDB permissions, Backup, restore, de-weight
PermissionsData security is a critical part of a database, so here's a general procedure for setting up MongoDB user rights.First, create a new database administrator in unlicensed mode:Start the database service:mongodEnable the Named line tool:mongouse admindb.creat
can be different from the time of backup, such as Test2 –directoryperdb: The location of the backup data, for example: C:\data\dump\test, Why do you want to add a test here instead of a dump at the time of backup, and read the tips yourself? –drop: When recovering, delete the current data and then restore the backed
Backup of the data is very much in the two ways, of course, you can also take advantage of the snapshot:---------------------------------------------------------------------One, direct copy data file Mode backup restore----------------------------------------------------------------------Note: When calling the Db.fsyncunlock () and Db.fsynclock () commands, do no
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.