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