MongoDB的master-slave及replset測試,mongodbreplset

來源:互聯網
上載者:User

MongoDB的master-slave及replset測試,mongodbreplset
1、masterslavemaster設定檔:dbpath=../data_test/db/master
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啟動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
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
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
開機檔案:start mongod.exe --config=../config/m1/s1_1start mongod.exe --config=../config/m2/s2_1start mongod.exe --config=../config/m3/s3_1配置複本集:use adminconfig = {_id: 'shard1', members:[{_id:0, host: 'localhost:8442'},{_id:1, host:'localhost:8542'},{_id:2, host:'localhost:8642',slaveDelay:7200,priority:0}]};主節點:
從節點:

著作權聲明:本文為博主原創文章,未經博主允許不得轉載。

相關文章

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.