mongodb庫備份

創建恢復用戶
db.createUser({user:"huifu",pwd:"123456",roles:[{role:"restore",db:"admin"}]})

創建備份用戶
db.createUser({user:"beifen",pwd:"123456",roles:[{role:"backup",db:"admin"}]})
#備份
mongodump -h 192.168.233.133:27017 -u beifen -p 123456 -d test -o /tmp/backup/

#恢復
mongorestore --host=192.168.233.133 --port=27017 -u huifu -p 123456  -d test /tmp/backup/test
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章