Resolving a MongoDB Device Mongod command is not an internal or external command

Source: Internet
Author: User
Tags create mongodb

1: Installation

Go to MongoDB's official website http://www.mongodb.org/downloads Download 32bit Package

The following files will appear after decompression

In the installation of the disk C: Build the MongoDB directory, copy the bin directory to this directory, which is equivalent to the installation of MongoDB related commands.

In order to start MongoDB convenient, add the Mongod.exe path to environment variables, computer----Advanced system settings--environment variables, add path in path:

This allows the Mongod command to be used anywhere in the command line.

2: Set up data file and start up

Then create a new MongoDB directory on the D drive to place the data file and create the Data,log directory under the MongoDB directory, and build the Mongodb.log file in the log directory.

Start MongoDB Service: Open command Line Input command

>mongod--dbpath "D://mongodb//data"--logpath "D://mongodb//log//mongodb.log"--logappend

The following condition occurs when the 27017port boot succeeds.

Resolution: Mongod--dbpath command is to create a database file storage location, the start of MongoDB service needs to determine the location of the database files, or the system will not be actively created, startup will not be successful.

--logpath indicates that the log file is stored in a path--logappend means that the log file is written in an appended way

You will see this message on your browser:

The default port of 27017, can also be changed by the--port command port, such as: Mongod--port 9888 "D:\\mongodb\\data"

3: Start by service mode

Each time you start the service you need to enter the above command, for convenience, to write the startup database as a window service.

>mongod--logpath "D://mongodb//log//mongodb.log"--logappend--dbpath "D://mongodb//data"--directoryperdb-- ServiceName MongoDB--install

This only needs to be in the command line to enter the net start MongoDB can start the service, but do not know why. I set it up like this. Can't find MongoDB in "service"?

When you start cmd as an administrator instead, enter the command:

SC create MongoDB binpath= "C:\mongodb\bin\mongod.exe--service--dbpath D:\mongodb\data--logpath=d:\mongodb\log\ Mongodb.log--logappend--directoryperdb "

Delete Service directive: Mongod.exe--remove--servicename "MongoDB"

Note to start the command line by using administrator mode

So there's MongoDB service in the service.

In the process of tossing MongoDB service, found that the database service can not start, the box error: "Service does not respond or control function", tried a lot of other methods are no solution

Last Run SC delete mongodb Force Delete MongoDB Repair

Copyright notice: This article Deng Xiaoping Fruit original article, reprint please specify: http://blog.csdn.net/i10630226

Resolving a MongoDB Device Mongod command is not an internal or external command

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.