In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article introduces the knowledge of "how to install MongoDB in Centos7". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
MongoDB is a NoSQL database based on distributed file storage.
Packages package description
The MongoDB official source contains the following dependency packages:
Mongodb-org: MongoDB meta-package, which automatically installs the following four component packages during installation:
1.mongodb-org-server: contains the MongoDB daemon and related configuration and initialization scripts.
2.mongodb-org-mongos: a daemon that contains mongos.
3.mongodb-org-shell: contains mongo shell.
4.mongodb-org-tools: tools containing MongoDB: mongoimport, bsondump, mongodump, mongoexport, mongofiles, mongooplog, mongoperf, mongorestore, mongostat, and mongotop.
Officially download https://www.mongodb.com/download-center/community
Download mongodb-linux-x86_64-rhel70-*.tgz locally and upload it to the Linux server
For example, / usr/local/soft/mongoDB
Unzip:
Tar-zxvf mongodb-linux-*-4.2.0.tgz
After decompression, it is shown below.
Create installation file path
Eg:/usr/localcd / usr/localmkdir mongodb4.2
Then move the files under mongodb-linux-x86_64-* to the mongodb4.2 folder
Mv mongodb-linux-x86_64-rhel70-4.2.0Compact * / usr/local/mongodb4.2/
Create a folder data
Mkdir data
Create a logs file under the folder under / usr/local/mongodb4.2
Touch logs
Go to the / usr/local/mongodb4.2/bin directory and start the mongodb service
. / mongod-dbpath=/usr/local/mongodb4.2/data-logpath=/usr/local/mongodb4.2/logs-logappend-port=27017-fork
Start the client and go to the / usr/local/mongodb4.2/bin directory
. / mongo
Configure environment variables
Vi / etc/profile
Add export PATH=/usr/local/mongodb4.2/bin:$PATH on the last line-/ usr/local/mongodb4.2 is the installation path
Add a mongo service to a systemctl service
Vi / usr/lib/systemd/system/mongod.service
Write the following text
[Unit] Description=mongodbAfter=network.target remote-fs.target nss-lookup.target [Service] Type=forking ExecStart=/usr/local/mongodb4.2/bin/mongod-- fork-- logappend-- config / etc/mongod.conf-- auth-- wiredTigerCacheSizeGB 0.5ExecReload=/bin/kill-s HUP $MAINPIDExecStop=/usr/local/mongodb4.2/bin/mongod-- shutdown-- config / etc/mongod.confPrivateTmp=true [Install] WantedBy=multi-user.target
Vi / etc/ mongod.conf
Write the following text
# Where and how to store data.storage: dbPath: / usr/local/mongodb4.2/data journal: enabled: true# engine: mmapv1# mmapv1:# wiredTiger:# where to write logging data.systemLog: destination: file logAppend: true path: / usr/local/mongodb4.2/logs# network interfacesnet: port: 27017 bindIp: 127.0.0.1-- changed to 0.0.0.0 can be accessed by external # processManagement:security: authorization: enabled
Add the port number to the firewall rule:
Firewall-cmd-zone=public-add-port=27017/tcp-permanentfirewall-cmd-reload
Other related commands
Systemctl stop mongod.service-stop
Systemctl start mongod.service-start
Systemctl status mongod.service-check the running status
Service mongod start-start
Chkconfig mongod on--
Service mongod stop-stop
Service mongod restart-restart
Pick up https://docs.mongodb.com/manual/tutorial/install-mongodb-on-red-hat/
This is the end of the content of "how to install MongoDB in Centos7". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
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.