title: mongoDB - how to remove a member from a replicaset, and then start a new one?
body: <p>I had a prototype where I created a replica set with 3 members.  Now I want to remove 2 of the secondaries from the replicaset, and create new replicas on each of the secondaries. </p>
  
  <p>From the primary, I did the following: </p>
  
  <pre><code>rs.remove("mongohost2.domain.org:27017")
  rs.remove("mongohost3.domain.org:27017")
  </code></pre>
  
  <p>Then when i tried a rs.status(), it correctly showed only the primary in the set. </p>
  
  <p>Now, on the secondary2.domain.org box, I did the following: </p>
  
  <ol>
  <li>changed the mongo.conf file - changed the replicaset name from the old one (jls0) to jls1.</li>
  <li>restarted mongod on the box. </li>
  </ol>
  
  <p><strong>Problem:</strong> </p>
  
  <p>When I start the shell I can tell that it didn't create the replicaset because the prompt doesn't have the name of the replica like it used to. </p>
  
  <p>This is what I get: </p>
  
  <pre><code>me@mongohost2:~$ mongo
  MongoDB shell version: 2.6.5
  connecting to: test
  &gt; rs.status()
  {
      "startupStatus" : 1,
      "ok" : 0,
      "errmsg" : "loading local.system.replset config (LOADINGCONFIG)"
  }
  &gt; rs.initiate()
  {
      "ok" : 0,
      "errmsg" : "local.oplog.rs is not empty on the initiating member.  cannot initiate."
  }
  &gt; 
  </code></pre>
  
  <p>And I found this in the logs: </p>
  
  <pre><code>2014-11-25T15:11:38.876-0500 [initandlisten] waiting for connections on port 27017
  2014-11-25T15:11:38.957-0500 [rsStart] warning: Failed to connect to 10.238.59.71:27017, reason: errno:111 Connection refused
  2014-11-25T15:11:38.961-0500 [rsStart] replSet REMOVED
  2014-11-25T15:11:38.961-0500 [rsStart] replSet info self not present in the repl set configuration:
  2014-11-25T15:11:38.961-0500 [rsStart] { _id: "jls0", version: 8, members: [ { _id: 0, host: "mongohost1:27017", priority: 3.0 }, { _id: 2, host: "mongohost3.domain.org:27017" } ] }
  2014-11-25T15:11:38.964-0500 [rsStart] warning: Failed to connect to 10.238.59.71:27017, reason: errno:111 Connection refused
  2014-11-25T15:11:38.964-0500 [rsStart] replSet info Couldn't load config yet. Sleeping 20sec and will try again.
  2014-11-25T15:11:39.237-0500 [initandlisten] connection accepted from 10.238.59.141:39443 #1 (1 connection now open)
  2014-11-25T15:11:39.237-0500 [conn1] replSet set names do not match, our cmdline: jls1
  2014-11-25T15:11:39.237-0500 [conn1] replSet s: jls0
  2014-11-25T15:11:58.967-0500 [rsStart] warning: Failed to connect to 10.238.59.71:27017, reason: errno:111 Connection refused
  2014-11-25T15:11:58.967-0500 [rsStart] replSet info Couldn't load config yet. Sleeping 20sec and will try again.
  2014-11-25T15:11:59.241-0500 [conn1] replSet set names do not match, our cmdline: jls1
  2014-11-25T15:11:59.241-0500 [conn1] replSet s: jls0
  </code></pre>
  
  <p>What other steps do I need to do to ensure that this server is now using it's own replicaset? 
  Thanks.</p>