-
-
Save mgmanalili/53e3abc3190f28b85e05b8a730c2cc74 to your computer and use it in GitHub Desktop.
Create a Windows service for MongoDB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create directories | |
mkdir c:\mongo\db | |
mkdir c:\mongo\config | |
mkdir c:\mongo\log | |
# Create a configuration file | |
# in c:\mongo\config\ as | |
# 'mongod.cfg' and paste: | |
#|==================================| | |
#| logpath=C:\mongo\log\mongodb.log | | |
#| logappend=true | | |
#| dbpath=C:\mongo\db | | |
#|==================================| | |
# Create a Windows Service: | |
sc.exe create MongoDB binPath= "\"C:\Program Files\MongoDB\Server\3.0\bin\mongod.exe\" --service --config=\"C:\mongo\config\mongod.cfg\"" | |
layName= "MongoDB" start= "auto" | |
# It should prompt: '[SC] CreateService SUCCESS' | |
# If so, then start the service: | |
net start MongoDB | |
# To stop serivce: | |
net stop MongoDB | |
# To delete service: | |
sc.exe delete MongoDB | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment