In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
* MongoDB backup
The backup specified library # operates under linux, not in the database.
Mongodump-h ip-d dbname-o dir / /-h is followed by the server ip,-d followed by the database name. If you do not add it, all libraries will be backed up. After-o, specify where to backup. It is a directory such as: / tmp/mogodbbackup.
Back up all libraries
Mongodump-h ip-o dir # local backup, no need for-h
Back up the specified collection
Mongodump-d mydb-c testc-o / tmp/testc / /-c specifies the name of the collection
Export the collection to json file # text format, you can view the data directly.
Mongoexport-d mydb-c testc-o / tmp/testc.json / /-o is followed by a file name.
* MongoDB recovery
Restore all libraries
Mongorestore-- drop dir/ where dir is the directory name of the backup of all libraries, where-- drop is optional, which means that the previous data is deleted before recovery. It is not recommended.
Restore the specified library
Mongorestore-d mydb dir/-d follows the name of the library to be restored. Dir is the directory where the library was backed up.
Restore a collection
Mongorestore-d mydb-c testc dir/mydb/testc.bson / /-c is followed by the name of the collection to be restored. Dir is the path where the file was generated when backing up the mydb library. Here is the path of a bson file.
Import collection
Mongoimport-d mydb-c testc-- file / tmp/testc.json
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.