码迷,mamicode.com
首页 > 数据库 > 详细

mongodb sharding

时间:2014-06-27 13:39:45      阅读:221      评论:0      收藏:0      [点我收藏+]

标签:style   class   blog   code   http   color   

mongod --port 10001 --logpath cluster/log/shard1.log --logappend --shardsvr -dbpath cluster/data/shard1 --directoryperdb --rest
mongod --port 10002 --logpath cluster/log/shard2.log --logappend --shardsvr -dbpath cluster/data/shard2 --directoryperdb --rest
mongod --port 20000 --logpath cluster/log/config.log --logappend --configsvr -dbpath cluster/data/config
mongos --port 27017 --logpath cluster/log/mongos.log --logappend --configdb 127.0.0.1:20000

进入mongos,配置shard:
mongo 127.0.0.1:27017/admin
db.runCommand({ addshard : "127.0.0.1:10001"})
db.runCommand({ addshard : "127.0.0.1:10002"})
db.runCommand({ listshards : 1})
db.runCommand({ enablesharding : "test"})
db.runCommand({ shardcollection : "test.c1",key : {_id: 1} })

 

参考

mongodb分布式集群部署,集群分片策略

MongoDB Sharding 集群配置示例

 

 

mongodb sharding,布布扣,bubuko.com

mongodb sharding

标签:style   class   blog   code   http   color   

原文地址:http://www.cnblogs.com/beta2013/p/3810588.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!