MongoDB installation becomes a Windows service

Source: Internet
Author: User
Tags install mongodb

Use the following command to install MongoDB as a Windows service. The author's MongoDB directory is D:\Program files\mongodb

Switch to D:\Program files\mongodb\bin>

Mongod--logpath "D:\Program files\mongodb\data\logs.txt"--logappend--dbpath "D:\Program files\mongodb\data"-- Directoryperdb--servicename "MongoDB"--servicedisplayname "MongoDB"--install

Enter the above command.

Creating service MongoDB.
Service creation successful.
Service can is started from the command line via ' net start ' MongoDB '.

The command line specifies the log file: D:\Program Files\mongodb\data\logs.tx, the log is exported in an append manner;

Data file directory: D:\Program files\mongodb\data, and the parameter--directoryperdb indicates that each DB will create a new directory;

Name of the Windows service: MongoDB;

Finally, the installation parameters:--install, the opposite is--remove

Start Mongodb:net start MongoDB


Stop Mongodb:net Stop MongoDB

Note: See the log file for problems

MongoDB exception in initandlisten:12596 old lock file, terminating workaround

The error message is as follows:

Exception in initandlisten:12596 old lock file, terminating

Workaround

1. Delete the. lock file in the data directory

2.mongod.exe--repair

3. Start the Mongod and you're ready.

File Source: MongoDB installed as a Windows service

MongoDB installation becomes a Windows service

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.