MongoDB Rights Management

Source: Internet
Author: User
Tags create mongodb robomongo mongo shell

When it comes to MongoDB, you have to talk. MongoDB user groups, unlike traditional relational databases, MongoDB does not require the creation of a Rights management group when creating an app. So a database visualizer like Robomongo can directly access and manipulate the corresponding address when creating connect, which is very convenient, for example.

  

Before talking about the user group, let's talk about how to install it.

1. Create a new/apps directory Mkdir/apps

2. Download mongodb-linux-x86_64-(version number). tgz to/apps file directory

3. Unzip the file tar xzf mongodb-linux-x86_64-(version number). tgz

4. Rename the extracted file to MongoDB MV mongodb-linux-x86_64-(version number) MongoDB

5. Create directories and files:

mkdir -P  mongodb/data/db  Create MongoDB database save path mkdir -P  mongodb/logs   Create a MongoDB log file directory touch  mongodb/logs/mongodb.logs   path to create a log

6. Start MongoDB:

/apps/mongodb/bin/mongod--dbpath=/apps/mongodb/data/db--logpath=/apps/mongodb/logs/mongodb.logs--fork

Note: It is explained here that it is necessary to start the MongoDB -dbpath= database path --logpath= log path through Mongod and--fork It is essential to -fork the service after the daemon form.

7. Add MongoDB service to random start: (equivalent to power on auto-execute program)//This method is the default execution will refer to permission execution

(1). Open vim/etc/rc.local (2). Add the following code /apps/mongodb/bin/mongod--dbpath=/apps/ mongodb/data/db/--logpath=/apps/mongodb/logs/mongodb.log--logappend--port=27107  --fork
Note:--logappend Specifies how the log is generated (append/overwrite), true if the log is appended, default is True,--port=27107 specifies that the MongoDB port is 27107

8. Ps-ef After successful launch | grep MONGO Viewing process

When MongoDB starts successfully, run it with the command line and go to/apps/mongodb/bin execution./mongo

Enter Mongoshell default entry to test database

Simple command Show DBS   queries all MONGODB databases   use database name into database (if no database is automatically created) DB   view currently using database show collections
      View data collection (collection equivalent to table in MySQL)                                      

MongoDB initially has a test and local database

At this point we can arbitrarily create a new database, set up a set, no Limit Robomongo Visual Database can also be connected

Robomongo connection such as, there is a kind of navicat for MySQL visual sense

Permission actions are below

1. Use admin

2.db.adduser (' Smallbo ', ' 123456 ') default Smallbo for super users

3. After the super User is established, you can connect MongoDB and all permissions with Robomongo or without entering your account and password.

4. So then CTRL + C exit MONGO Shell

5. Killall Mongod Kill Mongod Process

6. Permissions Run MONGO

/apps/mongodb/bin/mongod--dbpath=/apps/mongodb/data/db--auth--logpath=/apps/mongodb/logs/mongodb.logs--fork

7. Run Mongoshell./mongo in the bin directory. At this time show DBS, show collections have no permission

Look Robomongo this way. Direct login will show

In Mongoshell

Use admindb.auth (' username ',' password ')   // equivalent to administrator login return 1 execution succeeds and  can do any action

Robomongo under

Select MONGODB-CR Login Successful

Finally vim/etc/rc.local instead

/apps/mongodb/bin/mongod--dbpath=/apps/mongodb/data/db/--auth--logpath=/apps/mongodb/logs/mongodb.log-- Logappend--port=27107  --fork

Done!!!!!!!

MongoDB Rights Management

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.