title: MongoDB replica set on windows facing some basic issues
body: <p>I am on Windows 10 Environment. I would like to Implement Replica Set on MongoDB. I am facing some issues..</p>
  
  <p>For that, I cover almost many tutorials to implement the things on Windows Machine.</p>
  
  <p>I want to create a replica set consisting of a primary node and another node, which will be replicating the data.</p>
  
  <p>My structure is like this:</p>
  
  <ul>
  <li>Install folder: C:/Programs Files\MongoDb\Server\3.4\bin\</li>
  <li>Database folder: C:/data/db</li>
  <li>Log file folder: C:/data/log</li>
  <li>Config: C:/data/mongod.cfg</li>
  </ul>
  
  <p>I have defined the service with this command:</p>
  
  <blockquote>
    <p>sc.exe create MongoDB binPath= "\"C:\Program Files\MongoDB\Server\3.4\bin\mongod.exe\" --service --config=\"C:\data\mongod.cfg\"" DisplayName= "MongoDB" start= "auto"</p>
  </blockquote>
  
  <p>I have started the service with this command:</p>
  
  <blockquote>
    <p>net start mongodb</p>
  </blockquote>
  
  <p>It runs successfully.</p>
  
  <p>However, now I am getting problems with replication. What I did to set up the replica set is:</p>
  
  <ol>
  <li>create three subfolders under the data folder named <em>rs1, rs2, rs3</em>, using the command <code>mkdir \data\rs1 \data\rs1 \data\rs2</code></li>
  <li>Implement the Replset for replication of three servers.</li>
  </ol>
  
  <p>My three startup commands are:
  1. start mongod --replSet udd --logpath \data\rs1\1.log --dbpath \data\rs1 --port 27017 --smallfiles --oplogSize 64
  2. start mongod --replSet udd --logpath \data\rs1\2.log --dbpath \data\rs2 --port 27018 --smallfiles --oplogSize 64
  3. start mongod --replSet udd --logpath \data\rs1\3.log --dbpath \data\rs3 --port 27019 --smallfiles --oplogSize 64</p>
  
  <p>With those running, I can type <code>mongo --port 27017</code>; this connects properly to 127.0.0.1:27017/</p>
  
  <p>Now my problem is that earlier the mongo shell prompt said <em>udd:PRIMARY></em>; but now it has changed to say: <em>udd:OTHER></em></p>
  
  <p>Please guide me how I can move forward with replication; any help is really appreciated.</p>
  
  <p>My rs.reconfig(config,{"force":true}) will be</p>
  
  <pre><code>    udd:OTHER&gt; config =  {_id: "udd", members: [
  ... {_id: 0, host: "127.0.0.1:27017"},
  ... {_id: 1, host: "127.0.0.1:27018"},
  ... {_id: 2, host: "127.0.0.1:27019"}
  ... ]}
  {
          "_id" : "udd",
          "members" : [
                  {
                          "_id" : 0,
                          "host" : "127.0.0.1:27017"
                  },
                  {
                          "_id" : 1,
                          "host" : "127.0.0.1:27018"
                  },
                  {
                          "_id" : 2,
                          "host" : "127.0.0.1:27019"
                  }
          ]
  }
  udd:OTHER&gt; rs.reconfig(config,{"force":true})
  { "ok" : 1 }
  udd:OTHER&gt; rs.status()
  {
          "set" : "udd",
          "date" : ISODate("2018-01-31T11:58:15.717Z"),
          "myState" : 2,
          "term" : NumberLong(1),
          "heartbeatIntervalMillis" : NumberLong(2000),
          "optimes" : {
                  "lastCommittedOpTime" : {
                          "ts" : Timestamp(0, 0),
                          "t" : NumberLong(-1)
                  },
                  "appliedOpTime" : {
                          "ts" : Timestamp(1517381781, 1),
                          "t" : NumberLong(1)
                  },
                  "durableOpTime" : {
                          "ts" : Timestamp(1517381781, 1),
                          "t" : NumberLong(1)
                  }
          },
          "members" : [
                  {
                          "_id" : 0,
                          "name" : "127.0.0.1:27017",
                          "health" : 1,
                          "state" : 2,
                          "stateStr" : "SECONDARY",
                          "uptime" : 1506,
                          "optime" : {
                                  "ts" : Timestamp(1517381781, 1),
                                  "t" : NumberLong(1)
                          },
                          "optimeDate" : ISODate("2018-01-31T06:56:21Z"),
                          "configVersion" : 37530,
                          "self" : true
                  },
                  {
                          "_id" : 1,
                          "name" : "127.0.0.1:27018",
                          "health" : 0,
                          "state" : 8,
                          "stateStr" : "(not reachable/healthy)",
                          "uptime" : 0,
                          "optime" : {
                                  "ts" : Timestamp(0, 0),
                                  "t" : NumberLong(-1)
                          },
                          "optimeDurable" : {
                                  "ts" : Timestamp(0, 0),
                                  "t" : NumberLong(-1)
                          },
                          "optimeDate" : ISODate("1970-01-01T00:00:00Z"),
                          "optimeDurableDate" : ISODate("1970-01-01T00:00:00Z"),
                          "lastHeartbeat" : ISODate("2018-01-31T11:58:15.677Z"),
                          "lastHeartbeatRecv" : ISODate("1970-01-01T00:00:00Z"),
                          "pingMs" : NumberLong(0),
                          "lastHeartbeatMessage" : "No connection could be made because the target machine actively refused it.",
                          "configVersion" : -1
                  },
                  {
                          "_id" : 2,
                          "name" : "127.0.0.1:27019",
                          "health" : 0,
                          "state" : 8,
                          "stateStr" : "(not reachable/healthy)",
                          "uptime" : 0,
                          "optime" : {
                                  "ts" : Timestamp(0, 0),
                                  "t" : NumberLong(-1)
                          },
                          "optimeDurable" : {
                                  "ts" : Timestamp(0, 0),
                                  "t" : NumberLong(-1)
                          },
                          "optimeDate" : ISODate("1970-01-01T00:00:00Z"),
                          "optimeDurableDate" : ISODate("1970-01-01T00:00:00Z"),
                          "lastHeartbeat" : ISODate("2018-01-31T11:58:15.670Z"),
                          "lastHeartbeatRecv" : ISODate("1970-01-01T00:00:00Z"),
                          "pingMs" : NumberLong(0),
                          "lastHeartbeatMessage" : "No connection could be made because the target machine actively refused it.",
                          "configVersion" : -1
                  }
          ],
          "ok" : 1
  }
  udd:SECONDARY&gt;
  </code></pre>
  
  <p>Now rs.conf() will be</p>
  
  <pre><code>udd:SECONDARY&gt; rs.conf()
  {
          "_id" : "udd",
          "version" : 37530,
          "protocolVersion" : NumberLong(1),
          "members" : [
                  {
                          "_id" : 0,
                          "host" : "127.0.0.1:27017",
                          "arbiterOnly" : false,
                          "buildIndexes" : true,
                          "hidden" : false,
                          "priority" : 1,
                          "tags" : {
  
                          },
                          "slaveDelay" : NumberLong(0),
                          "votes" : 1
                  },
                  {
                          "_id" : 1,
                          "host" : "127.0.0.1:27018",
                          "arbiterOnly" : false,
                          "buildIndexes" : true,
                          "hidden" : false,
                          "priority" : 1,
                          "tags" : {
  
                          },
                          "slaveDelay" : NumberLong(0),
                          "votes" : 1
                  },
                  {
                          "_id" : 2,
                          "host" : "127.0.0.1:27019",
                          "arbiterOnly" : false,
                          "buildIndexes" : true,
                          "hidden" : false,
                          "priority" : 1,
                          "tags" : {
  
                          },
                          "slaveDelay" : NumberLong(0),
                          "votes" : 1
                  }
          ],
          "settings" : {
                  "chainingAllowed" : true,
                  "heartbeatIntervalMillis" : 2000,
                  "heartbeatTimeoutSecs" : 10,
                  "electionTimeoutMillis" : 10000,
                  "catchUpTimeoutMillis" : 60000,
                  "getLastErrorModes" : {
  
                  },
                  "getLastErrorDefaults" : {
                          "w" : 1,
                          "wtimeout" : 0
                  },
                  "replicaSetId" : ObjectId("5a715e56bff9fd66ea55b862")
          }
  }
  udd:SECONDARY&gt;
  </code></pre>