In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article introduces how to use yum to install mongodb in centos, the content is very detailed, interested friends can refer to, hope to be helpful to you.
1. Configure yum
Create a yum warehouse file repo
Vi / etc/yum.repos.d/mongodb-org-3.2.repo
The repo file is as follows:
[mongodb]
Name=MongoDB Repository
Baseurl= http://downloads-distro.mongodb.org/repo/redhat/os/x86_64/
Gpgcheck=0
Enabled=1
two。 Install the MongoDB package and related tools
Install all mongodb components:
Yum install-y mongodb-org
You can also install specified mongodb components:
Yum install-y mongodb-org-3.2.5 mongodb-org-server-3.2.5 mongodb-org-shell-3.2.5 mongodb-org-mongos-3.2.5 mongodb-org-tools-3.2.5
After the installation is complete, to prevent accidental upgrades, you can add the following configuration to / etc/yum.conf to prevent accidental upgrades:
Exclude=mongodb-org,mongodb-org-server,mongodb-org-shell,mongodb-org-mongos,mongodb-org-tools3. Configure SELinux
There are two ways to check the SELinux status as follows:
Command 1:
/ usr/sbin/sestatus-v
Command 2:
Getenforce
There are two ways to turn off SELinux:
1. Temporary shutdown (no need to restart the machine):
Command:
Setenforce 0
The above command sets SELinux to permissive mode
Setenforce 1 sets SELinux to enforcing mode
two。 Restarting the machine is required to modify the configuration file:
Modify / etc/selinux/config file
Change SELINUX=enforcing to SELINUX=disabled or permissive
Just restart the machine.
4. Modify data storage location
By default, mongodb prevents data files from being stored in / var/lib/mongo and log files in / var/log/mongodb. Modify the systemLog.path and storage.dbPath add information in the configuration file / etc/mongd.conf.
5. Start mongodb
Start the mongo service:
Systemctl start mongod
Or
Service mongod start
Check the / var/log/mongdb/mongd.log file to see if there is a log on the following line. If so, it means that mongo started successfully.
[initandlisten] waiting for connections on port
The port number is configured in / etc/mongd.conf and defaults to 27017.
Configure boot up:
Systemctl enable mongod
Or
Chkconfig mongod on6. Stop restarting mongodb
Stop the mongodb service:
Systemctl stop mongod
Or
Service mongod stop
Restart the mongodb service:
Systemctl restart mongod
Or
Service mongod restart7. Uninstall mongodb
Stop the mongodb service:
Systemctl stop mongod
Or
Service mongod stop
Remove the packages related to the previously installed mongodb:
Yum erase $(rpm-qa | grep mongodb-org)
Delete the data folder:
Sudo rm-r / var/log/mongodbsudo rm-r / var/lib/mongodb on how to use yum in centos to install mongodb is shared here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.