Create a Windows service for MongoDB

Source: Internet
Author: User

One: Selection, according to the machine's operating system type to select the appropriate version, use the following command line to query the machine's operating system version

WMIC OS get Osarchitecture

Two: Download and install

Attached download link

Click Install package, I am here to install the file (E:\MongoDB)

After the installation, the following file appears under this folder,

This time, create a new data folder to hold all of MongoDB, create a new log folder to hold the log file

Three: Start the MongoDB database, execute the following command in the Command Line window, and you will see the following message after the execution is completed.

E:\mongodb\bin\mongod.exe--dbpath E:\mongodb\data

You can find that the process number is 14288 and the listening port is 27017 by prompting the message.

Enter http://localhost:27017/in the browser

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

Thus, the MongoDB database service has successfully started

Four: Connect and test Insert data

Double-click to open the Mongo.exe client program in the installation directory bin directory and connect to the test database by default after opening.

CRUD Operations Testing

More and more full crud operations

The long-winded focus finally came ...

Create a Windows service for MongoDB

    1. Configuration log file path
    2. Configure the database path
    3. Installing the Window Service

Installation results:

    1. Start mongodb Service (net start mongodb)
    2. Stop the mongodb Service (net stop MongoDB)
    3. Delete MongoDB service (SC. EXE delete MongoDB)

Here are the commands that are used by the installation service:

echo logpath=e:\mongodb\log\mongod.log> E:\MongoDB\mongod.cfgecho dbpath=e:\mongodb\data>> E:\MongoDB\ Mongod.cfge:\mongodb\bin\mongod.exe--config E:\MongoDB\mongod.cfg--install

Create a Windows service for 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.