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
Plz try the steps in Mongo DB: 3.6 & Windows 10
mongod --remove
mongod --dbpath=C:/data/db --port 27017 --logpath C:/data/log/log.txt --service
mongod --dbpath=C:/data/db --port 27017 --logpath C:/data/log/log.txt --install
net start MongoDB
Unlike other answers this will ..
START THE SERVICE AUTOMATICALLY ON SYSTEM REBOOT / RESTART
MongoDB Install
Windows
(1) Install MongoDB
(2) Add bin to path
(3) Create c:\data\db
(4) Create c:\data\log
(5) Create c:\data\mongod.cfg with contents ..
(6) To create service that will auto start on reboot .. RUN AS ADMIN ..
(7) Start the service .. RUN AS ADMIN ..
IMPORTANT: Even if this says 'The MongoDB service was started successfully' it can fail
To double check open Control Panel > Services, ensure the status of the MongoDB service is 'Running'
If not, check your log file at C:\data\log\mongod.log for the reason for failure and fix it
(Do not start MongoDB via Control Panel > Services, use .. net start MongoDB)
(8) Finally, restart your machine with MongoDB running and it will still be running on restart
If you ever want to kill it ..
After trying for several hours, I finally did it.
Make sure that you added the
<MONGODB_PATH>\bin
directory to the system variablePATH
First I executed this command:
Then I executed this command after opening command prompt as administrator:
After that right there in the command prompt execute:
And look for MongoDB service and click start.
NOTE: Make sure to run command prompt as administrator.
If you don't do this, your log file ('D:\mongodb\log.txt' in the above example) will contain lines like these:
and if you try to start the service from a non-admin console, (i.e.
net start MongoDB
orStart-Service MongoDB
in PowerShell), you'll get a response like this:or this:
You can use the command below for running mongodb as a windows service
If you use mongodb with default parameters, you can use these values :
There's more information on this command here
http://www.mongodb.org/display/DOCS/Windows+Service
Consider using
This was the only thing that worked for me. As everything had to be an absolute path:
I also had to run it from
admin cmd