MongoDB 2.4.10 Installation and Configuration
Get ready
1. Download the installation file.
Cd/tmp wget https://www.mongodb.org/dr//fastdl.mongodb.org/linux/mongodb-linux-x86_64-2.4.10.tgz/downloadtar– ZXVF Download cd/tmp/mongodb-linux-x86_64-2.4.10/bin CP */usr/bin/
Installation
1. Create a startup user Mongod.
Groupadd Mongod useradd–g Mongod Mongod
Or
Useradd–m–s/sbin/nologin Mongod
2. Create a database directory.
#日志文件目录 mkdir–p/data/var/log/mongodb/#数据文件目录 mkdir–p/data/var/lib/mongodb/#PID文件目录 Mkdir–p/data/var /run/mongodb/
3. Modify the directory owner.
Cd/data/var chown–r Mongod.mongod Log Lib Run
Configuration
1. Create the configuration file/etc/mongod.conf.
Logpath=/data/var/log/mongodb/mongod.log logappend=true fork=true Dbpath=/data/var/lib/mongodb journal=true Directoryperdb = True Auth = True #replSet = Rs_test #keyFile =/etc/mongo_main.key
2. If you are configuring as a member of a replica set, copy the file from another member.
Scp–p 22/etc/mongod.conf [email protected]:/tmp scp–p 22/etc/mongo_main.key [email protected]:/tmp Cp/tmp/mongo _main.key/etc/cp/tmp/mongod.conf/etc/chown Mongod.mongod/etc/mongo_main.key
3. Create a startup script Mongod.
Scp–p 22/etc/init.d/mongod [Email protected]:/tmp cp/tmp/mongod/etc/init.d/mongod chkconfig–level + mongod on
4. Modify the maximum number of open files for the system.
Ulimit–n 64000 vi/etc/security/limits.conf
Added at the end:
* Soft Nofile 64000
* Hard Nofile 64000
* Soft Nproc 32000
* Hard Nproc 32000
Vi/etc/profile
Added at the end:
Ulimit–n 64000
Ulimit–n 64000 also added in startup script Mongod
5. Start the service.
Service Mongod Start
This article is from the SQL Server deep dives blog, so be sure to keep this source http://ultrasql.blog.51cto.com/9591438/1632175
MongoDB 2.4.10 Installation and configuration