The main contents of this paper are as follows
*What is mongodb
Installation and configuration of mongodb4.0 in Windows
We will focus on some problems encountered in the installation and configuration of mongodb4.0 in windows*
What is mongodb
Mongodb features summary: distributed file storage, easy to expand, unstructured
- Mongodb is a database based on distributed file storage.
- It is a product between relational database and non relational database, which has the most abundant functions and is most like relational database.
- With the growth in data volume and throughput, mongodb can easily scale without downtime and application changes.
- Mongodb stores data in JSON like documents, and each JSON string structure in the document may be different. Mongodb uses dynamic mode, which means that you can create records, such as the type of a field or its value, without first defining the structure.
Download from official website
- After opening, click next all the time, and then click the custom option in the middle to change the storage location,Note that there are no spaces in the path
- Pay attention to untick mongodb compass, otherwise the installation process will be very long
3. Path configuration
- The directory structure after installation is as follows
- In the
dataCreate a new folder under the folder
logCreate a new file under the folder
mongo.config(new file renamed)
binIn the folder is the command of mongodb. Next is the path to the configuration database. If it is windows 10, it will bring its own power shell to enter the
binIn the directory, click ‘file’ in the upper right corner of the file explorer to open the PowerShell
Input commands in the PowerShell
.\mongod –dbpath D:\MongoDB\data\db(replace here with the path to your own DB folder)
4. Open in browser and visit in browserhttp://localhost:27017, the following page appears to indicate success.
Step 3 in the tutorial is actually operated in CMD, but mine is invalid in CMD. Only in the PowerShell can the instructions be executed correctly.
System does not come with a PowerShell, you can search the Internet about how to install
Configure windows services
- Follow the above method
binCatalog withAdministrator statusOpen the powshell,
And execute the following commands respectively:
.\mongod –dbpath D:\MongoDB\data\db
.\mongod –logpath D:\MongoDB\log\mongo.log
.\mongod –serviceName MongoDB
The database path is D: mongodbdatadb and the log path is D: mongodbdatadb MongoDBlogmongo.log , and the service name is mongodb.
net start MongoDB, indicating that the service was started successfully,
net stop MongoDBPrompt the service to stop. Indicates that the windows service is configured successfully.