- 安装MongoDB >
- Install MongoDB Enterprise >
- Install MongoDB Enterprise on Red Hat Enterprise or CentOS
Install MongoDB Enterprise on Red Hat Enterprise or CentOS¶
概述¶
Use this tutorial to install MongoDB Enterprise on Red Hat Enterprise Linux or CentOS Linux. The tutorial uses .rpm packages to install.
Packages¶
MongoDB provides packages of the officially supported MongoDB Enterprise builds in it’s own repository. This repository provides the MongoDB Enterprise distribution in the following packages:
mongodb-enterprise
This package is a metapackage that will automatically install the four component packages listed below.
mongodb-enterprise-server
This package contains the mongod daemon and associated configuration and init scripts.
mongodb-enterprise-mongos
This package contains the mongos daemon.
mongodb-enterprise-shell
This package contains the mongo shell.
mongodb-enterprise-tools
This package contains the following MongoDB tools: mongoimport bsondump, mongodump, mongoexport, mongofiles, mongoimport, mongooplog, mongoperf, mongorestore, mongostat, and mongotop.
Control Scripts¶
The mongodb-enterprise package includes various control scripts, including the init script /etc/rc.d/init.d/mongod.
The package configures MongoDB using the /etc/mongod.conf file in conjunction with the control scripts.
As of version 2.6.4, there are no control scripts for mongos. The mongos process is used only in sharding. You can use the mongod init script to derive your own mongos control script.
Considerations¶
MongoDB only provides Enterprise packages for Red Hat Enterprise Linux and CentOS Linux versions 5 and 6.
Install MongoDB Enterprise¶
When you install the packages for MongoDB Enterprise, you choose whether to install the current release or a previous one. This procedure describes how to do both.
Configure repository.¶
Create an /etc/yum.repos.d/mongodb-enterprise.repo file so that you can install MongoDB enterprise directly, using yum.
Use the following repository file to specify the latest stable release of MongoDB enterprise.
[mongodb-enterprise]
name=MongoDB Enterprise Repository
baseurl=https://repo.mongodb.com/yum/redhat/$releasever/mongodb-enterprise/stable/$basearch/
gpgcheck=0
enabled=1
Use the following repository to install only versions of MongoDB for the 2.6 release. If you’d like to install MongoDB Enterprise packages from a particular release series, such as 2.4 or 2.6, you can specify the release series in the repository configuration. For example, to restrict your system to the 2.6 release series, create a /etc/yum.repos.d/mongodb-enterprise-2.6.repo file to hold the following configuration information for the MongoDB Enterprise 2.6 repository:
[mongodb-enterprise-2.6]
name=MongoDB Enterprise 2.6 Repository
baseurl=https://repo.mongodb.com/yum/redhat/$releasever/mongodb-enterprise/2.6/$basearch/
gpgcheck=0
enabled=1
Install the MongoDB Enterprise packages and associated tools.¶
You can install either the latest stable version of MongoDB Enterprise or a specific version of MongoDB Enterprise.
Install the latest stable version of MongoDB Enterprise.¶
Issue the following command:
sudo yum install mongodb-enterprise
Optional. Manage Installed Version¶
Install a specific release of MongoDB Enterprise.¶
Specify each component package individually and append the version number to the package name, as in the following example that installs the 2.6.1 release of MongoDB:
sudo yum install mongodb-enterprise-2.6.1 mongodb-enterprise-server-2.6.1 mongodb-enterprise-shell-2.6.1 mongodb-enterprise-mongos-2.6.1 mongodb-enterprise-tools-2.6.1
Pin a specific version of MongoDB Enterprise.¶
Although you can specify any available version of MongoDB Enterprise, yum will upgrade the packages when a newer version becomes available. To prevent unintended upgrades, pin the package. To pin a package, add the following exclude directive to your /etc/yum.conf file:
exclude=mongodb-enterprise,mongodb-enterprise-server,mongodb-enterprise-shell,mongodb-enterprise-mongos,mongodb-enterprise-tools
Previous versions of MongoDB packages use different naming conventions. See the 2.4 version of documentation for more information.
When the install completes, you can run MongoDB.¶
Run MongoDB Enterprise¶
Verify that MongoDB has started successfully¶
You can verify that the mongod process has started successfully by checking the contents of the log file at /var/log/mongodb/mongod.log.
You can optionally ensure that MongoDB will start following a system reboot by issuing the following command:
sudo chkconfig mongod on
Begin using MongoDB.¶
To begin using MongoDB, see MongoDB 快速入门. Also consider the 生产环境指南 document before deploying MongoDB in a production environment.