MongoDB Master/Slave Configuration

Source: Internet
Author: User
Tags install mongodb

MongoDB Master/Slave Configuration

1. Create the file mongodb. repo in the/etc/yum. repos. d/directory on the Master/Slave server, which contains the configuration information of the MongoDB repository. The content is as follows:

[mongodb] name=MongoDB Repository baseurl=http://downloads-distro.mongodb.org/repo/RedHat/os/x86_64/ gpgcheck=0 enabled=1  

2. Run the installation command on the Master/Slave server.

yum -y install mongodb-org

3. Customize the db and log storage path on the Master/Slave Server

Create a new database directory and modify permissions

mkdir -p /data0/mongodbchown -R  mongod:mongod /data0/mongodb

Modify/etc/mongod. conf on the master server

Logpath =/data0/mongodb/mongod. log
Logappend = true # Use APPEND to write logs
Fork = true # Run as a daemon
Master = true # master database
Dbpath =/data0/mongodb
Pidfilepath =/var/run/mongodb/mongod. pid
Bind_ip = 172.16.225.111 # bind the service IP address. All local IP addresses are not specified by default.
Auth = true # enable user password verification

Modify/etc/mongod. conf from the server

Logpath =/data0/mongodb/mongod. loglogappend = truefork = trueslave = true # slave database source = 172.16.225.111: 27017 # master database IP address and port dbpath =/data0/mongodbpidfilepath =/var/run/mongodb/mongod. pidbind_ip = 172.16.59.20.auth = true

4. The Master/Slave server starts the mongodb service.

/etc/init.d/mongod start

 

For more MongoDB tutorials, see the following:

CentOS compilation and installation of php extensions for MongoDB and mongoDB

CentOS 6 install MongoDB and server configuration using yum

Install MongoDB2.4.3 in Ubuntu 13.04

MongoDB beginners must read (both concepts and practices)

MongoDB Installation Guide for Ubunu 14.04

MongoDB authoritative Guide (The Definitive Guide) in English [PDF]

Nagios monitoring MongoDB sharded cluster service practice

Build MongoDB Service Based on CentOS 6.5 Operating System

MongoDB details: click here
MongoDB: click here

This article permanently updates the link address:

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.