Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-523

Can't get serverStatus from a mongod server in sharded cluster with authentication enabled

      I set up a sharded cluster with every mongod process started with "--keyFile" option.

      mongos: port 27017
      config: port 27019
      mongod: shard1 primary port 27200
      mongod: shard1 secondary port 27201
      mongod: shard2 primary port 27202
      mongod: shard2 secondary port 27203

      then, I found I can't connect to mongod and get the serverStatus via java-driver.

      my code is like this:

      Mongo mongo = new Mongo("localhost", 27200);
      DB testDB = mongo.getDB("test");
      CommandResult resp = testDB.command("serverStatus");
      System.out.println(resp);

      the result is :

      { "serverUsed" : "localhost:27200" , "errmsg" : "need to login" , "ok" : 0.0}

      but if I run 'mongo' in my console to connect to localhost:27200, I can get the serverStatus result without authentication.

            Assignee:
            jeff.yemin@mongodb.com Jeffrey Yemin
            Reporter:
            tianyi Yi Tian
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: