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

Allow localhost in replicaset addshard if all setting is localhost only

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 1.6.2, 1.7.0
    • Affects Version/s: None
    • Component/s: None
    • None
    • ALL

      -----------------------------------------------
      MongoDB shell version: 1.6.0
      Linux local 2.6.31-20-generic #58-Ubuntu SMP Fri Mar 12 04:38:19 UTC
      2010 x86_64 GNU/Linux

      ./bin/mongod --noprealloc -vvvvv --rest --replSet rep0/localhost:10001
      --shardsvr --dbpath ./db/dbshard.0/rep0 --port 10000
      ./bin/mongod --noprealloc -vvvvv --rest --replSet rep0/localhost:10000
      --shardsvr --dbpath ./db/dbshard.0/rep1 --port 10001
      ./bin/mongod --noprealloc -vvvvv --rest --replSet rep1/localhost:10011
      --shardsvr --dbpath ./db/dbshard.1/rep0 --port 10010
      ./bin/mongod --noprealloc -vvvvv --rest --replSet rep1/localhost:10010
      --shardsvr --dbpath ./db/dbshard.1/rep1 --port 10011

      ./bin/mongod --noprealloc -vvvvv --configsvr --dbpath ./db/config –
      port 20000
      ./bin/mongos -vvvvv --configdb localhost:20000 --chunkSize 11
      ===============
      ./bin/mongo localhost:10000

      config = {_id: 'rep0', members: [
      {_id: 0, host: 'localhost:10000'},
      {_id: 1, host: 'localhost:10001'}]
      }
      rs.initiate(config);

      ./bin/mongo localhost:10010

      config = {_id: 'rep1', members: [
      {_id: 0, host: 'localhost:10010'},
      {_id: 1, host: 'localhost:10011'}]
      }
      rs.initiate(config);
      ========================

      ./bin/mongo
      use admin
      switched to db admin
      > db.runCommand(

      { addshard : "rep0/localhost:10000,localhost:10001", allowLocal:1,maxSize:11 }

      );
      {
      "ok" : 0,
      "errmsg" : "can't use localhost as a shard since all shards
      need to
      communicate. either use all shards and configdbs in localhost or all
      in actual IPs "
      }

            Assignee:
            alerner Alberto Lerner
            Reporter:
            alerner Alberto Lerner
            Votes:
            1 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: