博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Install MongoDB Enterprise on Red Hat Enterprise or CentOS
阅读量:2397 次
发布时间:2019-05-10

本文共 5292 字,大约阅读时间需要 17 分钟。

Overview

Use this tutorial to install on Red Hat Enterprise Linux or CentOSLinux versions 6 and 7 from.rpm packages.

 

Use the provided distribution packages as described in this page if possible.These packages will automatically install all of MongoDB’s dependencies, and arethe recommended installation method.

1

Configure repository.

Create an /etc/yum.repos.d/mongodb-enterprise.repo file so that you can install MongoDB enterprise directly, using yum.

For the latest stable release of  MongoDB Enterprise

Use the following repository file:

 

[mongodb-enterprise]name=MongoDB Enterprise Repositorybaseurl=https://repo.mongodb.com/yum/redhat/$releasever/mongodb-enterprise/3.4/$basearch/gpgcheck=1enabled=1gpgkey=https://www.mongodb.org/static/pgp/server-3.4.asc

NOTE:

You can find .repo files for each release can also be found .Remember that odd-numbered minor release versions (e.g. 2.5) are development versions and are unsuitablefor production deployment.

2

Install the MongoDB Enterprise packages and associated tools.

 

To install the latest stable version of MongoDB Enterprise, issue the following command:

 

 

sudo yum install -y mongodb-enterprise
 

3

When the install completes, you can run MongoDB.

Install MongoDB Enterprise From Tarball

While you should use the .rpm packages as previously described, you may also manually install MongoDB using the tarballs. See for details.

Run MongoDB Enterprise

Prerequisites

Configure SELinux

Important

If you are using SELinux, you must configure SELinux to allow MongoDB to start on Red Hat Linux-based systems (Red Hat Enterprise Linux or CentOS Linux).

To configure SELinux, administrators have three options:

  • If SELinux is in enforcing mode,enable access to the relevant ports that the MongoDB deployment will use(e.g.27017). See for more information on MongoDB’s default ports. For default settings,this can be accomplished by running

    semanage port -a -t mongod_port_t -p tcp 27017
  • Disable SELinux by setting the SELINUX setting todisabled in/etc/selinux/config.

    SELINUX=disabled

    You must reboot the system for the changes to take effect.

  • Set SELinux to permissive mode in/etc/selinux/config bysetting theSELINUX setting topermissive.

    SELINUX=permissive

    You must reboot the system for the changes to take effect.

    You can instead use setenforce to change topermissive mode.setenforce does not require a reboot but isnot persistent.

Alternatively, you can choose not to install the SELinux packages when you areinstalling your Linux operating system, or choose to remove the relevant packages. This option is the most invasive and is not recommended.

Data Directories and Permissions

Warning

On RHEL 7.0, if you change the data path, the default SELinux policies will prevent from having write access on the new data path if you do not change the security context.

The MongoDB instance stores its data files in /var/lib/mongoand its log files in/var/log/mongodb by default,and runs using themongod user account. You can specify alternate log and data file directories in/etc/mongod.conf. See and for additional information.

If you change the user that runs the MongoDB process, you must modify the access control rights to the/var/lib/mongo and/var/log/mongodb directories to give this user access to these directories.

Procedure

1

Start MongoDB.

You can start the process by issuing the following command:

 

 

sudo service mongod start

 

 

2

Verify that MongoDB has started successfully

You can verify that the process has startedsuccess fully by checking the contents of the log file at/var/log/mongodb/mongod.log for a line reading

[initandlisten] waiting for connections on port 

where <port> is the port configured in/etc/mongod.conf,27017 by default.

You can optionally ensure that MongoDB will start following a systemreboot by issuing the following command:

sudo chkconfig mongod on

3

Stop MongoDB.

As needed, you can stop the process by issuing the following command:

 
sudo service mongod stop

 

4

Restart MongoDB.

You can restart the process by issuing the following command:

 

sudo service mongod restart

 

 

You can follow the state of the process for errors or important messages by watching the output in the/var/log/mongodb/mongod.log file.

5

Begin using MongoDB.

To help you start using MongoDB, MongoDB provides in various driver editions. See for the available editions.

Before deploying MongoDB in a production environment, consider the document.

Later, to stop MongoDB, press Control+C in the terminal where the instance is running.

Uninstall MongoDB

To completely remove MongoDB from a system, you must remove the MongoDBapplications themselves, the configuration files, and any directories containing data and logs. The following section guides you through the necessary steps.

Warning

This process will completely remove MongoDB, its configuration, andall databases. This process is not reversible, so ensure that all of your configuration and data is backed up before proceeding.

 

1

Stop MongoDB.

Stop the process by issuing the following command:

 
sudo service mongod stop

 

2

Remove Packages.

Remove any MongoDB packages that you had previously installed.

 

sudo yum erase $(rpm -qa | grep mongodb-enterprise)

3

Remove Data Directories.

Remove MongoDB databases and log files.

 
sudo rm -r /var/log/mongodb sudo rm -r /var/lib/mongo

 

 

转载地址:http://ybfob.baihongyu.com/

你可能感兴趣的文章
MySQL--基础七(分组查询、排序查询)
查看>>
MySQL--基础八(连接查询)
查看>>
MySQL--基础九(sql99连接查询)
查看>>
MySQL--基础十(子查询)
查看>>
Git--Eclipse操作、忽略文件、推送到远程库
查看>>
Oracle--同义词详解
查看>>
Oracle--存储过程概述、创建和执行
查看>>
Oracle--带参数的存储过程(IN、OUT和IN OUT)
查看>>
Oracle--触发器详解(分类、作用、执行顺序和语法)
查看>>
Oracle--DML触发器
查看>>
Oracle--替代触发器(INSTEAD OF)
查看>>
Oracle--系统事件触发器、用户事件触发器
查看>>
Oracle--管理触发器(查看、启用/禁用、修改、删除)
查看>>
Oracle--事务详解
查看>>
Oracle--锁(概述、分类)
查看>>
Oracle--加锁的方法
查看>>
Lambda表达式语法
查看>>
Lambda函数式接口
查看>>
Lambda方法引用、构造器引用、闭包
查看>>
Lambda表达式使用场景及实例
查看>>