In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
MongoDB is a database based on distributed file storage. Written in C++ language. Designed to provide scalable high-performance data storage solutions for WEB applications. MongoDB is a product between relational database and non-relational database, which is the most functional and most like relational database in non-relational database.
1. Download and decompress mongodb
Cd / data/curl-O https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-4.0.4.tgztar zxvf mongodb-linux-x86_64-4.0.4.tgz
2. Create mongodb-related directories
Mv mongodb-linux-x86_64-4.0.4 mongodbmkdir-p mongodb/ {data/db,log} mkdir-p / etc/mongodb
3. Create a mongodb configuration file
Vim / etc/mongodb/mgdb.conf
Dbpath=/data/mongodb/data/db # data file storage directory logpath=/data/mongodb/log/mongodb.log # log file storage directory port=37485 # port, default is 27017, you can customize logappend=true # enable log append add log fork=true # enable daemon, that is, run bind_ip=0.0.0.0 # local listening IP in the background 0.0.0.0 indicates whether all local IPauth=true # require authentication permission login (username and password)
4. Add environment variables
Vim / etc/profile
Export MONGODB_HOME=/data/mongodbexport PATH=$PATH:$MONGODB_HOME/bin
Make the environment variable effective immediately
Source / etc/profile
5. Create a mongodb startup configuration file
Vim / usr/lib/systemd/system/mongodb.service
[Unit] Description=mongodbAfter=network.target remote-fs.target nss- lookup.target [service] Type=forkingRuntimeDirectory=mongodbPIDFile=/data/mongodb/data/db/mongod.lockExecStart=/data/mongodb/bin/mongod-- config / etc/mongodb/mgdb.confExecStop=/data/mongodb/bin/mongod-- shutdown-- config / etc/mongodb/mgdb.confPrivateTmp=true [Install] WantedBy=multi-user.target
6. Start mongodb and join boot boot
Systemctl daemon-reloadsystemctl start mongodbsystemctl enable mongodb
7. Configure firewalld firewall policy
Firewall-cmd-permanent-add-port=37485/tcpfirewall-cmd-reload
8. Testing
(1) create an administrative user
Mongo-- port 37485 > use admin > db.createUser ({user: "admin", pwd: "xuad830818", roles: [{role: "userAdminAnyDatabase", db: "admin"}]}) > db.auth ('admin','xuad830818')
(2) create a test user
> use test > db.createUser ({user: "xuad", pwd: "123456", roles: [{role: "readWrite", db: "securitydata"}]}) > db.auth ('xuad','123456') > exit
(3) Log in with test users
Mongo-- port 37485-u xuad-p 123456
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.