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.