Shards Unevenly balanced

50 views
Skip to first unread message

sanmukho

unread,
Feb 23, 2011, 1:33:56 AM2/23/11
to mongodb-user
Hi

My shards are unevenly balanced.
I have 15 Mongod Process and 5 config Servers and divided into 5
cluster each having 3 nodes.

My last shard has only 7 objects wheras others have more than 0.5 -
1.5 million records.
Could anyone help in this regard?

> db.stats()
{
"raw" : {
"sh1/172.16.9.160:20001,172.16.1.125:20001,172.16.17.90:20001" : {
"collections" : 3,
"objects" : 553317,
"avgObjSize" : 235.9986120072219,
"dataSize" : 130582044,
"storageSize" : 141202176,
"numExtents" : 15,
"indexes" : 2,
"indexSize" : 71548928,
"fileSize" : 1006632960,
"ok" : 1
},
"sh2/172.16.9.161:20002,172.16.1.126:20002,172.16.17.91:20002" : {
"collections" : 3,
"objects" : 1659523,
"avgObjSize" : 239.99967219496205,
"dataSize" : 398284976,
"storageSize" : 607055872,
"numExtents" : 22,
"indexes" : 2,
"indexSize" : 286801920,
"fileSize" : 4226809856,
"ok" : 1
},
"sh3/172.16.9.162:20003,172.16.1.127:20003,172.16.17.92:20003" : {
"collections" : 3,
"objects" : 1109270,
"avgObjSize" : 235.999570888963,
"dataSize" : 261787244,
"storageSize" : 334816512,
"numExtents" : 19,
"indexes" : 2,
"indexSize" : 157147136,
"fileSize" : 2080374784,
"ok" : 1
},
"sh4/172.16.9.163:20004,172.16.1.128:20004,172.16.17.93:20004" : {
"collections" : 3,
"objects" : 1109072,
"avgObjSize" : 235.9995527792605,
"dataSize" : 261740496,
"storageSize" : 321297920,
"numExtents" : 16,
"indexes" : 2,
"indexSize" : 188030976,
"fileSize" : 2080374784,
"ok" : 1
},
"sh5/172.16.9.164:20005,172.16.1.129:20005,172.16.17.94:20005" : {
"collections" : 3,
"objects" : 7,
"avgObjSize" : 78.28571428571429,
"dataSize" : 548,
"storageSize" : 19456,
"numExtents" : 3,
"indexes" : 2,
"indexSize" : 16384,
"fileSize" : 201326592,
"ok" : 1
}
},
"objects" : 4431189,
"avgObjSize" : 237.49727398222012,
"dataSize" : 1052395308,
"storageSize" : 1404391936,
"numExtents" : 75,
"indexes" : 10,
"indexSize" : 703545344,
"fileSize" : 9595518976,
"ok" : 1
}

Regards
Sandy

Nat

unread,
Feb 23, 2011, 1:56:15 AM2/23/11
to mongod...@googlegroups.com
What is your shard key? Any error in mongos log?
--
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To post to this group, send email to mongod...@googlegroups.com.
To unsubscribe from this group, send email to mongodb-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/mongodb-user?hl=en.

sanmukho

unread,
Feb 23, 2011, 2:24:28 AM2/23/11
to mongodb-user

db.runCommand( { shardcollection : "aud.user", key : { uid : 1 } });
where uid is unique.

Thanks
Sandy

Nat

unread,
Feb 23, 2011, 2:32:29 AM2/23/11
to mongodb-user
What is your chunk size? Based on the stats you have, it looks like
you haven't hit 8 chunks. db.chunks.find() on config db can confirm
that.

http://www.mongodb.org/display/DOCS/Sharding+Administration#ShardingAdministration-Balancing

Eliot Horowitz

unread,
Feb 23, 2011, 5:16:11 AM2/23/11
to mongod...@googlegroups.com
What version are you running and can you send db.printShardingStatus()

sanmukho

unread,
Feb 24, 2011, 9:41:55 AM2/24/11
to mongodb-user, sandee...@gmail.com
Eliot

We are using MongoDB 1.6.5

Output of db.printShardingStatus()

