Installing MongoDB on RedHat Enterprise, CentOS, or Fedora Linux

Source: Internet
Author: User
Tags mongodb version mongodump mongorestore

Installing MongoDB on RedHat Enterprise, CentOS, or Fedora Linux

1. Outline

?

Note: After the installation of Yum, all processes will be automatically under/usr/bin, such as MONGO, Mongod, Mongostat can be directly cd/usr/bin after direct use.

This tutorial lists the basic installation processes for deploying MongoDB on RedHat Enterprise Linux, CentOS Linux, Fedora Linux, and related systems. The program uses the. RPM package as the basis for installation. 10gen released the MongoDB version of the. RPM Package for easy installation and management by users of the Debian system. While some releases include their own MongoDB packages, 10gen packages are often more advanced.

This tutorial includes: Overview of available packages, instructions for configuring Package Manager, the process of installing packages from a 10gen repository, and preliminary MongoDB configuration and operations.

See also the documentation for the related processes and concepts below.

Additional Installation Tutorials

    • Installing MongoDB on Debian or Ubuntu Linux
    • Installing MongoDB on Linux
    • Installing MongoDB on OS X

2. Package Introduction

The 10gen repository consists of two packages:

    • Mongo-10gen

      The package contains the latest version of the MongoDB tool . Install the package on all production MongoDB hosts and optionally install on other systems that you may need to manage the MongoDB system.

      The included MongoDB tools are: MONGO, Mongodump, Mongorestore, Mongoexport, Mongoimport, Mongostat, Mongotop, Bsondump

    • Mongo-server-10gen

      The package contains Mongod and MONGOs daemons , all from the latest stable version, and the package also includes the relevant configuration and initial scripts.

  Summary: Like other software generally these are integrated in a package, where the special is divided into 2 packages.

3. Installing MongoDB

3.1 Configuring the Package Management System (YUM)

    1. If you are running a 64-bit system, set the following configuration in the Create/etc/yum.repos.d/10gen.repo file:

[10gen]

Name=10gen Repository

baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64/

Gpgcheck=0

Enabled=1

    1. If you are running a 32-bit system, set the following configuration in the Create/etc/yum.repos.d/10gen.repo file:

[10gen]

Name=10gen Repository

baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/i686/

Gpgcheck=0

Enabled=1

Last update of the local package database:

Yum Update (be careful not to execute it, all the Yum software will be updated all over the entire machine)

3.2 Install Package

Issue the following command to install the latest stable version of MongoDB and related tools:

Yum Install Mongo-10gen Mongo-10gen-server

When the command is complete, you have successfully installed the mongodb! Next is the configuration and startup recommendations.

Once the installation is complete, confirm that the installation is successful, and perform the following command check:

RPM-QL Mongo-10gen

RPM-QL Mongo-10gen-server

[Note: This step may prompt "package Mongo-10gen is not installed", do not care, check the following files are available]

4. Configure MongoDB

Summary: Because of the use of Yum install, it is not possible to specify the installation directory, it is the following decentralized

Note: The real process of MongoDB is named Mongod, with mysqld a reason, followed by a D

Note: Data files and log files can be modified in the configuration file, not necessarily by default.

[This step is primarily to declare the path where the file is located so that the path setting for subsequent operations]

(1) Toolkit storage directory???? /usr/bin

The MONDB Toolkit contains MongoDB tools such as MONGO, Mongodump, Mongorestore, Mongoexport, Mongoimport, Mongostat, Mongotop, Bsondump Their storage directory is Usr/bin

    1. Configuration file???? /etc/mongod.conf
    2. Service defaults to???? /etc/init.d/mongod
    3. Data files are stored in the???? /var/lib/mongo, must have read and write access [Mongod.lock also in this area]
    4. Log files are stored in the???? /var/log/mongodb, must have read and write permission

5. Controlling MongoDB

Start MongoDB

Note When the installation is complete and does not start automatically , the Mongod process must be started manually by command:

Service mongod start???? [The method is invalid]

You can verify that the Mongod process has started successfully by examining the contents of the log file, and that the file location is/var/log/mongo/mongod.log.

Optionally, ensure that MongoDB would start following a system reboot, by issuing the following command (with root Privileges:)

Chkconfig Mongod on

?

Start MONGO:
?. /usr/bin/mongod--dbpath=/var/lib/mongo--maxconns=5120--logpath=/var/log/mongodb/mongodb.log–fork

[./usr/bin/mongod indicates the path where MONGO is located, which can be viewed by "whereis MONGO";

--dbpath indicates where the data files are stored;

--logpath indicates the path where the log file is located]

?

Use "Ps-ef|grep Mongod" to see if the boot was successful

Stop MongoDB

Stop the Mongod process by issuing the following command (either as a root or with sudo):

Pkill MONGO

Restart MongoDB

You can restart the Mongod process by issuing the following command (either as a root or with sudo):

Service Mongod restart

Observe the status of the process by observing the output in the/var/log/mongo/mongod.log file to see errors or important messages from the server.

[Note: If the machine restarts or shuts down abnormally, the last running process number is recorded in the Mongod.lock, it needs to be deleted before it can restart normally]

Installing MongoDB on RedHat Enterprise, CentOS, or Fedora Linux

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.