|
On windows mongod.exe has native support for installing and running as a windows service. Service Related CommandsThe service related commands are: mongod --install mongod --service mongod --remove mongod --reinstall You may also pass the following options to --install and --reinstall --serviceName {arg}
--serviceUser {arg}
--servicePassword {arg}
The --install and --remove options install and remove the mongo daemon as a windows service respectively. The --service option starts the service. --reinstall will attempt to remove the service, and then install it. If the service is not already installed, --reinstall will still work. Both --remove and --reinstall will stop the service if it is currently running. To change the name of the service use --serviceName. To make mongo execute as a local or domain user, as opposed to the Local System account, use --serviceUser and --servicePassword. Whatever other arguments you pass to mongod.exe on the command line alongside --install are the arguments that the service is configured to execute mongod.exe with. Take for example the following command line (these arguments are not required to run mongod as a service): mongod --logpath d:\mongo\logs\logfilename.log --logappend --dbpath d:\mongo\data --directoryperdb --install This will cause a service to be created with service name "MongoDB" and display name "Mongo DB" that will execute the following command: mongod --logpath d:\mongo\logs\logfilename.log --logappend --dbpath d:\mongo\data --directoryperdb --service If your file specification includes spaces, put quotes around the file specification. mongod --logpath "d:\my mongo\logs\my log file name.log" --logappend --dbpath "d:\my mongo\data" --directoryperdb --install Installing on Windows 7If installing on Windows 7, you need to make sure that you're running as an administrator. To do this, open the start menu, and in the search box enter "cmd.exe." When the executable appears, right-click on it and choose "Run as administrator." At this point, you can install MongoDB as a service with the --install option as described above. mongos as a Windows serviceFor the moment (at least through 1.8.x), mongos does not yet directly support being installed as a Windows service. However, using the Windows Resource Kit available here, you can configure a Windows host to start mongos at system startup. (Tested on a Windows 7 system, with MongoDB 1.8.1):
|

PLEASE POST QUESTIONS IN THE USER GROUPS FORUM. Post non-question comments and helpful hints here.
blog comments powered by Disqus