mongodb备份还原脚本
时间:2021-07-01 10:21:17
帮助过:2人阅读
set time_dir=%date:~
0,
4%-%date:~
5,
2%-%date:~
8,
2%
set bak_dir=mongo_na_world_svn2win_%time_dir%
set mongo_dir=E:\MongoDb\mongodb-win32-i386-
2.2.
3
set fromdb=
db_eragon_game_na_world
%mongo_dir%\bin\mongodump.exe -h
192.168.
102.237 -d %fromdb% -o %bak_dir%
mkdir tmp_dir
xcopy %bak_dir%\%fromdb%\cf_*
tmp_dir
%mongo_dir%\bin\mongorestore.exe -h
192.168.
102.237 -d db_eragon_game_na_world_w0 --drop --
directoryperdb tmp_dir
%mongo_dir%\bin\mongorestore.exe -h
192.168.
102.237 -d db_eragon_game_na_world_w1 --drop --
directoryperdb tmp_dir
rd /s/
q tmp_dir
rd /s/q %bak_dir%
pause
备份
echo off
set time_dir=%date:~0,4%-%date:~5,2%-%date:~8,2%
set bak_dir=temp_mongo_na_world_win2dev_%time_dir%
set mongo_dir=E:\MongoDb\mongodb-win32-i386-2.2.3
set fromdb=db_eragon_game_na_world_w0
%mongo_dir%\bin\mongodump.exe -h 192.168.102.237 -d %fromdb% -o %bak_dir%
mkdir mongo_na_world_win2dev_dir_%time_dir%
xcopy %bak_dir%\%fromdb%\cf_* mongo_na_world_win2dev_dir_%time_dir%
rd /s/q %bak_dir%
pause
mongodb备份还原脚本
标签: