Setup Information
One ConfigServer
mongod.exe --configsvr --dbpath C:\MongoDBCluster\ConfigSrv
--Mongos Server--
mongos.exe --configdb 10.133.1.130)
2 Shard Servers
mongod.exe --shardsvr --dbpath C:\MongoDBcluster\Server2\configdb --port 27020
mongod.exe --shardsvr --dbpath C:\MongoDBcluster\Server3\configdb --port 27021
Configured Sharding using mongos
mongos> sh.status()
--- Sharding Status ---
sharding version: {
"_id" : 1,
"minCompatibleVersion" : 5,
"currentVersion" : 6,
"clusterId" : ObjectId("55dec7d254984cdf812cdf55")
}
shards:
{ "_id" : "shard0000", "host" : "Server1:27020" }
{ "_id" : "shard0001", "host" : "Server2:27021" }
balancer:
Currently enabled: yes
Currently running: no
Failed balancer rounds in last 5 attempts: 0
Migration Results for the last 24 hours:
No recent migrations
databases:
{ "_id" : "admin", "partitioned" : false, "primary" : "config" }
{ "_id" : "demo1", "partitioned" : true, "primary" : "shard0001" }
demo1.demo
shard key: { "_id" : 1 }
chunks:
shard0001 1
{ "_id" : { "$minKey" : 1 } } -->> { "_id" : { "$maxKey" : 1 } } on : shard0001 Timestamp(1, 0)
I have 2 problems
- When i try to check the sharding status from demo1 db on server1 i get below error
use demo1 switched to db demo1 sh.status() printShardingStatus: this db does not have sharding enabled. be sure you are connecting to a mongos from the shell and not to a mongod.
- I have inserted couple of records which did not get replicated to server2. what am i doing wrong?