Development of the old driver there is a need for me to install a mongodb, on-line access to some of the data tests are not an error is the database command mismatch, the following is relatively simple and easy to error.
Get binary Compression Package
wget http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel62-3.2.8.tgz
Unzip to the installation directory, create the data directory, and later in the configuration file configuration Data directory path
TAR-XF mongodb-linux-x86_64-rhel62-3.2.8.tgz-c/usr/local/
cd/usr/local/
MV mongodb-linux-x86_64-rhel62-3.2.8 MongoDB
Mkdir/usr/local/mongodb/data
Editing a configuration file
Vim/usr/local/mongodb/mongodb.conf
#端口
port=27017
#数据文件存放目录
Dbpath=/usr/local/mongodb/data
#日志文件存放目录
Logpath=/usr/local/mongodb/mongodb.log
#使用追加的方式写日志
Logappend=true
#以守护程序的方式启用, which runs in the background
Fork=true
#最大同时连接数
maxconns=500
#只允许通过本机访问
#bind_ip =127.0.0.1
#启用验证
#auth = True
Configuring Environment variables
Echo ' Export path= $PATH:/usr/local/mongodb/bin ' >>/etc/profile
. /etc/profile
Start MongoDB
/usr/local/mongodb/bin/mongod-f/usr/local/mongodb/mongodb.conf
Connect to MongoDB
Mongo
Create an administrative user (do not know whether the production is for the development of this user, or to ordinary users)
Use admin
Db.createuser ({User: ' root ', pwd: ' Woshichenshifei ', roles:[{role: ' Dbadminanydatabase ', db: ' admin '},{role: ' Useradminanydatabase ', DB: ' Admin '}]})
Check whether the creation was successful and verify that the user authentication is correct
Db.auth (' root ', ' Woshichenshifei ')
If the development has the need to change the password, re-modify it for him
Db.changeuserpassword (' root ', ' Chenshifei ')
Create regular users of databases and databases and delete databases and normal users
Use Chenshifei
Db.createuser ({User: ' Chenshifei ', pwd: ' Chenshifei ', roles:[{role: ' ReadWrite ', db: ' Chenshifei '}]})
Db.dropuser (' Chenshifei ')
Exit
Quit ()
Open config file auth authentication, restart MongoDB and re-connect
Kill ' Ps-ef|grep Mongodb|awk ' nr==1{print
Get rid of the auth before
/usr/local/mongodb/bin/mongod-f/usr/local/mongodb/mongodb.conf
MONGO Localhost:27017/admin-u root-p Chenshifei
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/87/FA/wKiom1flLDDRSy_7AAA3LBNG13U331.jpg "title=" 1.jpg " alt= "Wkiom1fllddrsy_7aaa3lbng13u331.jpg"/>
Give the connection address, user, password to development or DBA
This article is from the "Mountain King" blog, please make sure to keep this source http://chenshifei.blog.51cto.com/11883413/1856204