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
The simplest way is,
C:\data\db
C:\data\db\log.txt
Open command prompt as "Run as Administrator" and make sure the mogodb bin directory path is correct and write
Start mongodb service:
Run "cmd.exe" as administrator and then run "sc.exe" to add a new Windows service.
for example:
Working on Mongo DB: 3.6
(1) Install MongoDB
(2) Add bin to environment path variable
(3) Create
c:\data\db
(4) Create
c:\data\mongod.log
(5) Run below Command on
bin
folder(6) To start mongo db as service
(7) Finally run
mongo
in command line to check mongo shell is open or not.I tried all answers and then did it the way https://docs.mongodb.org/manual/tutorial/install-mongodb-on-windows/#configure-a-windows-service-for-mongodb-community-edition describes it.
Use a config file...
"C:\mongodb\bin\mongod.exe" --config "C:\mongodb\mongod.cfg" --install
For version 2.4.3 (current version as of posting date), create a config file and then execute the following:
C:\MongoDB\bin\mongod.exe --config C:\MongoDB\mongod.cfg --service
Currently (up to version 2.4.4), if any path (dbpath/logpath/config) contains spaces, then the service won't start, and show the error: "The service is not responding to the control function".