"MongoDB" Windows platform builds MONGO database replica set (cluster-like)

Source: Internet
Author: User

Replica sets (replica set) is a new feature that starts with the mongodDB1.6 version, which enables automatic failover and automatic repair of feature member nodes, and the data between each db is exactly the same, greatly reducing the risk of a single point of failure.

【】


This is the replica set schema for three nodes. The figure is from the book "The Essentials of MongoDB Management and development" written by Red pill. As can be seen, the structure is similar to a cluster, in fact, can be regarded as a cluster. Because it does have the same effect as the cluster implementation.

First, deploy replica sets.

Next shows how to demonstrate the deployment of a 3-node replica on a single server sets



Second, start replica service

Open three command Windows respectively, and then perform the following three sentences, respectively.

Mongod.exe  --replset rs1--keyfile "D:\Program files\mongodb\data\replica\key\r0"--port 28010--dbpath "D:\ Program Files\mongodb\data\replica\data\r0 "--logpath" D:\Program files\mongodb\data\replica\log\r0.log "-- Logappendmongod.exe  --replset rs1--keyfile "D:\Program files\mongodb\data\replica\key\r1"--port 28011--dbpath " D:\Program files\mongodb\data\replica\data\r1 "--logpath" D:\Program files\mongodb\data\replica\log\r1.log "-- logappendcd/d D:\Program files\mongodb\binmongod.exe  --replset rs1--keyfile "D:\Program files\mongodb\data\ Replica\key\r2 "--port 28012--dbpath" D:\Program files\mongodb\data\replica\data\r2 "--logpath" D:\Program Files\ Mongodb\data\replica\log\r2.log "--logappend




Third, login client, initialize replica sets environment





"MongoDB" Windows platform builds MONGO database replica set (cluster-like)

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.