我已經設置向上的MongoDB集羣3.2如下配置上我的Debian機器如何在MongoDB羣集中添加分片?
# Config Server - mongod.conf
storage:
dbPath: /data/mongodb
journal:
enabled: true
systemLog:
destination: file
logAppend: true
path: /var/log/mongodb/mongod.log
net:
port: 27019
bindIp: 0.0.0.0
replication:
replSetName: rs0
sharding:
clusterRole: "configsvr"
# Shard Server 1 - mongod.conf
storage:
dbPath: /data/mongodb
journal:
enabled: true
systemLog:
destination: file
logAppend: true
path: /var/log/mongodb/mongod.log
net:
port: 27017
bindIp: 0.0.0.0
replication:
replSetName: rs0
# Shard Server 2 - mongod.conf
storage:
dbPath: /data/mongodb
journal:
enabled: true
systemLog:
destination: file
logAppend: true
path: /var/log/mongodb/mongod.log
net:
port: 27017
bindIp: 0.0.0.0
replication:
replSetName: rs0
和運行mongos到查詢路由器服務器
$)mongos --configdb蒙戈,配置上增加碎片:27019
但我不能添加分片。
mongos> sh.addShard("rs0/mongo-db1:27017")
{
"ok" : 0,
"errmsg" : "Cannot add rs0/mongo-db1:27017 as a shard since it is part of a config server replica set",
"code" : 96
}
mongos> sh.addShard("rs0/mongo-db1:27017")
{
"ok" : 0,
"errmsg" : "Surprised to discover that mongo-db1:27017 does not believe it is a config server",
"code" : 72
}
getSharmap命令。
mongos> db.runCommand("getShardMap");
{
"map" : {
"config" : "rs0/mongo-db1:27017,mongo-db2:27017",
"mongo-db1:27017" : "rs0/mongo-db1:27017,mongo-db2:27017",
"mongo-db2:27017" : "rs0/mongo-db1:27017,mongo-db2:27017",
"rs0/mongo-config:27019" : "rs0/mongo-config:27019",
"rs0/mongo-db1:27017,mongo-db2:27017" : "rs0/mongo-db1:27017,mongo-db2:27017"
},
"ok" : 1
}
這裏是mongos登錄
2016-04-06T15:05:14.243 + 0000我拆分[平衡器]即將元數據事件登錄到actionlog:{_id:「蒙戈-router1-2016-04 -06T15:05:14.243 + 0000-570525aa6b2b3378bb9daf56「,server:」mongo-router1「,clientAddr:」「,time:new Date(1459955114243),what:」balancer.round「,ns:」「,details:{executionTimeMillis :3,errorOccured:true,errmsg:「由於驚訝發現mongo-db1:27017不相信它是配置服務器,因此無法從配置服務器獲取更新的分片列表」}}
我失蹤。?