In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
1. Download and install
Official website address: www.mongodb.com/download-center? jmp=nav#community
Here's the community version of linux 7:
Decompress tar zxvf mongodb-linux-x86_64-rhel70-4.0.1.tgzmv mongodb-linux-x86_64-rhel70-4.0.1 /usr/local/mongodb
generate a configuration file
vim /usr/local/mongodb/bin/mongodb.conf
dbpath = /usr/local/mongodb/data/db #directory where data files are stored logpath = /usr/local/mongodb/logs/mongodb.log #directory where log files are stored port = 27017 #port fork = true #enabled as a daemon, i.e. running bind_ip=0.0.0.0 in the background #Allow all connections
Start mongodb:
./ usr/local/mongodb/bin/mongod -f /usr/local/mongodb/bin/mongodb.conf
Configure environment variables for ease of operation
vim ~/.bash_profile #Modify PATH=$PATH:$HOME/bin:/usr/local/mongodb/binsource ~/.bash_profile for this user #Update user environment variables
OK, now you can use mongodb directly, command line input mongo, you can directly enter the database.
2. Configure mongodb First, understand the following MongoDB user roles:
1. Database user roles: read, readWrite;
2. Database administration roles: dbAdmin, dbOwner, userAdmin;
3. Cluster management roles: clusterAdmin, clusterManager, clusterMonitor, hostManager;
4. Backup and restore roles: backup, restore;
5. All database roles: readAnyDatabase, readWriteAnyDatabase, userAdminAnyDatabase, dbAdminAnyDatabase
6. Super User Role: root
//There are also several roles that indirectly or directly provide system superuser access (dbOwner, userAdmin, userAdminAnyDatabase)
MongoDB does not have user authentication enabled by default, which means that visitors also have super administrator privileges. userAdminAnyDatabase: Has permission to assign roles and users, but does not have permission to query and write
Enter mongo on the command line and go to mongodb.
Previous query documents all said that the new user was db.addUser, but the new version of Mongodb (seems to have changed after 3.0) has not used this command. Create a user, note that the account follows the database.
use admindb.createUser({user:'test',pwd:'123456',roles:[{role:'dbAdmin',db:'admin'}]})
Note: docker install mongodb
docker pull mongodocker run -itd --name=mongo_test -p 27017:27017 mongo
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.