> db.printShardingStatus()
--- Sharding Status ---
sharding version: { "_id" : 1, "version" : 3 }
shards:
{
"_id" : "shard1",
"host" :
"sh1/172.16.9.160:20001,172.16.1.125:20001,172.16.17.90:20001"
}
{
"_id" : "shard2",
"host" :
"sh2/172.16.9.161:20002,172.16.1.126:20002,172.16.17.91:20002"
}
{
"_id" : "shard3",
"host" :
"sh3/172.16.9.162:20003,172.16.1.127:20003,172.16.17.92:20003"
}
{
"_id" : "shard4",
"host" :
"sh4/172.16.9.163:20004,172.16.1.128:20004,172.16.17.93:20004"
}
{
"_id" : "shard5",
"host" :
"sh5/172.16.9.164:20005,172.16.1.129:20005,172.16.17.94:20005"
}
databases:
{ "_id" : "admin", "partitioned" : false, "primary" : "config" }
{ "_id" : "test", "partitioned" : true, "primary" : "shard1" }
test.foo chunks:
{ "uid" : { $minKey : 1 } } -->> { "uid" : "1" } on : shard1
{ "t" : 29000, "i" : 0 }
{ "uid" : "1" } -->> { "uid" : "pm1234567890_aa10292557" } on :
shard2 { "t" : 30000, "i" : 0 }
{ "uid" : "pm1234567890_aa10292557" } -->> { "uid" :
"pm1234567890_aa10609877" } on : shard5 { "t" : 5000, "i" : 0 }
{ "uid" : "pm1234567890_aa10609877" } -->> { "uid" :
"pm1234567890_aa10935075" } on : shard5 { "t" : 31000, "i" : 0 }
{ "uid" : "pm1234567890_aa10935075" } -->> { "uid" :
"pm1234567890_aa1150015" } on : shard1 { "t" : 32000, "i" : 0 }
{ "uid" : "pm1234567890_aa1150015" } -->> { "uid" :
"pm1234567890_aa1313289" } on : shard5 { "t" : 9000, "i" : 0 }
{ "uid" : "pm1234567890_aa1313289" } -->> { "uid" :
"pm1234567890_aa13437640" } on : shard3 { "t" : 28000, "i" : 2 }
{ "uid" : "pm1234567890_aa13437640" } -->> { "uid" :
"pm1234567890_aa13756555" } on : shard3 { "t" : 28000, "i" : 4 }
{ "uid" : "pm1234567890_aa13756555" } -->> { "uid" :
"pm1234567890_aa1408255" } on : shard3 { "t" : 28000, "i" : 6 }
{ "uid" : "pm1234567890_aa1408255" } -->> { "uid" :
"pm1234567890_aa14412086" } on : shard3 { "t" : 28000, "i" : 8 }
{ "uid" : "pm1234567890_aa14412086" } -->> { "uid" :
"pm1234567890_aa1478689" } on : shard3 { "t" : 31000, "i" : 1 }
{ "uid" : "pm1234567890_aa1478689" } -->> { "uid" :
"pm1234567890_aa1509217" } on : shard4 { "t" : 28000, "i" : 10 }
{ "uid" : "pm1234567890_aa1509217" } -->> { "uid" :
"pm1234567890_aa15411349" } on : shard4 { "t" : 28000, "i" : 12 }
{ "uid" : "pm1234567890_aa15411349" } -->> { "uid" :
"pm1234567890_aa15737479" } on : shard4 { "t" : 28000, "i" : 14 }
{ "uid" : "pm1234567890_aa15737479" } -->> { "uid" :
"pm1234567890_aa16067081" } on : shard4 { "t" : 28000, "i" : 16 }
{ "uid" : "pm1234567890_aa16067081" } -->> { "uid" :
"pm1234567890_aa1645149" } on : shard4 { "t" : 32000, "i" : 1 }
{ "uid" : "pm1234567890_aa1645149" } -->> { "uid" :
"pm1234567890_aa16779337" } on : shard5 { "t" : 28000, "i" : 18 }
{ "uid" : "pm1234567890_aa16779337" } -->> { "uid" :
"pm1234567890_aa185674" } on : shard5 { "t" : 28000, "i" : 19 }
{ "uid" : "pm1234567890_aa185674" } -->> { "uid" :
"pm1234567890_aa2006133" } on : shard3 { "t" : 15000, "i" : 0 }
{ "uid" : "pm1234567890_aa2006133" } -->> { "uid" :
"pm1234567890_aa2164594" } on : shard4 { "t" : 16000, "i" : 0 }
{ "uid" : "pm1234567890_aa2164594" } -->> { "uid" :
"pm1234567890_aa2327586" } on : shard5 { "t" : 17000, "i" : 0 }
{ "uid" : "pm1234567890_aa2327586" } -->> { "uid" :
"pm1234567890_aa261099" } on : shard3 { "t" : 19000, "i" : 0 }
{ "uid" : "pm1234567890_aa261099" } -->> { "uid" :
"pm1234567890_aa2762594" } on : shard4 { "t" : 20000, "i" : 0 }
{ "uid" : "pm1234567890_aa2762594" } -->> { "uid" :
"pm1234567890_aa2922158" } on : shard5 { "t" : 21000, "i" : 0 }
{ "uid" : "pm1234567890_aa2922158" } -->> { "uid" :
"pm1234567890_aa340942" } on : shard3 { "t" : 23000, "i" : 0 }
{ "uid" : "pm1234567890_aa340942" } -->> { "uid" :
"pm1234567890_aa3729654" } on : shard4 { "t" : 24000, "i" : 0 }
{ "uid" : "pm1234567890_aa3729654" } -->> { "uid" :
"pm1234567890_aa422996" } on : shard5 { "t" : 25000, "i" : 0 }
{ "uid" : "pm1234567890_aa422996" } -->> { "uid" :
"pm1234567890_aa4550744" } on : shard3 { "t" : 27000, "i" : 0 }
{ "uid" : "pm1234567890_aa4550744" } -->> { "uid" :
"pm1234567890_aa506152" } on : shard4 { "t" : 28000, "i" : 0 }
{ "uid" : "pm1234567890_aa506152" } -->> { "uid" :
"pm1234567890_aa5382582" } on : shard1 { "t" : 2000, "i" : 40 }
{ "uid" : "pm1234567890_aa5382582" } -->> { "uid" :
"pm1234567890_aa589863" } on : shard1 { "t" : 2000, "i" : 41 }
{ "uid" : "pm1234567890_aa589863" } -->> { "uid" :
"pm1234567890_aa6219828" } on : shard1 { "t" : 2000, "i" : 42 }
{ "uid" : "pm1234567890_aa6219828" } -->> { "uid" :
"pm1234567890_aa673848" } on : shard1 { "t" : 2000, "i" : 43 }
{ "uid" : "pm1234567890_aa673848" } -->> { "uid" :
"pm1234567890_aa7039014" } on : shard1 { "t" : 2000, "i" : 44 }
{ "uid" : "pm1234567890_aa7039014" } -->> { "uid" :
"pm1234567890_aa7356808" } on : shard1 { "t" : 2000, "i" : 46 }
{ "uid" : "pm1234567890_aa7356808" } -->> { "uid" :
"pm1234567890_aa7683228" } on : shard1 { "t" : 28000, "i" : 1 }
{ "uid" : "pm1234567890_aa7683228" } -->> { "uid" :
"pm1234567890_aa82819" } on : shard2 { "t" : 26000, "i" : 0 }
{ "uid" : "pm1234567890_aa82819" } -->> { "uid" :
"pm1234567890_aa8582488" } on : shard2 { "t" : 22000, "i" : 0 }
{ "uid" : "pm1234567890_aa8582488" } -->> { "uid" :
"pm1234567890_aa8900304" } on : shard2 { "t" : 18000, "i" : 0 }
{ "uid" : "pm1234567890_aa8900304" } -->> { "uid" :
"pm1234567890_aa9226739" } on : shard2 { "t" : 14000, "i" : 0 }
{ "uid" : "pm1234567890_aa9226739" } -->> { "uid" :
"pm1234567890_aa9557480" } on : shard2 { "t" : 10000, "i" : 0 }
{ "uid" : "pm1234567890_aa9557480" } -->> { "uid" :
"pm1234567890_aa99999" } on : shard2 { "t" : 6000, "i" : 0 }
{ "uid" : "pm1234567890_aa99999" } -->> { "uid" : { $maxKey : 1 } }
on : shard2 { "t" : 2000, "i" : 0 }
{ "_id" : "aud1", "partitioned" : true, "primary" : "shard3" }
aud1.user1 chunks:
{ "uid" : { $minKey : 1 } } -->> { "uid" : { $maxKey : 1 } } on :
shard3 { "t" : 1000, "i" : 0 }
aud.user chunks:
{ "uid" : { $minKey : 1 } } -->> { "uid" : "00000813-feb4-4956-
a01f-7f478002ff97" } on : shard1 { "t" : 3000, "i" : 0 }
{ "uid" : "00000813-feb4-4956-a01f-7f478002ff97" } -->> { "uid" :
"10048385-6c8f-492a-8b41-bda4d0d0294d" } on : shard3 { "t" : 8000,
"i" : 8 }
{ "uid" : "10048385-6c8f-492a-8b41-bda4d0d0294d" } -->> { "uid" :
"20151054-6453-42ff-bf18-f81202938109" } on : shard3 { "t" : 8000,
"i" : 9 }
{ "uid" : "20151054-6453-42ff-bf18-f81202938109" } -->> { "uid" :
"3012c32e-568d-4512-937d-cead840ffe0e" } on : shard4 { "t" : 8000,
"i" : 10 }
{ "uid" : "3012c32e-568d-4512-937d-cead840ffe0e" } -->> { "uid" :
"4026f21c-36ec-48b5-ae26-75e8fae76277" } on : shard4 { "t" : 8000,
"i" : 11 }
{ "uid" : "4026f21c-36ec-48b5-ae26-75e8fae76277" } -->> { "uid" :
"502599a0-b019-47ac-9c63-d23b808cfd1c" } on : shard1 { "t" : 8000,
"i" : 12 }
{ "uid" : "502599a0-b019-47ac-9c63-d23b808cfd1c" } -->> { "uid" :
"601d0852-65a9-4f9e-a2cd-17076981c052" } on : shard1 { "t" : 8000,
"i" : 13 }
{ "uid" : "601d0852-65a9-4f9e-a2cd-17076981c052" } -->> { "uid" :
"701fd721-034a-4ddd-b5ef-0dced312cfaf" } on : shard3 { "t" : 8000,
"i" : 6 }
{ "uid" : "701fd721-034a-4ddd-b5ef-0dced312cfaf" } -->> { "uid" :
"801b5a32-9ea3-420b-a669-94fe0c766288" } on : shard3 { "t" : 8000,
"i" : 7 }
{ "uid" : "801b5a32-9ea3-420b-a669-94fe0c766288" } -->> { "uid" :
"9013aae9-e120-474d-af2b-19b57e1d2688" } on : shard4 { "t" : 8000,
"i" : 4 }
{ "uid" : "9013aae9-e120-474d-af2b-19b57e1d2688" } -->> { "uid" :
"a00f78e0-ec7a-42fd-836c-2dd6dbf8fc6b" } on : shard4 { "t" : 8000,
"i" : 5 }
{ "uid" : "a00f78e0-ec7a-42fd-836c-2dd6dbf8fc6b" } -->> { "uid" :
"b004af1b-4535-47d9-86ac-b7581f8b3b21" } on : shard2 { "t" : 8000,
"i" : 14 }
{ "uid" : "b004af1b-4535-47d9-86ac-b7581f8b3b21" } -->> { "uid" :
"bffc2cd8-f102-4da3-bb8c-f37c601aa78d" } on : shard2 { "t" : 8000,
"i" : 15 }
{ "uid" : "bffc2cd8-f102-4da3-bb8c-f37c601aa78d" } -->> { "uid" :
"cffe80f5-e21b-467f-a6e5-ab8c95b43754" } on : shard2 { "t" : 8000,
"i" : 16 }
{ "uid" : "cffe80f5-e21b-467f-a6e5-ab8c95b43754" } -->> { "uid" :
"dffc4aa3-936c-4305-b89f-e4f9230efb57" } on : shard2 { "t" : 8000,
"i" : 17 }
{ "uid" : "dffc4aa3-936c-4305-b89f-e4f9230efb57" } -->> { "uid" :
"f001e7a9-1a0f-4612-b31a-598209487022" } on : shard2 { "t" : 8000,
"i" : 2 }
{ "uid" : "f001e7a9-1a0f-4612-b31a-598209487022" } -->> { "uid" :
"test_user" } on : shard2 { "t" : 8000, "i" : 3 }
{ "uid" : "test_user" } -->> { "uid" : { $maxKey : 1 } } on :
shard5 { "t" : 2000, "i" : 0 }
{ "_id" : "local", "partitioned" : false, "primary" : "shard2" }
{ "_id" : "aud", "partitioned" : true, "primary" : "shard2" }
aud.user chunks:
{ "uid" : { $minKey : 1 } } -->> { "uid" : "00000813-feb4-4956-
a01f-7f478002ff97" } on : shard1 { "t" : 3000, "i" : 0 }
{ "uid" : "00000813-feb4-4956-a01f-7f478002ff97" } -->> { "uid" :
"10048385-6c8f-492a-8b41-bda4d0d0294d" } on : shard3 { "t" : 8000,
"i" : 8 }
{ "uid" : "10048385-6c8f-492a-8b41-bda4d0d0294d" } -->> { "uid" :
"20151054-6453-42ff-bf18-f81202938109" } on : shard3 { "t" : 8000,
"i" : 9 }
{ "uid" : "20151054-6453-42ff-bf18-f81202938109" } -->> { "uid" :
"3012c32e-568d-4512-937d-cead840ffe0e" } on : shard4 { "t" : 8000,
"i" : 10 }
{ "uid" : "3012c32e-568d-4512-937d-cead840ffe0e" } -->> { "uid" :
"4026f21c-36ec-48b5-ae26-75e8fae76277" } on : shard4 { "t" : 8000,
"i" : 11 }
{ "uid" : "4026f21c-36ec-48b5-ae26-75e8fae76277" } -->> { "uid" :
"502599a0-b019-47ac-9c63-d23b808cfd1c" } on : shard1 { "t" : 8000,
"i" : 12 }
{ "uid" : "502599a0-b019-47ac-9c63-d23b808cfd1c" } -->> { "uid" :
"601d0852-65a9-4f9e-a2cd-17076981c052" } on : shard1 { "t" : 8000,
"i" : 13 }
{ "uid" : "601d0852-65a9-4f9e-a2cd-17076981c052" } -->> { "uid" :
"701fd721-034a-4ddd-b5ef-0dced312cfaf" } on : shard3 { "t" : 8000,
"i" : 6 }
{ "uid" : "701fd721-034a-4ddd-b5ef-0dced312cfaf" } -->> { "uid" :
"801b5a32-9ea3-420b-a669-94fe0c766288" } on : shard3 { "t" : 8000,
"i" : 7 }
{ "uid" : "801b5a32-9ea3-420b-a669-94fe0c766288" } -->> { "uid" :
"9013aae9-e120-474d-af2b-19b57e1d2688" } on : shard4 { "t" : 8000,
"i" : 4 }
{ "uid" : "9013aae9-e120-474d-af2b-19b57e1d2688" } -->> { "uid" :
"a00f78e0-ec7a-42fd-836c-2dd6dbf8fc6b" } on : shard4 { "t" : 8000,
"i" : 5 }
{ "uid" : "a00f78e0-ec7a-42fd-836c-2dd6dbf8fc6b" } -->> { "uid" :
"b004af1b-4535-47d9-86ac-b7581f8b3b21" } on : shard2 { "t" : 8000,
"i" : 14 }
{ "uid" : "b004af1b-4535-47d9-86ac-b7581f8b3b21" } -->> { "uid" :
"bffc2cd8-f102-4da3-bb8c-f37c601aa78d" } on : shard2 { "t" : 8000,
"i" : 15 }
{ "uid" : "bffc2cd8-f102-4da3-bb8c-f37c601aa78d" } -->> { "uid" :
"cffe80f5-e21b-467f-a6e5-ab8c95b43754" } on : shard2 { "t" : 8000,
"i" : 16 }
{ "uid" : "cffe80f5-e21b-467f-a6e5-ab8c95b43754" } -->> { "uid" :
"dffc4aa3-936c-4305-b89f-e4f9230efb57" } on : shard2 { "t" : 8000,
"i" : 17 }
{ "uid" : "dffc4aa3-936c-4305-b89f-e4f9230efb57" } -->> { "uid" :
"f001e7a9-1a0f-4612-b31a-598209487022" } on : shard2 { "t" : 8000,
"i" : 2 }
{ "uid" : "f001e7a9-1a0f-4612-b31a-598209487022" } -->> { "uid" :
"test_user" } on : shard2 { "t" : 8000, "i" : 3 }
{ "uid" : "test_user" } -->> { "uid" : { $maxKey : 1 } } on :
shard5 { "t" : 2000, "i" : 0 }
{ "_id" : "config'", "partitioned" : false, "primary" : "shard3" }
>

Regards
Sandy

sanmukho

unread,
Feb 24, 2011, 10:02:45 AM2/24/11
to mongodb-user
Nat

my chunk size is 200 MB(Default) and there are 62 records in
db.chunks.find(). I could not fetch all records so would need specific
query.

Thanks
Sandy
> "i" ...
>
> read more »

Eliot Horowitz

unread,
Feb 24, 2011, 11:08:54 AM2/24/11
to mongod...@googlegroups.com
Looks like there just aren't enough chunks.
You can try making the chunk size smaller or using 1.8.0-rc0 which
defaults to smaller.

sanmukho

unread,
Mar 1, 2011, 11:13:38 AM3/1/11
to mongodb-user
Eliot

I changed chunk size to 64 MB in my current setup however sharding
issue remains unsolved.
I connected to Mongo Config and changed chunk size. Is it rt way to
change chunk size?

Thanks,
Sandeep Mukhopadhyay
> ...
>
> read more »

Eliot Horowitz

unread,
Mar 1, 2011, 2:15:46 PM3/1/11
to mongod...@googlegroups.com
You should the --chunkSize option on mongos

Reply all
Reply to author
Forward
0 new messages