备份和恢复mongodb 1 make sure all process which is writing mongodb are stopped. 2 dump database from gamongodb81 sudo ./mongodump --host gamongodb91:27017 --username gaeditor --password 9aed!t0r --out /data/bondprice_backup 3 compress back
备份和恢复mongodb
1> make sure all process which is writing mongodb are stopped.
2> dump database from gamongodb81
sudo ./mongodump --host gamongodb91:27017 --username 'gaeditor' --password '9aed!t0r' --out /data/bondprice_backup
3> compress backup folder with tar, 1 hour
tar -cvf /data/bondprice_backup.tar /data/bondprice_backup
4> copy tar file in dallas from b37, 5 hours
sudo scp msdomain1
bhuang1@gamongodb81:/data/bondprice_backup.tar /data/bondprice_backup.tar
5> uncompress tar file, 0.5 hour
tar -xvf /data/bondprice_backup.tar
6> drop connections from bonddata
dbo.bondprice.drop();
dbo.idcprice.drop();
dbo.contractprice.drop();
7> restore database with backup folder, 2 hours
sudo ./mongorestore /data/bondprice_backup --host gamongodb61:27017 --username 'gaeditor' --password '9aed!t0r'