Installation notes for centos 6.5 mongodb3.11, centosmongodb3.11

Source: Internet
Author: User

Installation notes for centos 6.5 mongodb3.11, centosmongodb3.11

Http://www.mongodb.org/downloads


Download

Curl-O-L https://fastdl.mongodb.org/linux/mongodb-linux-i686-3.0.2.tgz

Unzip and install

Tar-xvzf mongodb-Liunix-xxxxx.tgz

Start script

[Root @ a1 bin] # cat start. sh
./Mongod -- dbpath/opt/mongodb-data/data -- logpath/opt/mongodb-data/logs/mongodb. log -- journal -- fork


Set Password

> Use admin
Switched to db admin
> Db. createUser ()
2015-04-18T15: 39: 05.402 + 0000 e query TypeError: Cannot read property 'user' of undefined
At DB. createUser (src/mongo/shell/db. js: 1056: 23)
At (shell): 1: 4 at src/mongo/shell/db. js: 1056
> Db. createUser ({user: "sa", pwd: "123", roles: [{role: "userAdminAnyDatabase", db: "admin"}]})
Successfully added user :{
"User": "sa ",
"Roles ":[
{
"Role": "userAdminAnyDatabase ",
"Db": "admin"
}
]
}
> Show dbs
Admin 0.078 GB
Local 0.078 GB
> Quit ();


Password set

Modify the startup script

./Mongod -- dbpath/opt/mongodb-data/data -- logpath/opt/mongodb-data/logs/mongodb. log -- journal -- fork -- auth

Kill process and restart

[Root @ a1 bin] # ps-ef | grep mongo
Root 10931 1 0 :28? 00:00:11./mongod -- dbpath/opt/mongodb-data/data -- logpath/opt/mongodb-data/logs/mongodb. log -- journal -- fork
Root 11038 10460 0 00:00:00 pts/0 grep mongo
[Root @ a1 bin] # kill-9 10931
[Root @ a1 bin] # ps-ef | grep mongo
Root 11042 10460 0 00:00:00 pts/0 grep mongo
[Root @ a1 bin] # vi start. sh
[Root @ a1 bin] #./start. sh
About to fork child process, waiting until server is ready for connections.
Forked process: 11047
Child process started successfully, parent exiting

Client Login

[Root @ a1 bin] #./mongo -- port 27017-u sa-p 123 -- authenticationDatabase admin
MongoDB shell version: 3.1.1
Connecting to: 127.0.0.1: 27017/test
>

Zookeeper

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.