mongo分片
2015-11-11 19:43
447 查看
看了几个大牛的博客后,开始试着分片。
第一步:
mongod --fork --dbpath /mongo_data/config --logpath /mongo_data/log/config.log -port 10000
mongos --port 20000 --configdb 192.168.128.5:10000 --logpath /mongo_data/log/mongos.log
mongod --dbpath /mongo_data/shard3 --logpath /mongo_data/log/shard3.log --fork -port 27019
mongod --dbpath /mongo_data/shard4 --logpath /mongo_data/log/shard4.log --fork -port 27020
numactl --interleave=all mongod --dbpath /mongo_data/shard1/ --logpath /mongo_data/log/shard1.log --fork -port 27021
numactl --interleave=all mongod --dbpath /mongo_data/shard2/ --logpath /mongo_data/log/shard2.log --fork -port 27022
第二步:
mongo --port 20000 --》MongoDB shell version: 2.6.11 connecting to: 127.0.0.1:20000/test
mongos> use admin --》switched to db admin
db.runCommand({addshard:"192.168.128.5:27021",allowLocal:true})
{ "shardAdded" : "shard0000", "ok" : 1 }
db.runCommand({addshard:"192.168.128.5:27022",allowLocal:true})
{ "shardAdded" : "shard0001", "ok" : 1 }
db.runCommand({addshard:"192.168.128.5:27019",allowLocal:true})
{ "shardAdded" : "shard0002", "ok" : 1 }
db.runCommand({addshard:"192.168.128.5:27020",allowLocal:true})
{ "shardAdded" : "shard0003", "ok" : 1 }
第一步:
mongod --fork --dbpath /mongo_data/config --logpath /mongo_data/log/config.log -port 10000
mongos --port 20000 --configdb 192.168.128.5:10000 --logpath /mongo_data/log/mongos.log
mongod --dbpath /mongo_data/shard3 --logpath /mongo_data/log/shard3.log --fork -port 27019
mongod --dbpath /mongo_data/shard4 --logpath /mongo_data/log/shard4.log --fork -port 27020
numactl --interleave=all mongod --dbpath /mongo_data/shard1/ --logpath /mongo_data/log/shard1.log --fork -port 27021
numactl --interleave=all mongod --dbpath /mongo_data/shard2/ --logpath /mongo_data/log/shard2.log --fork -port 27022
第二步:
mongo --port 20000 --》MongoDB shell version: 2.6.11 connecting to: 127.0.0.1:20000/test
mongos> use admin --》switched to db admin
db.runCommand({addshard:"192.168.128.5:27021",allowLocal:true})
{ "shardAdded" : "shard0000", "ok" : 1 }
db.runCommand({addshard:"192.168.128.5:27022",allowLocal:true})
{ "shardAdded" : "shard0001", "ok" : 1 }
db.runCommand({addshard:"192.168.128.5:27019",allowLocal:true})
{ "shardAdded" : "shard0002", "ok" : 1 }
db.runCommand({addshard:"192.168.128.5:27020",allowLocal:true})
{ "shardAdded" : "shard0003", "ok" : 1 }
相关文章推荐
- Introduction to Algorithm - Summary of Chapter 2(0) - Getting started
- google git resource
- 主库磁盘满,从库io线程报错Got fatal error 1236 from master when reading data from binary log
- Git Tutorial 1 - Goto Staging Area
- 创建django项目报错:Django not found
- [转]How Hash Algorithms Work
- about golang
- google浙大招聘笔试题
- category extension
- High Performance Django
- go安装windows源码
- webrtc doubango linphone
- 一幅图看看mongondb对企业级数据的管理
- 在线安装 IntelliJ IDEA的 golang 插件
- lightoj 1030 - Discovering Gold 【期望】
- 加密dns配合goXgent
- OC-Category
- Introduction to Algorithm - Summary of Chapter 1 - The Role of Algorithm in Computing
- GoodsCollectionViewCell添加button点击不响应
- google-play-services_lib的应用检查是否有google service