One of the primary MongoDB series: MongoDB installation and recommended configuration; Primary mongodb Analysis
The first time I heard about apsaradb for MongoDB, I must have heard a lot about it before I decided to learn about it. No matter what purpose you start to embark on this learning journey, I am also happy to grow with you as a cainiao. I will not talk much about it. I will not write all kinds of introductions here, but I will leave only dry articles. If you want to see the Introduction, you can contact du Niang.
1. The first time I got in touch with new things, of course I had to go to the official website.
Official website of MongoDB: https://www.mongodb.org/
Shows the download content:
If you click to enter the download page and the download dialog box does not pop up, click the content shown in. Note: you do not need to register information.
2. Installation
Click Install the downloaded msi Installation File. It is actually a decompression process. I installed it on the D Drive. After installation
You will see a bin directory and some instructions in the installation directory.
3. Configure MongoDB
Mongodbafter the installation, you will find this strange, click the "cmd.exe mongod.exe" directory under the bindirectory to directly flash back.
The following describes some brief configurations of MongoDB:
1) create a data folder under the directory at the same level as the bin directory, and create db and log folders under the data folder to store data files and log files respectively. [ps: You can also create other folders, you can know where it is]
2) create a mongo. config file under the same directory as the bin directory as the mongodb configuration file. [Ps: Used at startup]
The mongo. config file contains the following content:
# Data file dbpath = D: \ mongodb \ data \ db # log File logpath = D: \ mongodb \ data \ log \ mongo. log # The append mode is used for error logs. After this option is configured, mongodb logs are appended to existing log files instead of creating a new file logappend = true # enable log files, journal = true by default # This option can filter out useless log information. If debugging is required, set it to falsequiet = false # port 27017 = 27017 by default
4. The simple configuration is over, and the following exciting HelloWord stage is coming soon.
Run cmd to go to the bin directory in the installation directory.
Run mongod -- config d: \ mongodb \ mongo. config.
Now you can see some information. If no error is reported, you can proceed to the next step.
Create a new command window, enter the bin directory, and execute mongo
If the configuration is correct, the following page is displayed.
5. Start MongoDB quickly
It is obviously unacceptable to go to the bin directory through CMD and execute related commands.
Advanced 1
Add the bin directory of MongoDB to the environment variables of the system.
Level 2
At this point, we found that every time we start it, we need to add some additional parameters, which is obviously not convenient. You have already
The following describes how to add a service as a windows Service (ps: Self-search ]. However, there are also advantages and disadvantages. We will always have some friends with obsessive-compulsive disorder
When to start the service, it is obviously complicated to start and close the service.
Advanced 3
Since we have added it to the environment variable and run the same command to start it every time, why not consider this startup command?
Write a shortcut.
Just do what you say.
Create a shortcut on the desktop ,.
After successful creation, click this shortcut when we want to start MongoDB. If you don't want to use it, close the shortcut window.
Is it very convenient. Haha.
The next article will briefly introduce the content of some files created by MongoDB after these operations.
For reprinting, please indicate the original article address and respect the author's Labor achievements.
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.