Home > Database > Mysql Tutorial > mongo单台设备分片--1

mongo单台设备分片--1

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-07 14:58:44
Original
2450 people have browsed it

mongo单台设备分片--1 config={_id:shard1,members:[{_id: 0, host: 127.0.0.1:27018},{_id: 1, host: 127.0.0.1:27019},{_id: 2, host: 127.0.0.1:27020},{_id: 3, host: 127.0.0.1:27021}]} rs.initiate(config); rs.add({_id : 4,host : 127.0.0.1:27022,

mongo单台设备分片--1

 

config={_id:'shard1',members:[{_id: 0, host: '127.0.0.1:27018'},{_id: 1, host: '127.0.0.1:27019'},{_id: 2, host: '127.0.0.1:27020'},{_id: 3, host: '127.0.0.1:27021'}]} 

 

rs.initiate(config); 

rs.add({"_id" : 4,host : "127.0.0.1:27022",arbiterOnly:true}); 

 

config={_id:'shard2',members:[{_id: 0, host: '127.0.0.1:27028'},{_id: 1, host: '127.0.0.1:27029'},{_id: 2, host: '127.0.0.1:27030'},{_id: 3, host: '127.0.0.1:27031'}]} 

 

rs.initiate(config); 

rs.add({"_id" : 4,host : "127.0.0.1:27032",arbiterOnly:true}); 

 

config={_id:'shard3',members:[{_id: 0, host: '127.0.0.1:27038'},{_id: 1, host: '127.0.0.1:27039'},{_id: 2, host: '127.0.0.1:27040'},{_id: 3, host: '127.0.0.1:27041'}]} 

 

rs.initiate(config); 

rs.add({"_id" : 4,host : "127.0.0.1:27042",arbiterOnly:true}); 

 

sudo mongod --configsvr --dbpath /data/mongo/ReplicaSetData-shard1/config --port 20000 --logpath /data/mongo/ReplicaSetData-shard1/config.log --logappend --fork 

 

sudo mongod --configsvr --dbpath /data/mongo/ReplicaSetData-shard2/config --port 20001 --logpath /data/mongo/ReplicaSetData-shard2/config.log --logappend --fork 

 

sudo mongod --configsvr --dbpath /data/mongo/ReplicaSetData-shard3/config --port 20002 --logpath /data/mongo/ReplicaSetData-shard3/config.log --logappend --fork 

 

sudo mongos --configdb 127.0.0.1:20000,127.0.0.1:20001,127.0.0.1:20002 --port 30000 --chunkSize 5 --logpath /data/mongo/ReplicaSetData-shard-log/mongos.log --logappend --fork

Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template