title: Mongodb replicaset secondaries showing not reachable/healthy and lastHeartbeatMessage shows No connection could be made
body: <p>Mongodb replicaset secondaries showing not reachable/healthy. It was working fine once the machine restarted it shows both secondary as reachable/healthy. I configured first secondary in the port 27027 and second secondary in 27037. When i Checked rs.status() i got below result.</p>
  <pre><code>rs0:PRIMARY&gt; rs.status()
  {
      &quot;set&quot; : &quot;rs0&quot;,
      &quot;date&quot; : ISODate(&quot;2021-03-23T05:52:50.311Z&quot;),
      &quot;myState&quot; : 1,
      &quot;term&quot; : NumberLong(5),
      &quot;syncSourceHost&quot; : &quot;&quot;,
      &quot;syncSourceId&quot; : -1,
      &quot;heartbeatIntervalMillis&quot; : NumberLong(2000),
      &quot;majorityVoteCount&quot; : 1,
      &quot;writeMajorityCount&quot; : 1,
      &quot;votingMembersCount&quot; : 1,
      &quot;writableVotingMembersCount&quot; : 1,
      &quot;optimes&quot; : {
              &quot;lastCommittedOpTime&quot; : {
                      &quot;ts&quot; : Timestamp(1616478761, 1),
                      &quot;t&quot; : NumberLong(5)
              },
              &quot;lastCommittedWallTime&quot; : ISODate(&quot;2021-03-23T05:52:41.265Z&quot;),
              &quot;readConcernMajorityOpTime&quot; : {
                      &quot;ts&quot; : Timestamp(1616478761, 1),
                      &quot;t&quot; : NumberLong(5)
              },
              &quot;readConcernMajorityWallTime&quot; : ISODate(&quot;2021-03-23T05:52:41.265Z&quot;),
              &quot;appliedOpTime&quot; : {
                      &quot;ts&quot; : Timestamp(1616478761, 1),
                      &quot;t&quot; : NumberLong(5)
              },
              &quot;durableOpTime&quot; : {
                      &quot;ts&quot; : Timestamp(1616478761, 1),
                      &quot;t&quot; : NumberLong(5)
              },
              &quot;lastAppliedWallTime&quot; : ISODate(&quot;2021-03-23T05:52:41.265Z&quot;),
              &quot;lastDurableWallTime&quot; : ISODate(&quot;2021-03-23T05:52:41.265Z&quot;)
      },
      &quot;lastStableRecoveryTimestamp&quot; : Timestamp(1616478711, 1),
      &quot;electionCandidateMetrics&quot; : {
              &quot;lastElectionReason&quot; : &quot;electionTimeout&quot;,
              &quot;lastElectionDate&quot; : ISODate(&quot;2021-03-23T05:44:09.131Z&quot;),
              &quot;electionTerm&quot; : NumberLong(5),
              &quot;lastCommittedOpTimeAtElection&quot; : {
                      &quot;ts&quot; : Timestamp(0, 0),
                      &quot;t&quot; : NumberLong(-1)
              },
              &quot;lastSeenOpTimeAtElection&quot; : {
                      &quot;ts&quot; : Timestamp(1616478202, 1),
                      &quot;t&quot; : NumberLong(4)
              },
              &quot;numVotesNeeded&quot; : 1,
              &quot;priorityAtElection&quot; : 1,
              &quot;electionTimeoutMillis&quot; : NumberLong(10000),
              &quot;numCatchUpOps&quot; : NumberLong(0),
              &quot;newTermStartDate&quot; : ISODate(&quot;2021-03-23T05:44:11.152Z&quot;),
              &quot;wMajorityWriteAvailabilityDate&quot; : ISODate(&quot;2021-03-23T05:44:11.238Z&quot;)
      },
      &quot;members&quot; : [
              {
                      &quot;_id&quot; : 0,
                      &quot;name&quot; : &quot;127.0.0.1:27017&quot;,
                      &quot;health&quot; : 1,
                      &quot;state&quot; : 1,
                      &quot;stateStr&quot; : &quot;PRIMARY&quot;,
                      &quot;uptime&quot; : 540,
                      &quot;optime&quot; : {
                              &quot;ts&quot; : Timestamp(1616478761, 1),
                              &quot;t&quot; : NumberLong(5)
                      },
                      &quot;optimeDate&quot; : ISODate(&quot;2021-03-23T05:52:41Z&quot;),
                      &quot;syncSourceHost&quot; : &quot;&quot;,
                      &quot;syncSourceId&quot; : -1,
                      &quot;infoMessage&quot; : &quot;&quot;,
                      &quot;electionTime&quot; : Timestamp(1616478249, 1),
                      &quot;electionDate&quot; : ISODate(&quot;2021-03-23T05:44:09Z&quot;),
                      &quot;configVersion&quot; : 3,
                      &quot;configTerm&quot; : 5,
                      &quot;self&quot; : true,
                      &quot;lastHeartbeatMessage&quot; : &quot;&quot;
              },
              {
                      &quot;_id&quot; : 1,
                      &quot;name&quot; : &quot;127.0.0.1:27027&quot;,
                      &quot;health&quot; : 0,
                      &quot;state&quot; : 8,
                      &quot;stateStr&quot; : &quot;(not reachable/healthy)&quot;,
                      &quot;uptime&quot; : 0,
                      &quot;optime&quot; : {
                              &quot;ts&quot; : Timestamp(0, 0),
                              &quot;t&quot; : NumberLong(-1)
                      },
                      &quot;optimeDurable&quot; : {
                              &quot;ts&quot; : Timestamp(0, 0),
                              &quot;t&quot; : NumberLong(-1)
                      },
                      &quot;optimeDate&quot; : ISODate(&quot;1970-01-01T00:00:00Z&quot;),
                      &quot;optimeDurableDate&quot; : ISODate(&quot;1970-01-01T00:00:00Z&quot;),
                      &quot;lastHeartbeat&quot; : ISODate(&quot;2021-03-23T05:52:47.779Z&quot;),
                      &quot;lastHeartbeatRecv&quot; : ISODate(&quot;1970-01-01T00:00:00Z&quot;),
                      &quot;pingMs&quot; : NumberLong(0),
                      &quot;lastHeartbeatMessage&quot; : &quot;Error connecting to 127.0.0.1:27027 :: caused by :: No connection could be made because the target machine actively refused it.&quot;,
                      &quot;syncSourceHost&quot; : &quot;&quot;,
                      &quot;syncSourceId&quot; : -1,
                      &quot;infoMessage&quot; : &quot;&quot;,
                      &quot;configVersion&quot; : -1,
                      &quot;configTerm&quot; : -1
              },
              {
                      &quot;_id&quot; : 2,
                      &quot;name&quot; : &quot;127.0.0.1:27037&quot;,
                      &quot;health&quot; : 0,
                      &quot;state&quot; : 8,
                      &quot;stateStr&quot; : &quot;(not reachable/healthy)&quot;,
                      &quot;uptime&quot; : 0,
                      &quot;optime&quot; : {
                              &quot;ts&quot; : Timestamp(0, 0),
                              &quot;t&quot; : NumberLong(-1)
                      },
                      &quot;optimeDurable&quot; : {
                              &quot;ts&quot; : Timestamp(0, 0),
                              &quot;t&quot; : NumberLong(-1)
                      },
                      &quot;optimeDate&quot; : ISODate(&quot;1970-01-01T00:00:00Z&quot;),
                      &quot;optimeDurableDate&quot; : ISODate(&quot;1970-01-01T00:00:00Z&quot;),
                      &quot;lastHeartbeat&quot; : ISODate(&quot;2021-03-23T05:52:47.768Z&quot;),
                      &quot;lastHeartbeatRecv&quot; : ISODate(&quot;1970-01-01T00:00:00Z&quot;),
                      &quot;pingMs&quot; : NumberLong(0),
                      &quot;lastHeartbeatMessage&quot; : &quot;Error connecting to 127.0.0.1:27037 :: caused by :: No connection could be made because the target machine actively refused it.&quot;,
                      &quot;syncSourceHost&quot; : &quot;&quot;,
                      &quot;syncSourceId&quot; : -1,
                      &quot;infoMessage&quot; : &quot;&quot;,
                      &quot;configVersion&quot; : -1,
                      &quot;configTerm&quot; : -1
              }
      ],
      &quot;ok&quot; : 1,
      &quot;$clusterTime&quot; : {
              &quot;clusterTime&quot; : Timestamp(1616478761, 1),
              &quot;signature&quot; : {
                      &quot;hash&quot; : BinData(0,&quot;AAAAAAAAAAAAAAAAAAAAAAAAAAA=&quot;),
                      &quot;keyId&quot; : NumberLong(0)
              }
      },
      &quot;operationTime&quot; : Timestamp(1616478761, 1)
  }
  </code></pre>