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 results:
Start slave and results:
On 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 Mongod.exe--config=. /config/m1/s1_1start Mongod.exe--config=. /config/m2/s2_1start Mongod.exe--config=. /config/m3/s3_1 Configuring Replica Sets:Use adminconfig = {_id: ' shard1 ', members:[{_id:0, Host: ' localhost:8442 '},{_id:1, host: ' LocalHost: 8542'},{_id:2, host: ' LocalHost: 8642', slavedelay:7200,priority:0}]};Master node:
From node:
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
MongoDB's Mater-slave and Replset test