Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-14968

sh.status(): order shards for sharded collections stats

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 2.7.2
    • Affects Version/s: 2.6.4
    • Component/s: Sharding, Usability

      Currently sh.status() outputs shards (along with chunk counts) for each sharded collection in what appears to be a random order. In environments with 20+ shards and similar shard names (e.g. shard-xxx) it's really hard to locate a particular shard there to check how many chunks does it have.

      --- Sharding Status ---
        sharding version: { "_id" : 1, "version" : 3 }
        shards:
          {  "_id" : "shard0000",  "host" : "m0.example.net:30001" }
          {  "_id" : "shard0001",  "host" : "m3.example2.net:50000" }
        databases:
          {  "_id" : "admin",  "partitioned" : false,  "primary" : "config" }
          {  "_id" : "contacts",  "partitioned" : true,  "primary" : "shard0000" }
              foo.contacts
                  shard key: { "zip" : 1 }
                  chunks:
                      shard0001    2
                      shard0002    3
                      shard0000    2
                  { "zip" : { "$minKey" : 1 } } -->> { "zip" : "56000" } on : shard0001 { "t" : 2, "i" : 0 }
                  { "zip" : 56000 } -->> { "zip" : "56800" } on : shard0002 { "t" : 3, "i" : 4 }
                  { "zip" : 56800 } -->> { "zip" : "57088" } on : shard0002 { "t" : 4, "i" : 2 }
                  { "zip" : 57088 } -->> { "zip" : "57500" } on : shard0002 { "t" : 4, "i" : 3 }
                  { "zip" : 57500 } -->> { "zip" : "58140" } on : shard0001 { "t" : 4, "i" : 0 }
                  { "zip" : 58140 } -->> { "zip" : "59000" } on : shard0000 { "t" : 4, "i" : 1 }
                  { "zip" : 59000 } -->> { "zip" : { "$maxKey" : 1 } } on : shard0000 { "t" : 3, "i" : 3 }
          {  "_id" : "test",  "partitioned" : false,  "primary" : "shard0000" }
      

      It will be very useful to order shards by name (lex).

            Assignee:
            greg_10gen Greg Studer
            Reporter:
            alex.komyagin@mongodb.com Alexander Komyagin (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: