Installation and use of MongoDB on CentOS 6

Source: Internet
Author: User
Tags install mongodb mongodb mongodb server
CentOS 6 Installation MongoDBhttps://docs.mongodb.com/manual/installation/#tutorial-installation Install MongoDB Professional Edition
# Create/etc/yum.repos.d/mongodb-enterprise.repo
[mongodb-enterprise]
name=mongodb Enterprise Repository
baseurl=https://repo.mongodb.com/yum/redhat/$releasever/mongodb-enterprise/3.4/$basearch/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-3.4.asc

sudo yum install-y mongodb-enterprise

sudo service mongod start

sudo chkconfig mongod on 

sudo yum erase $ (rpm-qa | grep mongodb-enterprise) # Uninstall
Install MongoDB Community Edition
#配置包管理系统

Create/etc/yum.repos.d/mongodb-org-3.6.repo 

[mongodb-org-3.6]
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
Install MongoDB
sudo yum install-y mongodb-org
#
sudo yum install-y mongodb-org-3.6.3 mongodb-org-server-3.6.3 mongodb-org-shell-3.6.3 mongodb-org-mongos-3.6.3 mongodb-org-tools-3.6.3
Start MongoDB
sudo service mongod start
sudo chkconfig mongod on
sudo service mongod stop
Using MongoDB
MONGO--host 127.0.0.1:27017
Uninstall Delete MongoDB
sudo service mongod stop
sudo yum erase $ (rpm-qa | grep mongodb-org)
sudo rm-r/var/log/mongodb
sudo rm-r/ Var/lib/mongo
MongoDB Create user use

https://www.mongodb.com/
Https://www.mongodb.com/download-center#community MongoDB Loginin

MONGO--port 27017 Help # to check the Use admin # to switch to Administrator Db.createuser ({User: "Aniumongodb", pwd: "Aniumongodb123.") ", roles: [{role:" Useradminanydatabase ", DB:" Admin "}]}) # [Root@mongodb ~]# MONGO--port 27017 MongoDB-Shel L version v3.6.3 connecting TO:MONGODB://127.0.0.1:27017/MONGODB server version:3.6.3 server has startup warnings:201 8-04-02t17:12:06.214+0800 i STORAGE [Initandlisten] 2018-04-02t17:12:06.214+0800 i STORAGE [initandlisten] * * WARNING:   Using The XFS filesystem is strongly recommended with the Wiredtiger storage engine 2018-04-02t17:12:06.214+0800 I storage [Initandlisten] * * Http://dochub.mongodb.org/core/prodnotes-filesystem 2018-04-02t17:12:07.413+0800 I contr  OL [Initandlisten] 2018-04-02t17:12:07.413+0800 I control [Initandlisten] * * warning:access control isn't enabled for
The database. 2018-04-02t17:12:07.413+0800 I control [Initandlisten] * * * Read and Write access to data and configuration are UNR estricted. 2018-04-02t17:12:07.414+0800 I control [Initandlisten] MongoDB Enterprise > Use admin switched to DB admin MongoDB En   Terprise > Db.createuser (.....) {... User: "Aniumongodb", ... pwd: "Aniumongodb123.", ... roles: [{role: "Useradminanydatabase", DB: "admin
" } ]
...   }
... ) Successfully added User: {"user": "Aniumongodb", "roles": [{] Role ":" Useradminanydatabase "," db ":" Admin "}]} MongoDB Enterprise &G T Exit bye
MongoDB User Profile
Built-in Roles (built-in roles):
    1. Database user role: Read, ReadWrite;
    2. Database Management role: Dbadmin, Dbowner, Useradmin;
    3. Cluster Management role: Clusteradmin, Clustermanager, Clustermonitor, Hostmanager;
    4. Backup Recovery role: Backup, restore;
    5. All database roles: Readanydatabase, Readwriteanydatabase, Useradminanydatabase, Dbadminanydatabase
    6. Super User role: Root  
    //There are several other roles indirectly or directly providing access to the system Superuser (Dbowner, Useradmin, Useradminanydatabase)
    7. Internal role: __system

# User Role Permissions
read: Allows the user to read the specified database
readwrite: Allow users
to read and write to the specified database Dbadmin: Allows the user to perform administrative functions in the specified database, such as index creation, deletion, view statistics, or access
to System.profile useradmin: Allows the user to write to the System.users collection, which can be found in the specified database, Delete and manage user
Clusteradmin: Only available in the Admin database, giving users administrative rights to all fragmentation and replication set-related functions.
readanydatabase: Only available in the Admin database, giving users read access to all databases
readwriteanydatabase: Only available in the Admin database, giving users read and write access
to all databases Useradminanydatabase: Available only in the Admin database, giving users useradmin permissions for all databases
dbadminanydatabase: Only available in the admin database. Give users dbadmin permissions for all databases.
Root: Only available in the admin database. Super account, Super privilege    
Create a Super Administrator account
Db.createuser (
...  ..) {
...    User: "Aniudba",
...    PWD: "Aniudba123."    roles: [
...       ] {role: "root", DB: "admin"}
...    ]
...  }
... )
Successfully added User: {"
        user": "Aniudba",
        "roles": [
                {
                        "role": "Root",
                        "db": "Admin" 
  }
        ]
}
MongoDB Startup ErrorWarning:soft rlimits too low. Rlimits set to 1024 processes, 16392 files. Number of processes should is at least 8196
Change/etc/security/limits.d/90-nproc.conf

*          soft    nproc     16392 # 1024 to 16392
root       soft    nproc     Unlimited restart

mongodb service  /etc/init.d/mongod restart

MongoDB Connection Tool

Warning:using The XFS filesystem is strongly recommended with the Wiredtiger storage

The Warning:access control isn't enabled for the database. Read and write access to data and configuration are unrestricted.

Reference: http://www.cnblogs.com/zhoujinyi/p/4610050.html

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.