Skip to content

Instantly share code, notes, and snippets.

@fitzyyf
Created March 5, 2013 12:08
Show Gist options
  • Save fitzyyf/5089901 to your computer and use it in GitHub Desktop.
Save fitzyyf/5089901 to your computer and use it in GitHub Desktop.
mongo-shard
#!/bin/sh
# 创建数据和配置文件
mkdir -p ~/dbs/config
mkdir -p ~/dbs/shard1
mkdir -p ~/dbs/shard2
# 启动服务器
# 启动配置服务器
mongod --configsvr --dbpath ~/dbs/config --port 20000 --logpath ~/dbs/config.log --logappend --fork
# 启动副本集
mongod --shardsvr --replSet shard1 --port 27017 --dbpath ~/dbs/shard1/ --oplogSize 100 --logpath ~/dbs/shard1.log --logappend --fork --rest
mongod --shardsvr --replSet shard2 --port 27018 --dbpath ~/dbs/shard2/ --oplogSize 100 --logpath ~/dbs/shard2.log --logappend --fork
# 启动分片信息
mongos --configdb 192.168.1.102:20000,192.168.1.103:20000,192.168.1.104:20000 --port 30000 --chunkSize 100 --logpath ~/dbs/mongos.log --logappend --fork
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment