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

unrecognized command: setShardVersion

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.0.2
    • Component/s: Shell
    • Labels:
      None
    • Environment:
      Ubunutu 11.10 and 11.4, mongodb version 2.0.2 (all of mongod, mongos, and mongo client). Sharded 3 nodes, no replica sets, 3 config servers
    • Linux

      I just set up a brand new shard cluster and received the following error when trying to create an index on a non-sharded collection. I tried the command multiple times and got the same error, but after I restart the mongo client the command worked.

      ubuntu@mongo1:~/mongodb-linux-x86_64-2.0.2$ bin/mongo
      MongoDB shell version: 2.0.2
      connecting to: test
      mongos> use pb2
      switched to db pb2
      mongos> db.adminCommand(

      {addShard:"mongo1.foobar.com"}

      )

      { "ok" : 0, "errmsg" : "can't add a mongos process as a shard" }

      mongos> db.adminCommand(

      {addShard:"mongo1.foobar.com:27018"}

      )

      { "shardAdded" : "shard0000", "ok" : 1 }

      mongos> db.adminCommand(

      {addShard:"mongo2.foobar.com:27018"}

      )

      { "shardAdded" : "shard0001", "ok" : 1 }

      mongos> db.adminCommand(

      {addShard:"mongo3.foobar.com:27018"}

      )

      { "shardAdded" : "shard0002", "ok" : 1 }

      mongos> db.adminCommand(

      {enablesharding:'pb2'}

      )

      { "ok" : 1 }

      mongos> db.adminCommand(

      {shardcollection:"pb2.hourly_stats"}

      )

      { "ok" : 0, "errmsg" : "no shard key" }

      mongos> db.adminCommand({shardcollection:"pb2.hourly_stats", key:{_id:1}})

      { "collectionsharded" : "pb2.hourly_stats", "ok" : 1 }

      mongos> db.adminCommand({shardcollection:"pb2.aggregated_stats", key:{_id:1}})

      { "collectionsharded" : "pb2.aggregated_stats", "ok" : 1 }

      mongos> show collections
      aggregated_stats
      hourly_stats
      log_files
      system.indexes
      <At this point I run a script which inserts a bunch of objects into the log_files collection, implicitly creating it>
      mongos> db.log_files.ensureIndex(

      {status:1}

      )
      Sat Feb 4 06:07:08 uncaught exception: getlasterror failed: {
      "assertion" : "nextSafe():

      { $err: \"unrecognized command: setShardVersion\", code: 13390 }

      ",
      "assertionCode" : 13106,
      "errmsg" : "db assertion failure",
      "ok" : 0
      }

            Assignee:
            randolph@mongodb.com Randolph Tan
            Reporter:
            zacwitte Zac Witte
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: