Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Tutorial illustration of installing and configuring mongodb under window

2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

1. Download the mongodb installation package

Https://www.mongodb.org/dl/win32/x86_64-2008plus-ssl?_ga=2.233271640.711265466.1519368764-1223643675.1519368764, here are all the historical versions.

First of all, I downloaded the latest version 3.6.3 at this time, how to install is an error, flickback, looking for various ways can not be solved, and finally the installation of the lower version was successful. The version I downloaded was 3.4.0.

Extract and install mongodb. I installed it in the d:/MongoDB directory.

two。 Create the necessary folder

Create data under the d:/MongoDB folder, and then create db and log folders under the d:/MongoDB/data folder

First configure the directory of the data, for example, I want to store it in D:\ mongodb\ data\ db. Run cmd.exe to enter the dos command interface, then go to the cd D:\ mongodb\ bin directory, and run the mongod.exe command, as shown in the figure:

Configure the log path. For example, if I want to store it in the directory D:\ mongodb\ data\ log, run cmd.exe to enter the dos command interface, then go to the cd D:\ mongodb\ bin directory, and run the mongod.exe command mongod.exe-- logpath=D:\ mongodb\ data\ log\ mongodb.log, as shown in the figure:

3. Whether the test runs properly or not

Run cmd.exe to enter the dos command interface, then go to the cd D:\ mongodb\ bin directory, run the mongo command, and test the connection, as shown in the figure:

An error occurred

Note: without starting the server, we need to configure the MongoDB server ourselves. Under the D:\ mongodb directory, we create a mongodb.config configuration file with two properties, logpath and dbpath, and set the values respectively, which is the path we configured just now, as shown in the figure:

Mongod.exe-- config d:\ mongodb\ mongodb.config to start the MongoDB server, and the-- config option indicates that the server is configured with the information from the d:\ mongodb\ mongodb.config configuration file at startup. As shown in the figure:

Do not close the dos command interface yet. The MongoDB server is running. I will open a new dos command interface. Go to the cd D:\ mongodb\ bin directory first, and then run the mongo command to test the link, as shown in the figure:

This indicates that the configuration is successful at this time.

4. Add MongoDB to window service

When we shut down the dos command interface running the MongoDB server, so we can't link to MongoDB, we need to add it to Windows Service like mySql, and then start and shut down the service on the command line, which makes it easier for us to operate and manage the service.

Next we need to transfer MongoDB to Windows Service, and the command used is-- install sets the installation of MongoDB to server to Windows Service

The first step: execute-install, start cmd with the administrator, enter the dos command interface, go to the cd D:\ mongodb\ bin directory, and execute

D:\ mongodb\ bin > mongod.exe-dbpath=d:\ mongodb\ data\ db-logpath=d:\ mongodb\ data\ log\ log.txt-install-serviceName "MongoDB" as shown in the figure:

Step 2: start / shut down the MongoDB service

Netstart mongodb starts the MongoDB service

Net stop mongodb starts MongoDB service

5. At this point we open the mongo.exe

When the browser opens http://127.0.0.1:27017, you can see the following interface

Summary

The above is the tutorial diagram of installing and configuring mongodb under window introduced by the editor. I hope it will be helpful to you. If you have any questions, please leave me a message and the editor will reply you in time. Thank you very much for your support to the website!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report