[英]Unable to addShard in MongoDB
我正在尝试部署mongodb分片。 我已经在三台机器上部署了一个副本集。 但是,当我尝试对所有三个节点都使用sh.addShard("test/mongodb1.example.net:27017")
时,似乎仍然无法正常工作。 显示的错误是:
2016-11-09T16:02:46.704+0800 W NETWORK [conn105] No primary detected for set team3
另一个错误:
{
"ok" : 0,
"errmsg" : "could not find host matching read preference { mode: \"primary\" } for set test",
"code" : 133
}
1)为每个节点设置初始副本集(可以正常工作)
a)对所有3个节点运行以下命令:
mkdir /temp/data/team3
./mongod --replSet "team3" --dbpath /temp/data/team3
./mongo --host <mongodb[x].example.net>
b)主节点运行:
rs.initiate()
rs.add("mongodb2.example.net")
rs.add("mongodb3.example.net")
2)为三个副本群集设置配置服务器和查询路由器(可以正常工作)
主节点运行:
mkdir /temp/data/config_rs
./mongod --configsvr --replSet "config_rs" --dbpath /temp/data/config_rs
./mongo --host mongodb1.example.net --port 27019
3)添加分片(添加分片的问题)
主节点运行:
sh.addShard("mongodb1.example.net")
sh.addShard("mongodb2.example.net")
sh.addShard("mongodb3.example.net")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.