title: Unable to addShard in MongoDB
body: <p>I am trying to deploy mongodb sharding. I have deployed a replica set in three machines. However, I still can't seem to make it work when I try to <code>sh.addShard("test/mongodb1.example.net:27017")</code> to all the three nodes. The error shown is:</p>
  
  <pre><code>2016-11-09T16:02:46.704+0800 W NETWORK  [conn105] No primary detected for set team3
  </code></pre>
  
  <p>Another error:</p>
  
  <pre><code>{
    "ok" : 0,
    "errmsg" : "could not find host matching read preference { mode: \"primary\" } for set test",
    "code" : 133
  }
  </code></pre>
  
  <p>1) Set up initial replica set for each node (This works fine)</p>
  
  <p>a) Run these for all 3 nodes:</p>
  
  <pre><code>mkdir /temp/data/team3
  ./mongod --replSet "team3" --dbpath /temp/data/team3
  ./mongo --host &lt;mongodb[x].example.net&gt;  
  </code></pre>
  
  <p>b) Primary node runs:</p>
  
  <pre><code>rs.initiate()
  rs.add("mongodb2.example.net")
  rs.add("mongodb3.example.net")
  </code></pre>
  
  <p>2) Setting up configuration server and query router for Three replica cluster (This works fine)</p>
  
  <p>Primary node runs:</p>
  
  <pre><code>mkdir /temp/data/config_rs
  ./mongod --configsvr --replSet "config_rs" --dbpath /temp/data/config_rs
  ./mongo --host mongodb1.example.net --port 27019
  </code></pre>
  
  <p>3) Add shards (Problem with adding shard)</p>
  
  <p>Primary node runs:</p>
  
  <pre><code>sh.addShard("mongodb1.example.net")
  sh.addShard("mongodb2.example.net")
  sh.addShard("mongodb3.example.net")
  </code></pre>