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

3.1-MongoDB installation

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

MongoDB installation

* set up a yum source

If you install the epel extension source, you can install the mongodb2.4 version, but this time we will install version 3.0. the official source only supports 64-bit systems.

Vim / etc/yum.repos.d/mongodb-org-3.0.repo / / add the following

[mongodb-org-3.0]

Name=MongoDB Repository

Baseurl= http://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.0/x86_64/

Gpgcheck=0

Enabled=1

* installation configuration

It is easy to install yum install-y mongodb-org

Edit the configuration file vim / etc/mongod.conf

Fork: fields after true # are deleted

Delete the fields after pidFilePath: / var/run/mongodb/mongod.pid #

Delete the comments at the beginning of the # after these two lines, otherwise there will be a problem when you restart

To bind multiple ip, write multiple ip after bind_ip, separated by commas, and listen for all ip left blank. That is, delete the later configuration, leaving only bindIp: it means binding all IP.

* start

Echo never > / sys/kernel/mm/transparent_hugepage/enabled # will prompt you to change the kernel if you don't do it.

Echo never > / sys/kernel/mm/transparent_hugepage/defrag

Vim / etc/security/limits.conf / / join

Mongod soft nofile 64000 # will prompt you to change the system limit if you don't do it.

Mongod hard nofile 64000

Mongod soft nproc 32000

Mongod hard nproc 32000

Launch: service mongod start

The startup process will be slow, it is writing data / var/lib/mongo

Description: startup script path / etc/init.d/mongod

Configuration file path / etc/mongod.conf

Log file path / var/log/mongodb/

Database path / var/lib/mongo/

When starting mongodb, if an error is reported, the display fails. There is no relevant prompt in the log, which is a problem with the startup script.

At this point, you can start with the command mongod-f / etc/mongod.conf, and you will be prompted to modify the configuration file if you report an error.

When starting with the command, you must first stop mongodb. Otherwise, the port conflicts and it won't start up.

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

Database

Wechat

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

12
Report