I have setting-up mongodb 3.2 cluster as below configuration on my debian machines
# 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
and run mongos to add shard on query router server
$)mongos --configdb mongo-config:27019
but I can't add shard.
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 Command.
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
}
here is mongos log
2016-04-06T15:05:14.243+0000 I SHARDING [Balancer] about to log metadata event into actionlog: { _id: "mongo-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: "could not get updated shard list from config server due to Surprised to discover that mongo-db1:27017 does not believe it is a config server" } }
what I'm missing .?