我正在尝试部署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 270193)添加碎片(添加碎片的问题)
主节点运行:
sh.addShard("mongodb1.example.net")
sh.addShard("mongodb2.example.net")
sh.addShard("mongodb3.example.net")https://stackoverflow.com/questions/40502307
复制相似问题