Troubleshooting the installation of MongoDB 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

Under the installed disk C: Create a MongoDB folder, copy the bin folder to this directory, which is equivalent to the installation of MongoDB related commands.

In order to start MongoDB convenient, add Mongod.exe path to environment variable, computer----Advanced system settings--environment variable, 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 folder on the D drive to place the data file and create the Data,log folder under the MongoDB folder, and create the Mongodb.log file under the log folder.

Start MongoDB Service: Open command Line Input command

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

The following behavior occurs when the 27017 port starts successfully.

Resolution: Mongod--dbpath command is to create a database file storage location, the start of the MongoDB service needs to determine the location of the database files, or the system will not be automatically 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, you can also modify the port through the--port command, 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, you can 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 enter the net start MongoDB at the command line can start the service, but do not know what reason, I set this, in the "service", also can't find MongoDB?

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 execute SC delete mongodb force Delete MongoDB Service

Troubleshooting the installation of MongoDB 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.