Environment:
centost6.5 x64
MongoDB 3.0 1, to the official website to download this file:
Mongodb-linux-x86_64-rhel62-3.0.0.gz
2. Install MongoDB (install to/usr/local)
Unpack the installation package under the/usr/local directory;
TAR-ZXVF mongodb-linux-x86_64-3.0.2.tgz
To modify the extracted directory:
MV mongodb-linux-x86_64-3.0.2 mongodb3.0.0
3. Create the mongodb.conf file in the bin directory under the mongodb3.0.2 directory:
dbpath=/home/mongodb-data/db #数据文件存放目录, usually placed in the bin directory under the installation file directory;
Logpath=/home/mongodb-data/logs/mongodb.log #日志文件目录, the general installation directory under the bin directory
port=27017 #端口默认 # fork=true # runs MongoDB as a daemon, creating a server process
Nohttpinterface=true # Turn off HTTP interface, turn off 27018 port access by default
Rebind the configuration file address and access IP for MongoDB:
/usr/local/mongodb3.0.0/bin/mongod--bind_ip localhost-f/usr/local/mongodb3.0.2/bin/mongodb.conf
4. Modify the soft rlimits limit
Vi/etc/security/limits.conf
At the end of the document add
Mongod soft Nproc 65536
mongod hard nproc 65536
mongod soft nofile 65536
mongod hard N Ofile 65536
5. Start the MONGO program, start with the parameters defined by the configuration file mongodb.conf
/usr/local/mongodb3.0.2/bin/mongod--config/usr/local/mongodb3.0.2/bin/mongodb.conf
or directly under the/usr/local/mongodb3.0.2/bin/directory:
./mongod--config mongodb.conf