Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

MongoDB 2.4.10 installation and configuration

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

MongoDB 2.4.10 installation and configuration

Prepare for

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 startup user mongod.

Groupadd mongod useradd-g mongod mongod

Or

Useradd-M-s / sbin/nologin mongod

two。 Create a database directory.

# log file directory mkdir-p / data/var/log/mongodb/ # data file directory mkdir-p / data/var/lib/mongodb/ # PID file directory mkdir-p / data/var/run/mongodb/

3. Modify the directory owner.

Cd / data/var chown-R mongod.mongod log lib run

Configuration

1. Create a profile / 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

two。 If you are configured as a member of a replica set, copy the file from another member.

Scp-P 22 / etc/mongod.conf root@192.168.0.3:/tmp scp-P 22 / etc/mongo_main.key root@192.168.0.3:/tmp cp / tmp/mongo_main.key / etc/ cp / tmp/mongod.conf / etc/ chown mongod.mongod / etc/mongo_main.key

3. Create the startup script mongod.

Scp-P 22 / etc/init.d/mongod root@192.168.0.3:/tmp cp / tmp/mongod / etc/init.d/mongod chkconfig-level 35 mongod on

4. Modify the maximum number of open files in the system.

Ulimit-n 64000 vi / etc/security/limits.conf

At the end, add:

* soft nofile 64000

* hard nofile 64000

* soft nproc 32000

* hard nproc 32000

Vi / etc/profile

At the end, add:

Ulimit-n 64000

Add ulimit-n 64000 to the startup script mongod

5. Start the service.

Service mongod start

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report