Install Windows Services in MongoDB

Source: Internet
Author: User

 

It is inconvenient to run mongod -- dbpath D:/MongoDB/Data command line to start MongoDB every time. Just like MySQL without installation, I want to use it as a Windows service, this makes it much easier.

 

D: \ MongoDB \ bin> mongod -- logpath D: \ MongoDB \ logs \ MongoDB. log -- logappend -- dbpath D: \ MongoDB \ data -- directoryperdb -- servicename MongoDB -- install
All output going to: D: \ MongoDB \ logs \ MongoDB. Log
Creating service MongoDB.
Service creation successful.
Service can be started from the command line via 'net start "MongoDB "'.

 

Note: This command will be run in the bin directory of MongoDB. At the beginning, I will run it directly under D: \. The Executable Directory of the result service is ["D: \ mongod "-- logpath" D: \ MongoDB \ logs \ MongoDB. log "-- logappend -- dbpath" D: \ MongoDB \ data "-- directoryperdb -- Service] is definitely incorrect.

 

The command line specifies the log file D: \ MongoDB \ logs \ MongoDB. log, which is output in append mode;

 

Data File directory: D: \ MongoDB \ data. The parameter -- directoryperdb indicates that a new directory is created for each database;

 

Windows Service name: MongoDB;

 

The above three parameters can be set based on your own situation.

 

The last installation parameter is -- install, which is opposite to -- remove.

 

Start MongoDB: Net start MongoDB

Stop MongoDB: net stop MongoDB

 

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.