MongoDB Registered Windows service startup

Source: Internet
Author: User

Download MongoDB Install to: E:\Work_App\MongoDB this directory

Installation: E:\Work_App\MongoDB (installed in a dedicated directory)

Configuration:

1. Create a new Data folder under E:\Work_App\MongoDB\

2. Create a new db and log folder under E:\Work_App\MongoDB\Data

3. Create a new MongoDB.log file under E:\Work_App\MongoDB\data\log

Start MongoDB:

Enter the E:\Work_App\MongoDB\bin,

Input: Mongod-dbpath "E:\Work_App\MongoDB\Data\db"

Role: Create a MongoDB database file into the E:\WORK_APP\MONGODB\DATA\DB directory

Attention:

1, attention is Mongod.exe

2. This interface will stop at 2015-03-26t15:19:17.135+0800 I NETWORK [Initandlisten] waiting for connections on port 27017 (the database is now started)

First knowledge of MongoDB:

New Open [ Note is new ] after a cmd window, then run the Mongo.exe program (note that there is no d), at this time the previous window is displayed: 2015-03-26t15:31:10.148+0800 I NETWORK [ Initandlisten] Connection accepted from 127.0.0.1:60408 #1 (1 connection now OPEN)

Now it's time to use the MongoDB database.

>help (View related information)

>db.foo.insert ({a:1}) (Insert a,1 field value to Foo table, Foo table as default table)

>db.foo.find () (View foo table data)

Start MongoDB as a Windows service
  1. Sign up for MongoDB Service

    Entry: E:\Work_App\MongoDB\bin

    Input: Mongod-dbpath "E:\Work_App\MongoDB\Data\db"-logpath "E:\Work_App\MongoDB\Data\log\MongoDB.log"-install- ServiceName "MongoDB" (this must be run as Administrator)

    At this point the service is installed successfully, running

    >net Start MongoDB (open service)

    >net Stop MongoDB (shutdown service)

  2. 2

    Delete MongoDB Service

    Mongod-dbpath "E:\Work_App\MongoDB\Data\db"-logpath "E:\Work_App\MongoDB\Data\log\MongoDB.log"-remove- ServiceName "MongoDB"

    --Registration with permission authentication Mode service
    Mongod-dbpath "D:\Program files\mongodb\db"-logpath "D:\Program files\mongodb\log\mongodb.log"-auth-install- ServiceName "MongoDB"

    At this point the service is installed successfully, running
    >net Start MongoDB (open service)
    >net Stop MongoDB (shutdown service)

MongoDB Registered Windows service startup

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.