`
holoblog
  • 浏览: 1222287 次
博客专栏
E0fcf0b7-6756-3051-9a54-90b4324c9940
SQL Server 20...
浏览量:18866
文章分类
社区版块
存档分类
最新评论

MongoDB(AutoSharding+Replication sets 稳定性测试 )

 
阅读更多

单Replication sets设计:


如图所示,10.9.3.228只启动Mongos和config两个服务


注意:Mongos里面的ip和端口是config服务的ip和端口

先进性配置AutoSharding

163的shardv已经启动了,只要启动下165服务器的autoSharding服务


配置163和164的Replication


至此Replication sets配置成功!


再在228服务器上进行相应Sharding配置

use admin


然后分别在163和164服务器上启动rep服务,163要单独启动shard服务

163:


164:

至此AutoSharding+Rep配置成功。然后进行测试稳定性阶段。

先看下结果:



可以看到,总共插入2000W条数据,163和164相同大小 165属于分片 数据。

我现在进行稳定性测试:

断掉163服务器。

Mongos那再相应进行查询:

直接出现错误!

再进行手动添加164服务器!


还是出错!

可见这样配置是有问题的!

经过一段时间的思考和反复测试,发现是否是投票上除了问题

看到官网上有这样一段话:

Consensus Vote

For a node to be elected primary, it must receive amajorityof votes. This is a majority of all votes in the set: if you have a 5-member set and 4 members are down, a majority of the set is still 3 members (floor(5/2)+1). Each member of the set receives a single vote and knows the total number of available votes.

If no node can reach a majority, then no primary can be elected and no data can be written to that replica set (although reads to secondaries are still possible).

那么2台Server投票是否会出现问题,那再加一台如何?


这边也可以 把164作为 arbiter来 :


228:


经过试验:

稳定性已经提高,断掉162,163,164任意一台Server ,Mongos都能自动reconnect中其中的vote的一个成员primary.

最终设计图:




分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics