title: MongoDB: can't shard on localhost because of shard socket exception
body: <p>I'm trying the MongoDB's <a href="http://docs.mongodb.org/manual/tutorial/deploy-shard-cluster/" rel="nofollow">shard tutorial</a>, for some simple testing (proof-of-concept project).</p>
  
  <p>I want to try sharding on a single machine. Is this possible and/or does it make any sense?</p>
  
  <p>When I follow the guide steps, it does not work.</p>
  
  <p>First, I start the mongod configsrv database instances on my machine:</p>
  
  <pre><code>bin/mongod --configsvr --dbpath $BASEDIR/data/configdb --port 27019 &amp;
  bin/mongod --configsvr --dbpath $BASEDIR/data/configdb1 --port 27020 &amp;
  bin/mongod --configsvr --dbpath $BASEDIR/data/configdb2 --port 27021 &amp;
  </code></pre>
  
  <p>Then, I start the mongos instances so that they "bind" to the config servers:</p>
  
  <pre><code>HOST=$(uname -n) # my machine's name
  # starts on default poort 27017
  bin/mongos --configdb $HOST:27019,$HOST:27020,$HOST:27021 
  </code></pre>
  
  <p>Until here, everything looks good.</p>
  
  <p>Now I want to add a Shard to the cluster:</p>
  
  <pre><code>bin/mongo --host $(uname -n)
  </code></pre>
  
  <p>It enters the MongoDB shell.</p>
  
  <blockquote>
    <p>connecting to: my.machine.name:27017/test</p>
  </blockquote>
  
  <p>But when I try to add a new shard, I have the following error:</p>
  
  <pre><code>mongos&gt; sh.addShard( "rs1/my.machine.name:27017" )
  {
      "ok" : 0,
      "errmsg" : "couldn't connect to new shard socket exception [CONNECT_ERROR] for rs1/my.machine.name:27017"
  }
  </code></pre>
  
  <p>I have tried with ip, machine's alias, localhost ... nothing seems to work.</p>
  
  <p>Anyone could help me on this? Maybe I'm missing a point.</p>
  
  <p>Thanks in advance</p>