title: Add Secondary replica set in the same machine?
body: <p>I'm new at mongodb so this replication is kinda confusing for me. I follow the tutorial <a href="https://docs.mongodb.org/manual/tutorial/deploy-replica-set-for-testing/" rel="noreferrer">here</a>. 
  I have set up 2 mongod instance in my machine:</p>
  
  <pre><code>localhost:27018
  localhost:27019
  </code></pre>
  
  <p>with this command:</p>
  
  <pre><code>mongod --dbpath /home/db2 --port 27019 --replSet "rs1"
  mongod --dbpath /data/db1 --port 27018 --replSet "rs1"
  </code></pre>
  
  <p>When I try to connect and set up replication using this set of command</p>
  
  <pre><code>mongo --port 27019
  rs1:PRIMARY&gt; rs.add("localhost:27018")
  </code></pre>
  
  <p>It always says:</p>
  
  <pre><code>{
  "ok" : 0,
  "errmsg" : "Either all host names in a replica set configuration must
  be localhost references, or none must be; found 1 out of 2",
  "code" : 103
  }
  </code></pre>
  
  <p>Any help, please ?</p>