Registering Windows services to enable MongoDB to start automatically
1. Run cmd with system administrator
C:\users\admin> D:
C:\users\admin> CD "MongoDB installation directory"
D:\Program files\mongodb\server\3.0\bin> sc.exe Create MongoDB binpath= "\" D:\Program Files\mongodb\server\3.0\bin \mongod.exe\ "--service--httpinterface--logpath \" D:\Program files\mongodb\logs\mongodb.log\ "--logappend--dbpath \ "D:\Program files\mongodb\data\" "Displayname=" MongoDB "start=" Auto "
2, recommend the use of configuration files to install services
(http://docs.mongodb.org/manual/reference/configuration-options/#core-options)
D:\Program files\mongodb\server\3.0\bin>
Sc.exe create MongoDB binpath= "\" D:\Program files\mongodb\server\3.0\bin\mongod.exe\ "--service--config \" D:\Program Files\mongodb\server\3.0\bin\mongodb.conf\ "" Displayname= "MongoDB" start= "Auto"
Configuration:
#数据库存储配置
Storage
#数据库文件保存的路径
DbPath: "D:\\Program files\\mongodb\\data"
#系统日志配置
Systemlog:
Destination:file
#日志路径
Path: "D:\\Program Files\\mongodb\\logs\\mongodb.log"
#日志文件自动累加, rather than covering
Logappend:true
#
Net
#绑定的ip, if there are multiple IPs using "," delimited before and after use without spaces
bindip:127.0.0.1
#代表端口号, the default is 27017 if you do not specify
port:27017
#
http
#是否启动监控网页
Enabled:true
# Open a simple rest API
Restinterfaceenabled:true
Note: The configuration is case-sensitive, and the child configuration needs to be indented 3 characters backwards
3. Remark: Delete Service SC Delete MongoDB
Installation monitoring (Windows Server R2)
MongoDB 3 + Windows 7 X64 installation and configuration