To start MongoDB as a Windows service item

Source: Internet
Author: User
Tags mongodb

Using MongoDB under Windows, every time you use it to restart, it's very cumbersome, so how do you start it as a Windows service item? As a system service item is started, it can be used directly after booting.

    1. Create a new folder under the C drive, C:\Data
    2. Create a new 2 folder under the Data folder, which you can use to store the information and logs. namely C:\data\db and C:\data\log.
    3. Copy the path of the Mongod.exe, such as: "C:\Program files\mongodb\server\3.6\bin\mongod.exe", note here, because program Files have spaces in the middle, you must use quotation marks.
    4. Create a bat file under C:\Data, write: "C:\Program files\mongodb\server\3.6\bin\mongod.exe"--logpath "C:\data\log\mongodb.log" "- -dbpath "C:\data\db"--install--journal
    5. Run the above script with administrator privileges, you can see the MongoDB Service item in Task Manager, and the service item is in a stopped state. :
    6. In the Administrator Command Line window, enter net start MongoDB, start the service item (you can also right-click on the MongoDB item in Task Manager and start the service manually):

To start MongoDB as a Windows service item

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.