Installing MongoDB under Linux

Source: Internet
Author: User
Tags docker run

1. Initialize Docker:
-V Set Docker and host shared directory, format Hostpath:dockercontainerpath
-P Port Mapping
--name, container name
CentOS, mirroring
Docker run-d-P 27017:27017-v/home/mongodb/:/data/mongodb/--name centos-mongodb CentOS
Start Docker start Centos-mongodb
2. Enter the container
Docker exec-it Centos-mongodb/bin/bash
3. Copy MONGO installation files from the shared directory
Cp/data/mongodb/mongodb-linux-x86_64-3.2.8.tgz/usr/local/src
4. Decompression and Installation
TAR-ZXVF mongodb-linux-x86_64-3.2.8.tgz-c. /#解压mongo到/usr/local/
5, configuration Mongo
cd/usr/local/
MV mongodb-linux-x86_64-3.2.8/mongodb-3.2.8/
CD mongodb-3.2.8

mkdir conf

CD conf

Vim mongo.conf #新建mongo配置文件如下
---------------------------------------------------------------
DBPath =/data/mongodb/data #数据文件存放目录
LogPath =/data/mongodb/logs/mongodb.log #日志文件存放目录
Port = 27017 #端口
Fork = True #以守护程序的方式启用, which runs in the background
Nohttpinterface = True
---------------------------------------------------------------
If the/data/mongodb folder does not exist, first create
mkdir data
mkdir logs

6. Start MONGO
Cd/usr/local/mongodb-3.2.8/bin
./mongod--config. /conf/mongo.conf

Installing MongoDB under 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.