435243 发表于 2016-7-4 09:59:57

mongodb3.2版本制作集群

在传统的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即可。


页: [1]
查看完整版本: mongodb3.2版本制作集群