MongoDB master-slave and replset test, mongodbreplset

Source: Internet
Author: User

MongoDB master-slave and replset test, mongodbreplset
1. masterslavemaster configuration file: dbpath = ../data_test/db/master
Logpath = ../data_test/master. log
Port = 8642
Logappend = true
OplogSize = 2048
StorageEngine = wiredTiger
Nojournal = true
Slave configuration file: dbpath = ../data_test/db/slave
Logpath = ../data_test/slave. log
Port = 8643
Logappend = true
OplogSize = 2048
StorageEngine = wiredTiger
Nojournal = true
Slave = true
Source = 127.0.0.1: 8642
Slavedelay = 10
Autoresync = true start mater and result:

Start slave and result:

On the master:
On slave:
2. Replica set test (s1_1, s2_1, s3_1) s1_1 configuration file: dbpath = ../data/db/s1_1
Logpath = ../data/s1_1.log
Port = 8442
Shardsvr = true
ReplSet = shard1
Logappend = true
OplogSize = 2048
StorageEngine = wiredTiger
Nojournal = true
S2_1 configuration file: dbpath = ../data/db/s2_1
Logpath = ../data/s2_1.log
Port = 8542
Shardsvr = true
ReplSet = shard1
Logappend = true
OplogSize = 2048
StorageEngine = wiredTiger
Nojournal = true
S3_1 configuration file: dbpath = ../data/db/s3_1
Logpath = ../data/s3_1.log
Port = 8642
Shardsvr = true
ReplSet = shard1
Logappend = true
OplogSize = 2048
StorageEngine = wiredTiger
Nojournal = true
Startup File: start cmdd.exe -- config = .. /config/m1/s1_1start cmdd.exe -- config = .. /config/m2/s2_1start cmdd.exe -- config = .. /config/m3/s3_1 configure replica set: use adminconfig = {_ id: 'shard1 ', members: [{_ id: 0, host: 'localhost: 100 '}, {_ id: 1, host: 'localhost: 808080'}, {_ id: 2, host: 'localhost: 8080', slaveDelay: 8542, priority: 0}]}; master node:
Slave node:

Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.

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.