Tutorial on installing mongoDB database in yum under centos on a single node, centosmongodb
MongoDB deployment uses replica set + sharding to achieve high load. However, in actual testing, sometimes you only need to install a single mongodb for testing.
Below is a single mongoDB deployed under centos7.
1. Configure the package management system (I have installed the latest version 3.4)
sudo yum install -y mongodb-org
Enter the following configuration in the file:
[mongodb-org-3.4]name=MongoDB Repositorybaseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.4/x86_64/gpgcheck=1enabled=1gpgkey=https://www.mongodb.org/static/pgp/server-3.4.asc
ThenWq!Write and exit
2. Download and install mongodb3.4 from yum
sudo yum install -y mongodb-org
Then wait for the installation package to be downloaded and installed
Then go to the mongo configuration file.
Vim/etc/mongod. conf
Modify the bindIp in net: 0.0.0.0 (you can Baidu for the reason)
3. Start
sudo service mongod start
4. view the mongodb process.
ps -ef | grep mongodb
If the following information is displayed, mongo is up. Use the default port 27017 (Changeable)
5. Test the connection
Enter mongo -- port 27017 in any location in linux
The connection is successful!
Note: The old version and new version of mongo are different. We recommend that you use the latest mongo version.