MongoDB备份恢复

参看网址:和权威指南上讲得一样,原理和示例还行

http://www.ttlsa.com/mongodb/mongodb-backup-and-recovery-_on_-ttlsa-tutorial-series-mongodb/

http://blog.51yip.com/nosql/1573.html

常用的操作

测试操作:

#备份所有数据库,在当前目录下生成dump目录,里边包含各个库名目录

mongodump  --port 30000 --authenticationDatabase test -ulidonghai  -p123456

##恢复某一个库

mongorestore --port 30000 --authenticationDatabase test -ulidonghai  -p123456  -d test  ../../dump/test/

##恢复某一个表

mongorestore --port 30000 --authenticationDatabase test -ulidonghai  -p123456 --db test --collection test ./test.bson

##备份某一个库

mongodump  --port 30000 --authenticationDatabase test -ulidonghai  -p123456  -d test -o ./

##查看备份出来的数据

bsondump --bsonFile ./test/test.bson  --pretty --outFile ./test.json

猜你喜欢

转载自blog.csdn.net/donghaixiaolongwang/article/details/79884824