Configure the MongoDB replica set in six simple steps

Source: Internet
Author: User
In this tutorial, we will create a MongoDB cluster with three nodes. The first node is the master node, the second node is the Failover node, and the third node is the arbitration node.

In this tutorial, we will create a MongoDB cluster with three nodes. The first node is the master node, the second node is the Failover node, and the third node is the arbitration node.

In this tutorial, we will create a MongoDB cluster with three nodes. The first node is the master node, the second node is the Failover node, and the third node is the arbitration node.

1. Install Mongo and set the configuration file

Install three servers and adjust the configuration file/etc/configure D. conf:

# Select your replication set name
ReplSet = [replication_set_name]
# Select the replication log size
OplogSize = 1024
Disable the bind_ip parameter to avoid binding to only 127.0.0.1 interface
# Bind_ip

2. Restart the three mongod daemon.

> Sudo service producer D restart

3. Create Initialization Configuration on the master node

Log on to the master node and create an Initialization Configuration. Note that do not use the return address (127.0.0.1) when using a private IP Address ):

> Mongo
Primary> cfg = {"_ id": "[replication_set_name]", "members": [{"_ id": 0, "host": "[Primary_Host_IP]: 27017 "}]}
Primary> rs. initiate (cfg );

4. Add a Failover instance to the replica set

Primary> rs. add ("[Failover_Host_IP]: 27017 ")

5. Add an arbitration instance to the replica set

Primary> rs. addArb (": 27017 ")

6. Confirm the status of the replica set.

Primary> rs. status ()

Bottom Line

I hope that the installation of each data cluster is as easy as that of the MongoDB replica set.

Set MongoDB to boot automatically in Linux

CentOS compilation and installation of MongoDB

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 authoritative Guide (The Definitive Guide) in English [PDF]

MongoDB details: click here
MongoDB: click here

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.