CentOS under Installation configuration MongoDB

Source: Internet
Author: User
Tags mongodb server

1: Installation
Mkdir-p/app/mongodb

Tar zxvf mongodb-linux-x86_64-rhel62-3.4.6.tgz

VI. bash_profile
Path= $PATH: $HOME/bin
Path= $PATH:/app/mongodb/mongodb-linux-x86_64-rhel62-3.4.5/bin
Export PATH

--Let the configuration file take effect
source. bash_profile

--Create mongo.conf under the/app/mongodb directory
Dbpath=/app/mongodb/data
Logpath=/app/mongodb/logs/mongo.log
Logappend=true
Journal=true
Quiet=true
port=7979
Fork=true

--Create a directory
/app/mongodb/data

--Create a log file
/app/mongodb/logs/mongo.log

2: Create DATABASE and authorization information

$ MONGO127.0.0.1:7979>Use gwzhswitched to DB test> Db.createuser ({User:"Test",pwd:"Test", Roles:[{role:"ReadWrite"Db:"Test"}]}) Successfully added User: {"User":"Test",        "Roles" : [                {                        "role":"ReadWrite",                        "DB":"Test"                }        ]}>

3: Start in licensing mode
Mongod--config mongodb/mongo.conf--auth

4: Authorized Authentication Login
$ MONGO 127.0.0.1:7979
MongoDB Shell version v3.4.6
Connecting to:mongodb://127.0.0.1:7979
MongoDB Server version:3.4.6
> Use test
Switched to DB test
> Db.auth (' Test ', ' test ')
1
>

CentOS under Installation configuration MongoDB

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.