1、masterslave截图
master配置文件:
dbpath=../data_test/db/master
logpath=../data_test/master.log
port=8642
logappend=true
oplogSize=2048
storageEngine=wiredTiger
nojournal=true
logpath=../data_test/master.log
port=8642
logappend=true
oplogSize=2048
storageEngine=wiredTiger
nojournal=true
slave配置文件:
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
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
启动mater及结果:
启动slave及结果:
master上:
slave上:
2、副本集测试(s1_1,s2_1,s3_1)
s1_1配置文件:
dbpath=../data/db/s1_1
logpath=../data/s1_1.log
port=8442
shardsvr=true
replSet=shard1
logappend=true
oplogSize=2048
storageEngine=wiredTiger
nojournal=true
logpath=../data/s1_1.log
port=8442
shardsvr=true
replSet=shard1
logappend=true
oplogSize=2048
storageEngine=wiredTiger
nojournal=true
s2_1配置文件:
dbpath=../data/db/s2_1
logpath=../data/s2_1.log
port=8542
shardsvr=true
replSet=shard1
logappend=true
oplogSize=2048
storageEngine=wiredTiger
nojournal=true
logpath=../data/s2_1.log
port=8542
shardsvr=true
replSet=shard1
logappend=true
oplogSize=2048
storageEngine=wiredTiger
nojournal=true
s3_1配置文件:
dbpath=../data/db/s3_1
logpath=../data/s3_1.log
port=8642
shardsvr=true
replSet=shard1
logappend=true
oplogSize=2048
storageEngine=wiredTiger
nojournal=true
logpath=../data/s3_1.log
port=8642
shardsvr=true
replSet=shard1
logappend=true
oplogSize=2048
storageEngine=wiredTiger
nojournal=true
启动文件:
start mongod.exe --config=../config/m1/s1_1
start mongod.exe --config=../config/m2/s2_1
start mongod.exe --config=../config/m3/s3_1
配置副本集:
use admin
config = {_id: 'shard1', members:[
{_id:0, host: 'localhost:8442'},
{_id:1, host:'localhost
:8542
'},
{_id:2, host:'localhost
:8642
',slaveDelay:7200,priority:0}
]
};
主节点:
从节点: