Your SlideShare is downloading. ×
MongoDB Sharding Cluster Installation GuideVersion                   Author                                   Abstract    ...
Deployment Architecture        Prepare ServersShard Name   Primary Instance server   Second Instance server   Mongos Serve...
2. You can use three config servers to improve the High availability.3. You can install three replica set to improve the H...
* Notice:    1. If you want to add secondary replica set, you can add the server and port into Initiation.3. Install confi...
>db.runCommand({addshard:"shard7/10.224.56.111:27017",name:"s7",maxsize:20480});>db.runCommand({addshard:"shard8/10.224.56...
6. Trouble shooting  #on testing ENV, you need turn off firewall and then you need restart the mongo programs.  #/etc/init...
Upcoming SlideShare
Loading in...5
×

Mongo db sharding_cluster_installation_guide

691

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
691
On Slideshare
0
From Embeds
0
Number of Embeds
7
Actions
Shares
0
Downloads
16
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Transcript of "Mongo db sharding_cluster_installation_guide"

  1. 1. MongoDB Sharding Cluster Installation GuideVersion Author Abstract Release date0.1 Philip zhong Draft 2012-07-09 Deployment Architecture ................................................................................................................... 2 Prepare Servers ................................................................................................................................. 2
  2. 2. Deployment Architecture Prepare ServersShard Name Primary Instance server Second Instance server Mongos Server Config ServerShard1 10.224.56.105:27017 null 10.224.56.105:30000 10.224.57.165:20000Shard2 10.224.56.106:27017 null 10.224.56.106:30000 10.224.57.165:20000Shard3 10.224.56.107:27017 null 10.224.56.107:30000 10.224.57.165:20000Shard4 10.224.56.108:27017 null 10.224.56.108:30000 10.224.57.165:20000Shard5 10.224.56.109:27017 null 10.224.56.109:30000 10.224.57.165:20000Shard6 10.224.56.110:27017 null 10.224.56.110:30000 10.224.57.165:20000Shard7 10.224.56.111:27017 null 10.224.56.111:30000 10.224.57.165:20000Shard8 10.224.56.112:27017 null 10.224.56.112:30000 10.224.57.165:20000Shard9 10.224.56.113:27017 null 10.224.56.113:30000 10.224.57.165:20000Shard10 10.224.56.114:27017 null 10.224.56.114:30000 10.224.57.165:20000 *Notice: 1. You can install Mongos to another single server.
  3. 3. 2. You can use three config servers to improve the High availability.3. You can install three replica set to improve the High availability.1. Install Primary/secondary Instance program on every shard instance server. Please refer to << MongoDB_Program_Installation_Guide.doc>> #su - root # mkdir -p /data/mongo # mkdir -p /var/log/mongo/ # chown -R mongodb:mongodb /data/mongo # chown -R mongodb:mongodb /var/log/mongo # mkdir -p /data/mongo/shard1/ #numactl --interleave=all /opt/mongodb206/bin/mongod --shardsvr --replSet shard1 --port 27017 --dbpath /data/mongo/shard1 --oplogSize 100 --logpath /var/log/mongo/mongod.log -- logappend --fork --journal * Notice: 1. You can change it by you install directory. 2. If you have secondary replica set, you can start primary replica set with nojournal2. Initiate MongoDB replica set on every shard instance server. # /opt/mongodb206/bin/mongo >config = {_id: shard1 , members: [ {_id: 0, host: 10.224.56.105:27017} ] } >rs.initiate(config)
  4. 4. * Notice: 1. If you want to add secondary replica set, you can add the server and port into Initiation.3. Install config program on config server Please refer to << MongoDB_Program_Installation_Guide.doc>> #su - mongodb # mkdir -p /data/mongo/config # numactl --interleave=all /opt/mongodb206/bin/mongod --configsvr --dbpath/data/mongo/config --port 20000 --logpath /data/mongo/config/config.log --logappend --fork4. Install mongos program on every shard mongos server If mongos server and mongoDB instance are not in same server, please refer to << MongoDB_Program_Installation_Guide.doc >> #su -root # mkdir -p /var/log/mongo/ # chown -R mongodb:mongodb /var/log/mongo #su - mongodb #/opt/mongodb206/bin/mongos --configdb 10.224.57.165:20000 --port 30000 --chunkSize 1000 --logpath /var/log/mongo/mongos.log --logappend –fork5. Configure Shard Cluster Login one mongos server, For example: #/opt/mongodb206/bin/mongo 10.224.56.114:30000/admin >db.runCommand ({addshard:"shard1/10.224.56.105:27017",name:"s1",maxsize:20480}); >db.runCommand({addshard:"shard2/10.224.56.106:27017",name:"s2",maxsize:20480}); >db.runCommand({addshard:"shard3/10.224.56.107:27017",name:"s3",maxsize:20480}); >db.runCommand({addshard:"shard4/10.224.56.108:27017",name:"s4",maxsize:20480}); >db.runCommand({addshard:"shard5/10.224.56.109:27017",name:"s5",maxsize:20480}); >db.runCommand({addshard:"shard6/10.224.56.110:27017",name:"s6",maxsize:20480});
  5. 5. >db.runCommand({addshard:"shard7/10.224.56.111:27017",name:"s7",maxsize:20480});>db.runCommand({addshard:"shard8/10.224.56.112:27017",name:"s8",maxsize:20480});>db.runCommand({addshard:"shard9/10.224.56.113:27017",name:"s9",maxsize:20480});>db.runCommand({addshard:"shard10/10.224.56.114:27017",name:"s10",maxsize:20480});>db.runCommand({listshards : 1 })>db.runCommand( { enablesharding : "<dbname>" } );>db.runCommand( { shardcollection : "<dbname.collection>" , key : { "keyname" : 1 } }For example:>db.runCommand({enablesharding :"feeddb"})>db.runCommand( { shardcollection : "feeddb.test" , key : { "username" : 1 } } );for (var x=97; x<97+26; x+=3){ var y=(97+25); var prefix = String.fromCharCode(x) + String.fromCharCode(y); db.runCommand( { split :"feeddb.test", middle : {username : prefix } } ); }
  6. 6. 6. Trouble shooting #on testing ENV, you need turn off firewall and then you need restart the mongo programs. #/etc/init.d/iptables status #/etc/init.d/iptables stop #/etc/init.d/iptables status #chkconfig iptables off7. Install Monitor program ???

×