In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
MongoDB installation method
I. compilation and installation by hand
Software package Baidu network disk
Link: https://pan.baidu.com/s/19oPP-3k7MiPsemO2cLsdng password: k86h
1. Mount the local file and decompress it to the opt directory.
Tar zxf mongodb-linux-x86_64-rhel70-4.0.0.tgz-C / opt/
2. Move the extracted package to the / usr/local/ directory and rename it
Mv mongodb-linux-x86_64-rhel70-4.0.0 / / usr/local/mongodb
3. Create a configuration file
Cd / usr/local/mongodb/bin / / go to the bin directory of MongoDB first
Vim mongodb.conf / / create a configuration file directory
Dbpath = / usr/local/mongodb/data/db
Logpath = / usr/local/mongodb/logs/mongodb.log
Port = 27017
Fork = true
Chmod + x mongodb.conf / execute permissions to the newly created configuration file mkdir-p / usr/local/mongodb/data/db Recursive create data file storage directory mkdir-p / usr/local//mongodb/logs/ recursive creation log file storage directory cd / usr/local//mongodb/logs/touch mongodb.log / create log file
4. Add environment variables
Sed-I'$an export MONGODB_HOME=/usr/local/mongodb' / etc/profile
Sed-I'$an export PATH=$PATH:$MONGODB_HOME/bin' / etc/profile
Sed-I'$a PATH=$PATH:/usr/local/mongodb/bin' / etc/profile
Add the environment of MongoDB to the system environment and let the system identify
Source / etc/profile / / refresh environment variables
5. Start MongoDB
Cd / usr/local/mongodb/bin
Mongod-f\ mongodb.conf (executed under the bin directory) starts
Mongod-- config\ mongodb.conf-- shutdown is closed
6. Log in to MongoDB database using mongo
2. Yum one click to install MongoDB
1. Create a yum warehouse
Vim / etc/yum.repos.d/mongodb-org.repo / / write the following command
[mongodb-org]
Name=MongoDB Repository
Baseurl= https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.6/x86_64/
Gpgcheck=1
Enabled=1
Gpgkey= https://www.mongodb.org/static/pgp/server-3.6.asc
2. Install the database
Yum clean all
Yum list
Yum install-y mongodb-org
3. Modify the configuration file
Vi / etc/mongod.conf / / change the following
BindIp: 0.0.0.0 # listening address
Port: 27017 # listening port
4. Start the service, check the port, and log in to MongoDB
Systemctl start mongod.service
Netstat-anpt | grep 27017
Mongo / / enter the database
Db.version () / / View the database version
3. Enable multiple instances in MongoDB
And use the MongoDB installed by yum to do the experiment.
Copy the configuration file and modify it
Cp-p / etc/mongod.conf / etc/mongod2.conf / / copy configuration file
Vim / etc/mongod2.conf / / modify a few items
Path: / data/mongodb/mongod2.log / / change the directory where log files are stored
DbPath: / data/mongodb/mongo / / change the data storage directory
Port: 27018 / / change the port number
Second, create the corresponding file directory
Mkdir-p / data/mongodb/mongo / / create a data storage directory
Cd / data/mongodb/
Touch mongod2.log / / create a log storage directory
Chmod 777mongod2.log / / guarantees a 777permission to allow others to read and write
Third, start the service
Mongod-f / etc/mongod2.conf / / start the service
Mongo-- port 27018 / / Log in using this port number
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
Groupadd oinstallgroupadd dbagroupadd opergroupadd asmadmingroupadd asmdbagroupadd asmoperuseradd-g
© 2024 shulou.com SLNews company. All rights reserved.