Mongo DB: Sharding scripts

Configuration of few mongoDB servers to work as one: 1. run data servers (1, 2, ...): ./data1.sh ./data2.sh ./data3.sh ... 2. run config servers (3): ./configdata1.sh ./configdata2.sh ./configdata3.sh 3. run master server (1): ./master.sh 4. connect to master: mongo --host 127.0.0.1 --port 27040 5. allow db 'test' sharding: sh.enabledSharding("test"); 6. shard 'collection1': sh.shardCollection("test.collection1",{"_id", 1}) 7. show shard status: sh.status() Take a beer. data1.sh: mongod --shardsvr --dbpath /home/scalan/WorkDirectory/MondoShard/data1 --port 27021 data2.sh: mongod --shardsvr --dbpath /home/scalan/WorkDirectory/MondoShard/data2 --port 27022 data3.sh: mongod --shardsvr --dbpath /home/scalan/WorkDirectory/MondoShard/data3 --port 27023 configdata1.sh: mongod --configsvr --dbpath /home/scalan/WorkDirectory/MondoShard/configdata1 --port 27031 configdata2.sh: mongod --configsvr --dbpath /home/scalan/WorkDirectory/MondoShard/configdata2 --port 27032 configdata3.sh mongod --configsvr --dbpath /home/scalan/WorkDirectory/MondoShard/configdata3 --port 27033 master.sh: mongos --configdb 127.0.0.1:27031,127.0.0.1:27032,127.0.0.1:27033 --port 27040

Leave a Reply

Your email address will not be published. Required fields are marked *




Enter Captcha Here :