"This node was not started with the replSet option"
<p>I am studying the <a href="https://university.mongodb.com/" rel="noreferrer">MongoDBUniversity</a>'s <em>M101P: MongoDB for Developers</em> course. </p>

<p>I am using <strong>WiredTiger</strong> on <strong>MongoDB 3.2</strong>. </p>

<p>I am currently on the topic of <strong>replica sets</strong>.  </p>

<p>The course requires I create a replica set using the following code:  </p>

<pre><code>mongod --replSet rs1 --logpath "1.log" --dbpath /data/rs1 --port 27017 --fork
</code></pre>

<p>But I am using Windows, which doesn't support <code>fork</code>, so using <a href="https://gist.github.com/BigGingerJake/6e2bbce964772445d633e71cc2518d8e" rel="noreferrer">this</a> gist (as recommended by a course admin) I ran these lines simultaneously in 3 different consoles after I had created the directories (with mongod running):</p>

<pre><code>mongod --replSet rs1 --logpath "1.log" --dbpath rs1 --port 27018 --smallfiles --oplogSize64  
mongod --replSet rs1 --logpath "2.log" --dbpath rs2 --port 27019 --smallfiles --oplogSize64  
mongod --replSet rs1 --logpath "3.log" --dbpath rs3 --port 27020 --smallfiles --oplogSize64
</code></pre>

<p>Which all seems to work fine; I can see the directories have been filled, and the log files, which all show "waiting for connection" with the relevant port number.  </p>

<p>Finally, I am running the following code to unify the servers as a replica set:</p>

<pre><code>config = {_id: "rs1", members: [
           { _id: 0, host: "localhost:27018"},
           { _id: 1, host: "localhost:27019"},
           { _id: 2, host: "localhost:27020"}
                                ]
         }

rs.initiate(config)
rs.status()
</code></pre>

<p>Which is throwing:</p>

<pre><code>"errmsg" : "This node was not started with the replSet option",
"code" : 76
</code></pre>

<p>Which I can't get my head around, as I have clearly used the <code>--replSet</code> option for each server, and indeed provided the same replSet name used in the config file.  </p>

<p>I've looked at other questions on this topic, but there are few, and none that I can find address and solve this issue for me. <a href="https://stackoverflow.com/questions/32952653/replica-set-error-code-76">This</a> one states what looks obvious from the error: my config file should include <code>--replSet=rs1</code>, but from reading the <a href="https://docs.mongodb.com/v3.2/reference/replica-configuration/#replica-set-configuration-fields" rel="noreferrer">documentation</a> I am given the impression that the <code>_id</code> of the config I have defined serves that purpose:</p>

<blockquote>
  <p>_id<br>
  <em>Type</em>: string</p>
  
  <p>The name of the replica set. Once set, you cannot change the name of a
  replica set.</p>
  
  <p>_id <em>must</em> be identical to the replication.replSetName or the value of –replSet specified to mongod on the command line.</p>
</blockquote>

<p>Furthermore, this is clearly shown functioning correctly in the course material video demonstrations in precisely the manner I am attempting to use it.  </p>

<p>I am at my wit's end, and would very much appreciate help.<br>
Jake  </p>