CentOS 6.5 mongodb3.11 Installation Notes

Source: Internet
Author: User

Http://www.mongodb.org/downloads


Download

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

Unzip the installation

Tar-xvzf mongodb-liunix-xxxxx.tgz

Startup scripts

[email protected] 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.078GB
Local 0.078GB
> Quit ();


Password Setup is complete

The startup script is modified to

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

Kill process Restart

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

Client Login

[Email protected] bin]#/mongo--port 27017-u sa-p 123--authenticationdatabase Admin
MongoDB Shell version:3.1.1
Connecting To:127.0.0.1:27017/test
>



CentOS 6.5 mongodb3.11 Installation Notes

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.