MongoDB 2.4.10 Installation and configuration

Source: Internet
Author: User

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

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.