title: replica set configuration incompatible
body: <p>I am trying to setup replica set but unsuccessful. </p>
  
  <p>Here is the config file for all servers /etc/mongodb.conf:</p>
  
  <pre><code>security:
    keyFile: /opt/svn/mhealth-server-config/etc/mongokey
  
  replication:
    replSetName: rs0
  </code></pre>
  
  <p>And here is the result of rs.status() command of the primary server</p>
  
  <pre><code>{
          "set" : "rs0",
          "date" : ISODate("2017-10-05T08:00:57.599Z"),
          "myState" : 1,
          "term" : NumberLong(22),
          "heartbeatIntervalMillis" : NumberLong(2000),
          "optimes" : {
                  "lastCommittedOpTime" : {
                          "ts" : Timestamp(1507190457, 90),
                          "t" : NumberLong(22)
                  },
                  "appliedOpTime" : {
                          "ts" : Timestamp(1507190457, 121),
                          "t" : NumberLong(22)
                  },
                  "durableOpTime" : {
                          "ts" : Timestamp(1507190457, 90),
                          "t" : NumberLong(22)
                  }
          },
          "members" : [
                  {
                          "_id" : 0,
                          "name" : "......",
                          "health" : 1,
                          "state" : 1,
                          "stateStr" : "PRIMARY",
                          "uptime" : 1256,
                          "optime" : {
                                  "ts" : Timestamp(1507190457, 121),
                                  "t" : NumberLong(22)
                          },
                          "optimeDate" : ISODate("2017-10-05T08:00:57Z"),
                          "electionTime" : Timestamp(1507189204, 1),
                          "electionDate" : ISODate("2017-10-05T07:40:04Z"),
                          "configVersion" : 1,
                          "self" : true
                  }
          ],
          "ok" : 1
  }
  </code></pre>
  
  <p>Next, I try to add a second server to the replica set, it printed with the following error message:</p>
  
  <pre><code>{
          "ok" : 0,
          "errmsg" : "Our replica set ID of 58fcaf004dd51cd984051968 did not match that of 13.76.170.50:27017, which is 59d3668ea39e555205ab2761",
          "code" : 103,
          "codeName" : "NewReplicaSetConfigurationIncompatible"
  }
  </code></pre>
  
  <p>It is clearly that both servers having the same replica set name "rs0" so I do not know what causes the issue. I have read <a href="https://stackoverflow.com/questions/41962117/replicasetid-conflict-while-adding-node-mongodb">this thread</a> but it does not solve my problem. Any help is much appreciated.</p>