Installing MongoDB in the Windows environment

Source: Internet
Author: User

MongoDB https://www.mongodb.org/

Download the Windows version of MongoDB on the MongoDB website (for example, extract to D disk)

Create the Data folder under the extracted MongoDB folder and create a log and DB two folders under the Data folder

Create an empty Mongodb.log file under the log folder

Then create the Mongo.config file under the MongoDB folder

Add the following two lines of content to the Mongo.config file

Dbpath=d:\mongodb\data MongoDB Data folder
Logpath=d:\mongodb\data\log\mongodb.log MongoDB Log Record file

Then add MongoDB to the window service

@echo off
@echo---------------------Welcome to use Mongod Auto Run Tools--------------
@echo. & Pause

@echo---------------------is shutting down the redundancy process, SAO, etc.----------------------------

Taskkill/im mongod.exe/f

@echo--------------------The redundancy process is complete, the server is starting, Sao etc-------------


Start D:\mongodb\bin\mongod.exe--install--logpath=d:\mongodb\data\log\mongodb.log--dbpath=d:\mongodb\data


@echo. & Pause
Copy the above content to a bat file, and then run the bat file to join the MongoDB service in Windows

The MongoDB service is then started in the service, and after the installation is successful, enter http://localhost:27017/as indicated by the installation success.

Uninstalling the MongoDB service

@echo off
@echo---------------------Welcome to use Mongod Remove tools--------------
@echo. & Pause
@echo---------------------is shutting down the redundancy process, SAO, etc.----------------------------

Taskkill/im mongod.exe/f

@echo--------------------The redundancy process is complete, the server is starting, Sao etc-------------

Start D:\mongodb\bin\mongod.exe--remove--servicename "MongoDB"--logpath=d:\mongodb\data\log\mongodb.log--dbpath= D:\mongodb\data

@echo. & Pause

Copy the above content and save it to a bat file to run the file to uninstall the MongoDB service

net start "MongoDB" Start MongoDB service

net stop "MongoDB" Stop MongoDB Service

Installing MongoDB in the Windows environment

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.