Completely solve the installation of mongodb under Linux

Time:2022-1-1

The system used is centos7 and the latest version of mongodb is installed
Mongodb official website:https://www.mongodb.com/

1. Download the latest stable version

wget http://downloads.mongodb.org/linux/mongodb-linux-x86_64-amazon-latest.tgz

2. Unzip the downloaded file

tar -zxvf mongodb-linux-x86_64-amazon-latest.tgz

3. There is no need to compile. The downloaded file itself is the compiled binary executable file

4. Enter the folder

cd mongodb-linux-x86_64-amazon-3.5.9-162-gedc858c

5. Put the directory into the specified directory

mv ~/mongodb-linux-x86_64-amazon-3.5.9-162-gedc858c /usr/local/mongodb

6. Start mongodb service

cd /usr/local/mongodb/

./bin/mongod –dbpath /path/to/database –logpath /path/to/log –folk –port 27017
This statement means to start the Mongo server, configure the data storage location — dbpath and log storage location — logpaht, and run — folk in the background

mkdir -p /home/m17 /home/mlog

Create two new folders to store Mongo’s data and logs

./bin/mongod --dbpath /home/m17/ --logpath /home/mlog/m17.log --fork --port 27017

After the process is started, you can use

ps aux | grep mongod

Check whether the process started successfully

After that, use

./bin/mongo

Start Mongo client

Recommended Today

Could not get a resource from the pool when the springboot project starts redis; nested exception is io. lettuce. core.

resolvent: Find your redis installation path: Start redis server Exe After successful startup: Restart project resolution. ———————————————————————->Here’s the point:<——————————————————————- Here, if you close the redis command window, the project console will report an error. If you restart the project, the same error will be reported at the beginning, The reason is: It is inconvenient to […]