当前位置:Gxlcms > 数据库问题 > mongodb3.2版本制作集群

mongodb3.2版本制作集群

时间:2021-07-01 10:21:17 帮助过:36人阅读

在传统的mongoDB集群中,configserver使用的是mirror的方式,在其宕机后,则需要重启所有集群成员来链接镜像configserver。在新版本3.2中,configserver支持复制集模式,避免了上述问题的发生。

搭建集群时,shard的搭建方式和传统的完全一样,不同的是mongos和configserver的配置:

configserver:

启动config:mongod --configsvr --replSet configReplSet --port 20000 --dbpath data/config

初始化:rs.initiate(

 {_id: "configReplSet",

configsvr: true,

members: [

{ _id: 0, host: "<host1>:<port1>" },

{ _id: 1, host: "<host2>:<port2>" },

{ _id: 2, host: "<host3>:<port3>" }

]

}

)

mongos:

mongos --configdb configReplSet/<cfgsvr1:port1>,<cfgsvr2:port2>,<cfgsvr3:port3>

按照上面的方式配置mongos和configserver,然后把shard添加到mongos即可。


本文出自 “黑色时间” 博客,请务必保留此出处http://blacktime.blog.51cto.com/11722918/1795305

mongodb3.2版本制作集群

标签:mongo3.2   集群   

人气教程排行