mongodb4.0 slice structures

Basic environmental structures:
the useradd Octopus-App-User
chgrp Octopus-App-User / Data -R & lt
chown Octopus-App-User / -R & lt Data
- =================== =================

IP:10.250.67.54
 IP:10.250.67.26 
IP:10.250.67.4
mongos(27017) mongos(27017) mongos(27017)
config(30000) config(30000) config(30000)
shard1 master node (40001)  shard1 deputy node (40001) shard1 deputy node (40001)
shard2 master node (40002)  shard2 deputy node (40002) shard1 deputy node (40002)
shard3 master node (40003)  shard3 deputy node (40003) shard1 deputy node (40003)


https://www.cnblogs.com/mokafamily/p/4102829.html

http://blog.51cto.com/13643643/2148825 
1 .-- Create a directory ===== ========= ======= 
    mkdir -p / the Data / MongoDB / logs / log storage directory
    mkdir -p storage directory / data / mongodb / etc configuration files
    mkdir / the Data / MongoDB / config / 
    mkdir / the Data / MongoDB / Shard l, 2,3} {
    Touch /data/mongodb/logs/shard{1,2,3}.log
    Touch /data/mongodb/logs/mongos.log
    Touch /data/mongodb/logs/config.log
    the chmod 777 / . Data / MongoDB / logs / * log
2.mongo_config configuration
(1) start config example:
    /data/srv/mongodb-linux-x86_64-4.0.4/bin/mongod -f /data/mongodb/etc/config.conf three same operation
(2) arranged config replica set: mongo --port 30000
    cfg = {_ id: "OctopusConfigDBset ", members: [{_ id: 0, host: '10 .250.67.54: 30000 ', priority: 50}, {_ id: 1, host: '10 .250.67.26: 30000', priority: 30 }, {the _id: 2, Host: '10 .250.67.4: 30000 ', priority: 20 is}]};
    rs.initiate (CFG);
- ================= =========================
3.mongo_shard1 configuration 
(1) start shard example:
    /data/srv/mongodb-linux-x86_64-4.0.4 / bin / mongod -f /data/mongodb/etc/shard1.conf same three operations
(2) arranged shard1 replica set: 40001 Mongo --port
    CFG = {_ ID: "OctopusShard1DBset", Members: [{_ ID: 0, host: '10 .250.67.54: 40001 ', priority: 50}, {_ id: 1, host: '10 .250.67.26: 40001', priority: 30}, {_id: 2, host: '10 .250.67.4: 40001 ', priority: 20 is}]};
    rs.initiate (CFG);
4.mongo_shard2 configuration 
(1) start shard example:
    /data/srv/mongodb-linux-x86_64-4.0.4/bin/mongod -f /data/mongodb/etc/shard2.conf three same operation
(2) arranged shard2 replica set: 40002 Mongo --port
    CFG = {_ id: "OctopusShard2DBset" , members: [{_ id: 0, host: '10 .250.67.54: 40002 ', priority: 50}, {_ id: 1, host: '10 .250.67.26: 40002', priority: 30} , {the _id: 2, Host: '10 .250.67.4: 40002 ', priority: 20 is}]};
    rs.initiate (CFG); 
5.mongo_shard3 configuration (: S% /. 1 /. 3 / GC)
(. 1) start shard example:
    consistent /data/srv/mongodb-linux-x86_64-4.0.4/bin/mongod -f /data/mongodb/etc/shard3.conf three operations
(2) arranged shard3 replica set: mongo --port 40003
    CFG = {_ ID: "OctopusShard3DBset", Members: [{_ ID: 0, Host: '10 .250.67.54: 40003 ', priority: 50}, {_ ID:. 1, Host: '10 .250.67.26: 40003', priority: 30}, {_id: 2, host: '10 .250.67.4: 40003 ', priority: 20}]};
    rs.initiate(cfg); 
- ================================================
6.mongo_mongos routing server
(1) start mongos route:
    consistent /data/srv/mongodb-linux-x86_64-4.0.4/bin/mongos -f /data/mongodb/etc/mongos.conf // three servers operating
( 2) start fragmentation:
    Mongo // That is because the default port 27017, where it is not connected port number
    mongos> ADMIN use
    mongos> sh.addShard ( "OctopusShard1DBset / 10.250.67.54: 40001,10.250.67.26: 40001,10.250 .67.4: 40001 ")
    mongos> sh.addShard (" OctopusShard2DBset / 10.250.67.54: 40002,10.250.67.26: 40002,10.250.67.4: 40002 ")
    mongos> sh.status () // Check cluster status

Guess you like

Origin www.cnblogs.com/xingyunshizhe/p/11328041.html