码迷,mamicode.com
首页 > 数据库 > 详细

mongo数据库的导入导出

时间:2014-05-26 10:30:39      阅读:407      评论:0      收藏:0      [点我收藏+]

标签:c   http   a   int   com   数据   

http://www.iwangzheng.com/



[root@a02]$show dbs;
changhong_tv_cms 0.078GB

[root@a02]$ mongodump -d changhong_tv_cms -o
/temp/db_mongo.20140521.mongo

/workspace/db_baks$ scp -r -P 22022
root@10.xxx.xx.xx:/temp/db_mongo_changhong.20140521.mongo .

/workspace/db_baks$ mongorestore --directoryperdb
db_mongo_changhong.20140521.mongo

$ mongodump --help

options:
--help produce help message
-v [ --verbose ] be more verbose (include multiple times for more
verbosity e.g. -vvvvv)
--version print the program‘s version and exit
-h [ --host ] arg mongo host to connect to ( <set name>/s1,s2 for
sets)
--port arg server port. Can also use --host hostname:port
--ipv6 enable IPv6 support (disabled by default)
-u [ --username ] arg username
-p [ --password ] arg password
--dbpath arg directly access mongod database files in the given
path, instead of connecting to a mongod server -
needs to lock the data directory, so cannot be used
if a mongod is currently accessing the same path
--directoryperdb if dbpath specified, each db is in a separate
directory
--journal enable journaling
-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-time snapshotting
--repair try to recover a crashed database
--forceTableScan force a table scan (do not use $snapshot)

-h 导出源
-d 要导出的数据库名称
-o 数据库要导出的位置

mongo数据库的导入导出,布布扣,bubuko.com

mongo数据库的导入导出

标签:c   http   a   int   com   数据   

原文地址:http://www.cnblogs.com/iwangzheng/p/3747109.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!