How to setup MongoDB so it can run as Windows service?
相关问题
- MongoDB can not create unique sparse index (duplic
- Spring Data MongoDB - lazy access to some fields
- Golang mongodb aggregation
- Why does a windows service, hosting an NserviceBus
- How to convert from Timestamp to Mongo ObjectID
相关文章
- mongodb有没有什么办法禁止读取数据的时候进行缓存
- mongodb-aggregate聚合查询分组后如何获得多字段
- mongodb error: how do I make sure that your journa
- How to track MongoDB requests from a console appli
- XCopy or MOVE do not work when a WCF Service runs
- MongoError: cannot infer query fields to set, path
- Pymongo $in Query Not Working
- Problem installing windows service
This is what worked for me:
escaping the binPath was failing for me as described in the Mongo documentation
Failed:
I think if you run it with the
--install
command line switch, it installs it as a Windows Service.It might be worth reading this thread first though. There seems to be some problems with relative/absolute paths when the relevant registry key gets written.
Working on MongoDB 3.4 [Windows]
Create a file in C:/mongodb/mongodb.config using this configuration:
To install MongoDb as a service, run this command in powershell with admin power
mongod --config="C:\mongodb\mongodb.config" --install --service
Open Services.msc and look for MongoDb, then start it
I found that you should pass : dbpath , config and logfile to mongod with the install flag
example :
note : I have mongod path in my path variable .
You can control the service with :
If you install MongoDB 2.6.1 or newer using the MSI download from an Administrator Command Prompt, a service definition should automatically be created for you.
The MongoDB documentation also has a tutorial to help you Manually Create a Windows Service definition if needed.
Reference