MongoDB搭建cluster

来源:未知 责任编辑:责任编辑 发表时间:2013-11-18 20:57 点击:

配置两个shard
 
Java代码  
mongod.exe --shardsvr --dbpath D:\temp\cluster\shard11 --replSet shard1 --port 27017 --oplogSize 100 --logpath D:\temp\cluster\shard11\shard11.log --logappend  
mongod.exe --shardsvr --dbpath D:\temp\cluster\shard12 --replSet shard1 --port 27017 --oplogSize 100 --logpath D:\temp\cluster\shard12\shard12.log --logappend  
mongod.exe --shardsvr --dbpath D:\temp\cluster\shard13 --replSet shard1 --port 27017 --oplogSize 100 --logpath D:\temp\cluster\shard13\shard13.log --logappend  
mongo.exe localhost:27017   www.2cto.com   
config = {_id: 'shard1', members: [  
                          {_id: 0, host: 'hostname1:27017'},  
                          {_id: 1, host: 'hostname2:27017'},  
                          {_id: 2, host: 'hostname3:27017'}]  
           }  
             
rs.initiate(config);  
  
  
mongod.exe --shardsvr --dbpath D:\temp\cluster\shard21 --replSet shard2 --port 27018 --oplogSize 100 --logpath D:\temp\cluster\shard21\shard21.log --logappend  
mongod.exe --shardsvr --dbpath D:\temp\cluster\shard22 --replSet shard2 --port 27018 --oplogSize 100 --logpath D:\temp\cluster\shard22\shard22.log --logappend  
mongod.exe --shardsvr --dbpath D:\temp\cluster\shard23 --replSet shard2 --port 27018 --oplogSize 100 --logpath D:\temp\cluster\shard23\shard23.log --logappend  
mongo.exe localhost:27018  www.2cto.com    
config = {_id: 'shard2', members: [  
                          {_id: 0, host: 'hostname1:27018'},  
                          {_id: 1, host: 'hostname2:27018'},  
                          {_id: 2, host: 'hostname3:27018'}]  
           }  
             
rs.initiate(config);  
 
2 配置config server
 
Java代码  
mongod.exe --configsvr --dbpath D:\temp\cluster\config --port 20000 --oplogSize 100 --logpath D:\temp\cluster\config\config.log --logappend  
mongod.exe --configsvr --dbpath D:\temp\cluster\config --port 20000 --oplogSize 100 --logpath D:\temp\cluster\config\config.log --logappend  
发表评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
用户名: 验证码:点击我更换图片
最新评论 更多>>

推荐热点

  • Request.ServerVariables 参数大全
  • 执行全文索引时出现权限不足的解决方法
  • 导入excel文件处理流程节点的解决方案
  • 查看sql修改痕迹(SQL Change Tracking on Table)
  • App数据层设计及云存储使用指南
  • PostgreSQL启动过程中的那些事三:加载GUC参数
  • MongoDB安装为Windows服务方法与注意事项
  • Percolator与分布式事务思考(二)
  • 写给MongoDB开发者的50条建议Tip1
网站首页 - 友情链接 - 网站地图 - TAG标签 - RSS订阅 - 内容搜索
Copyright © 2008-2015 计算机技术学习交流网. 版权所有

豫ICP备11007008号-1