移除已安装服务:mongod.exe --remove --serviceName "MongoDB"
1、创建数据存储目录data与日志目录
E:\mongodb\data\
E:\mongodb\data\logs\
2、针对不同数据库文件保存在不同的目录进行安装windows服务
mongod --logpath E:\mongodb\data\logs\mongodb.log --logappend --dbpath E:\mongodb\data --directoryperdb --serviceName MongoDB --install
windows自动备份mysql批处理:
@ECHO OFF
if not exist E:\mongodb\data\dbbak\%date:~0,4%\%date:~5,2%\%date:~8,2%\ md E:\mongodb\data\dbbak\%date:~0,4%\%date:~5,2%\%date:~8,2%\
cd E:\mongodb\bin
E:
mongodump -h 127.0.0.1 -d YihaoMongo_VipMoni -o E:\mongodb\data\dbbak\%date:~0,4%\%date:~5,2%\%date:~8,2%\
mongodump -h 127.0.0.1 -d gourl -o E:\mongodb\data\dbbak\%date:~0,4%\%date:~5,2%\%date:~8,2%\
if exist E:\mongodb\data\dbbak\%date:~0,4%\%date:~5,2%\%date:~8,2%\ md E:\mongodb\data\dbbak\%date:~0,4%\%date:~5,2%\%date:~8,2%\