Skip to content

Instantly share code, notes, and snippets.

@zero323
Created November 26, 2013 19:31
Show Gist options
  • Save zero323/7664645 to your computer and use it in GitHub Desktop.
Save zero323/7664645 to your computer and use it in GitHub Desktop.
Create MongoDB sharded test database.
killall mongod
killall mongos
rm -R s0 s1 cfg logs
mkdir -p s0/a s0/b s0/c s1/a s1/b s1/c
mkdir -p cfg/a cfg/b cfg/c
mkdir logs
mongod --shardsvr --replSet rs0 --dbpath s0/a --port 27001 --smallfiles --oplogSize 50 --fork --logpath logs/s0a.log
mongod --shardsvr --replSet rs0 --dbpath s0/b --port 27002 --smallfiles --oplogSize 50 --fork --logpath logs/s0b.log
mongod --shardsvr --replSet rs0 --dbpath s0/c --port 27003 --smallfiles --oplogSize 50 --fork --logpath logs/s0c.log
mongod --shardsvr --replSet rs1 --dbpath s1/a --port 27001 --smallfiles --oplogSize 50 --fork --logpath logs/s1a.log
mongod --shardsvr --replSet rs1 --dbpath s1/b --port 27002 --smallfiles --oplogSize 50 --fork --logpath logs/s1b.log
mongod --shardsvr --replSet rs1 --dbpath s1/c --port 27003 --smallfiles --oplogSize 50 --fork --logpath logs/s1c.log
mongod --configsvr --dbpath cfg/a --port 27007 --fork --logpath logs/cfg_a.log
mongod --configsvr --dbpath cfg/b --port 27008 --fork --logpath logs/cfg_b.log
mongod --configsvr --dbpath cfg/c --port 27009 --fork --logpath logs/cfg_c.log
mongos -configdb localhost:27007,localhost:27008,localhost:27009 --fork --logpath logs/mgs_1.log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment