MongoDB 备份

rm -rf /home/mongobak
mongodump --host 127.0.0.1 --port 27017 --db dbname --collection collname --out /home/mongobak
tar -cvzf /home/mongobak/dbname_mongo_20140714.tar.gz /home/mongobak/dbname/*

mongorestore --host 127.0.0.1 --port 27017 --db dbname /home/mongobak/dbname