纸上得来终觉浅,绝知此事要躬行。

 

MongoDB 备份脚本

@echo off
@title MongoDB备份脚本
@color 2F
echo ---------- 开始执行 MongoDB 数据库备份 ----------

rem MongoDB tool directory.
set dumpDir=D:\MongoDB\bin

rem backup path.
set targetDir=F:\data

if not exist %targetDir% (md %targetDir%)

%dumpDir%\mongodump.exe -h 127.0.0.1:27017 -d Petersons      -o  %targetDir%
%dumpDir%\mongodump.exe -h 127.0.0.1:27017 -d PanGu          -o  %targetDir%
%dumpDir%\mongodump.exe -h 127.0.0.1:27017 -d test           -o  %targetDir%

if ERRORLEVEL 0 echo ---------- MongoDB 数据库备份成功 ----------

@echo on
pause

 

posted on 2014-03-21 10:36  JRoger  阅读(283)  评论(0编辑  收藏  举报

导航