Build the installation and configuration of anti-vibration short video APP-MongoDB from scratch, the visual management tool of MongoDB, and SpringBoot integrates MongoDB

The project is continuously updated:

Imitation vibrato short video APP column

Table of contents

MongoDB installation and configuration

Visual management tool for MongoDB

SpringBoot integrates MonfoDB


MongoDB installation and configuration

Open our official website, there is a downloaded version on the right 

 It is already downloaded in our linux

For this package we perform a decompression

 After the release is complete, there is an additional folder, we will transfer this folder

 Here are some of the contents of the file we just released

 Then configure our environment variables

 

 Here we have completed the configuration of environment variables

 Do a refresh after saving

Use the mongo command to output the jdk version number

back to catalog 

 Create a db directory

used to store logs

create log file

 Go back to the root directory of mongodb and create a new core log file

 Add some configuration content

 

 :wp save, load our config file: 

 install, reboot

 

 

Here it starts successfully.

Detection process:

Visual management tool for MongoDB

We view through navicat

 Double click:

 Select and create a new database:

New collection:

This is equivalent to a table in the database 

 

If we want to deploy on the cloud server, mongodb does not have permission at this time, we need to increase the permission

Open the command line and modify the command permissions of mongodb

keep.

close process

 Restart:

 After the startup is successful, add a new user and enter on the command line

Switch to mongodb default database 

 Increase root privileges

 Then verify:

 We close the connection in navicat and re-edit the connection:

 Currently our mongodb] is logged in as the root user.

SpringBoot integrates MonfoDB

We open the pom file in the model to introduce dependencies:

 first step:

 Then go to the configuration file yml to configure: 

 Added after @ is the local ip address

  Let's create a new database in navicat:

 The configuration is now complete

In our startup class we need to add a scanner:

 Now complete the basic configuration, and then install it.

Run it again:

mongodb is already connected here 

Guess you like

Origin blog.csdn.net/m0_64005381/article/details/127710062