MongoDB install and add to Windows Service, boot with system

Source: Internet
Author: User
Tags auth

This article describes installing MongoDB in a Windows environment and adding it to a Windows service, starting with the system

First go to the official website to download the Windows installation package: Https://www.mongodb.org/downloads

In general, choose the default 64-bit (unless your host is 32-bit), after downloading, suppose we install to: d:/soft/mongodb/, after completion, enter the directory, create a new data and logs two folders, and in the logs directory to create a new mongodb.log. Then open a command prompt (CMD) and the Windows8.1 user needs to be opened as an administrator. Execute the following command:

D: && cd/soft/mongodb/bin--dbpath d:/soft/mongodb/data

This way MongoDB starts happily, opens the browser, enters: http://127.0.0.1:27017, then you will see the following prompt language:

You is trying to access MongoDB on the native driver port. For HTTP diagnostic access, add the port number

In fact it is painful to start MONGO every time through the command line, so we need to create a permanent service, which requires us to add MONGO to the Windows Local Service. Continue back to CMD, execute:

Since we have entered the D:/soft/mongodb/bin directory before, we just need to execute the following command: Mongod.exe--logpath d:/soft/mongodb/logs/mongodb.log--logappend-- DBPath d:/soft/mongodb/data--directoryperdb--servicename mongodb-install --auth
net start MongoDB

The red character--auth This parameter means that the service will turn on permission authentication, plus this parameter will not be free to open the MongoDB database on your server.

Open the Services window and you will see the results we need:

By the way, how to remove the Windows service: first stop the current MongoDB service in the service settings. Then run at the command line (the current path can be anywhere):SC Delete MongoDBThis will cause the previously installed services to be deleted.

MongoDB install and add to Windows Service, boot with system

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.