The importance of database backup and data recovery, I think you know, here is an example of how to manipulate data backups, examples of data recovery:
Creating test data
Create Db:testdb,collection:user, insert 10 records
MONGO MongoDB Shell version:3.0.2 connecting
1.The content of the Data user.csv file imported into the csvformat is as follows: _ id, name, ageObjectID (4eed9f9ca939118694cf05e4), ming, 10 ObjectI
1. The contents of the user.csv file for importing CSV data are as follows: _ id, name, age ObjectID (4eed9f9ca939118694cf05e4), ming, 10 ObjectI
1. Import CSV data
(1) MongoDB Export (Mongoexport).
You can run the command by running:./mongoexport--help
./mongoexport--help Options:--help produce help message-v [--verbose] being more verbose (include multiple times for more verbosity e.g.-vvvvv)--version print th
E program's version and Exit-h [--host] arg MONGO host to connect to (Parameter description.
For example, I export a table in a database.
./mongoexport-h 127.0.0.1--port 27
Suppose there is a user table in the database with two records in it. We want to export it.
Common export Methods[Root @ localhost bin] #./export-D my_mongodb-C user-o User. dat
Connected to: 127.0.0.1
Exported 2 records
[Root @ localhost bin] # Cat user. dat
{"_ Id": {"$ oid": "4f81a4a1779282ca68fd8a5a" }," uid ": 2," username ":" Jerry "," Age ": 100}
{"_ Id": {"$ oid": "4f844d1847d25a9ce5f120c4"}, "uid": 1, "username": "Tom", "Age": 25}
[Root @ localhost bin] #
Parameter description
-D indic
First, train of thoughtMongovue free version support MySQL import MONGO, so the idea is that SQL Server import MySQL, and then import MONGO from MySQL.
Second, prepare
1, install MySQL database (I am using Wamp, integrated mysql,phpadmin), if necessary, build your own database such as MyData
2, download Mysql-connector-odbc-5.1.12-win32.msi, install
3, Start-
Tags: mongoexport mysql utf8mb4 error 1262 (01000)Requirements: Export the MONGODB data specified field and then specify the field to import into the MySQL tableGo straight,Finally, you will encounter a few problems and solutions, so that a similar problem can be resolved quickly (the specific usage of the commands used during the period is not covered in this ar
Label:Backup data:Mongodump-h 192.168.2.20-u game-p 12345678-d dbname-o/data/test/--excludecollection=user_statsWhere-H is the IP address,-u account,-p password,-d database name,-o path to store data,--excludecollection represents the collection to be filtered,--excludecollectionswithprefix represents a prefix to filter some collectionsImport data:Mongorestore--db Gourmet--collection User_face_data/home/gam
Label: requirements: Identify the data from the MongoDB, determine if there is a cluster, if any, import this piece of data+A column cluster, if not, the data does not contain the column cluster to directly post the code: PackageTest; Importjava.util.ArrayList;ImportJava.uti
MongoDB Data export, import, and index creation(1) Data Export-one file per table:# Mongoexport--db Project--collection table name--out output file name, such as:# Mongoexport--DB Project--collectionstock--out Stock.json, export all F10 data to file/root/stock.json(2)
First, train of thought
Mongovue free version support MySQL import MONGO, so the idea is that SQL Server import MySQL, and then import MONGO from MySQL.
Second, prepare
1, install MySQL database (I am using Wamp, integrated mysql,phpadmin), if necessary, build your own database such as MyData
2, download Mysql-connector-odbc-5.1.12-win32.msi, install
3, Star
MongoDB import, export, backup, recovery, user authorization (4), mongodb ImportV. MongoDB import, export, backup, recovery, and user authorizationI. Data export and Data ImportAs a DBA
Document directory
2. 1. Export data from the table to a file (using trusted connections)
2. export data from the table to a file (using Hybrid Authentication)
2. 3. Import the data in the file to the table
0. References:
SQL Server BCP usage Summary
BCP Utility
How to import
Here is an example of importing an Excel file directly into MySQL. I spent the whole night testing, no matter the import of simple and traditional will not appear garbled, very useful.
Php-excelreader, download Address: Http://sourceforge.net/projects/phpexcelreader
Description
Test environment: MySQL database is UTF8 encoded. The import Excel document is in the XLS format, tested, and the XLSX format [Exce
/zhangy/mongodb/tank/users.dat connected to: 127.0.0.1 exported 4 records
3. Export some fields from the table
1 2 3
[[emailprotected] mongodb]# mongoexport -d tank -c users --csv -f uid,name,sex -o tank/users.csv connected to: 127.0.0.1 exported 4 records
4, according to the conditions to dare to out data
V. MongoDB import, export, backup, recovery, user authorization 1: Data export, data import as a DBA (Administrator), often encountering the need to import and export data, the followin
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, one is for the library of Mongodump and Mongorestore, one is for the table in the library
2 3
[[emailprotected] mongodb]# mongoexport -d tank -c users -o /home/zhangy/mongodb/tank/users.dat connected to: 127.0.0.1 exported 4 records
3. Export some fields from the table?
1 2 3
[[emailprotected] mongodb]# mongoexport -d tank -c users --csv -f uid,name,sex -o tank/users.csv connected to: 127.0.0.1 exported 4 re
Tags: open cannot composite word Enter Workaround Method Field SupportSince the use of Microsoft visual graphical interface has been used, and MongoDB is a command-type operation, and the system with the CMD operation is not convenient, Here is a replacement of a cmd, the size of more than 100 m. Cmder Tool Download Https://github.com/cmderdev/cmder/releases The next operation is all done with the Cmder tool to perform the instruction Operation demo
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.