MongoDB 3分片部署及故障模拟验证(2)

> db.runCommand({"replSetInitiate" : { "_id" : "hnrconfig" ,"members" : [ { "_id" : 1, "host" : "192.168.115.11:10000"},{ "_id" : 2, "host" : "192.168.115.12:10000"},{"_id" : 3, "host" : "192.168.115.11:10001"}]}})

8.启动mongos服务,此时没有任何数据

MongoDB 3分片部署及故障模拟验证

9.导入备份的config数据

/usr/local/mongodb/bin/mongorestore -h 192.168.115.11:10000 -d config configdata/config/

在mongos查询,但是查询数据会出现超时,数据无法查询

MongoDB 3分片部署及故障模拟验证

10.在mongos执行如下命令

mongos> sh.enableSharding("shardtest")

{ "ok" : 0, "errmsg" : "Operation timed out", "code" : 50 }

mongos日志

2016-11-17T14:46:21.197+0800 I SHARDING [Balancer] about to log metadata event into actionlog: { _id: "node1.hnr.com-2016-11-17T14:46:21.197+0800-582d523ded1c4b679a84877b", server: "node1.hnr.com", clientAddr: "", time: new Date(1479365181197), what: "balancer.round", ns: "", details: { executionTimeMillis: 30007, errorOccured: true, errmsg: "could not get updated shard list from config server due to ExceededTimeLimit Operation timed out" } }

官网上说是bug,恢复失败

https://jira.mongodb.org/browse/SERVER-22392

更多MongoDB相关教程见以下内容

CentOS 编译安装 MongoDB与mongoDB的php扩展

CentOS 6 使用 yum 安装MongoDB及服务器端配置

Ubuntu 13.04下安装MongoDB2.4.3

MongoDB入门必读(概念与实战并重)

Ubunu 14.04下MongoDB的安装指南

《MongoDB 权威指南》(MongoDB: The Definitive Guide)英文文字版[PDF]

Nagios监控MongoDB分片集群服务实战

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/05d4b0741ce742ba0d314ae485597ce8.html