MongoDB增量备份
时间:2021-07-01 10:21:17
帮助过:20人阅读
echo wscript.
echo DateDiff(
"s",
"01/01/1970 00:00:00", Date())>
sjc.vbs
for /f %%i
in (
‘cscript sjc.vbs /nologo‘)
do set startDate=%%
i
set /a
"startDate=%startDate%-28800"
echo %startDate%
set /a
"endDate=%startDate%+86400"
echo %endDate%
set "Ymd=%date:~0,4%%date:~5,2%%date:~8,2%0%time:~1,1%%time:~3,2%%time:~6,2%"
md E:\mongodbBackup\backup_%Ymd%
"C:\Program Files\MongoDB\Server\4.0\bin\mongodump.exe" --host=localhost --port=
27017 --authenticationDatabase=admin -d local -c oplog.rs --query
"{"ts
":{$gte:Timestamp(%startDate%, 1),$lt:Timestamp(%endDate%, 1)},ns:/^spark-demo/}" -o E:\mongodbBackup\backup_%Ymd%
@echo on
rem ******MongoDB backup end********
恢复脚本
"C:\Program Files\MongoDB\Server\4.0\bin\mongorestore.exe" --host=127.0.0.1 --port=27017 --oplogReplay --authenticationDatabase=admin E:\mongodbBackup\backup_20190917072132
MongoDB增量备份
标签:操作记录 数据库 dmi sys -o The rest ogre bsp