How to change from Startup to Secondary in MongoDB

36 views Asked by At

I need help on how to change the STARTUP to SECONDARY in MongoDB. I added 3 nodes and 2 nodes must be on SECONDARY state but unfortunately it became STARTUP after adding it. See details below. Been looking for an answer but nothing seems the same with my currently problem.

Hi everyone. I need help on how to change the STARTUP to SECONDARY in MongoDB. I added 3 nodes and 2 nodes must be on SECONDARY state but unfortunately it became STARTUP after adding it. See details below. Been looking for an answer but nothing seems the same with my currently problem.

members: [
    {
      _id: 0,
      name: 'svplred1:27017',
      health: 1,
      state: 1,
      stateStr: 'PRIMARY',
      uptime: 3786,
      optime: { ts: Timestamp({ t: 1707380305, i: 1 }), t: Long('4') },
      optimeDate: ISODate('2024-02-08T08:18:25.000Z'),
      lastAppliedWallTime: ISODate('2024-02-08T08:18:25.168Z'),
      lastDurableWallTime: ISODate('2024-02-08T08:18:25.168Z'),
      syncSourceHost: '',
      syncSourceId: -1,
      infoMessage: '',
      electionTime: Timestamp({ t: 1707376535, i: 1 }),
      electionDate: ISODate('2024-02-08T07:15:35.000Z'),
      configVersion: 3,
      configTerm: 4,
      self: true,
      lastHeartbeatMessage: ''
    },
    {
      _id: 1,
      name: '10.0.14.17:27017',
      health: 1,
      state: 0,
      stateStr: 'STARTUP',
      uptime: 3785,
      optime: { ts: Timestamp({ t: 0, i: 0 }), t: Long('-1') },
      optimeDurable: { ts: Timestamp({ t: 0, i: 0 }), t: Long('-1') },
      optimeDate: ISODate('1970-01-01T00:00:00.000Z'),
      optimeDurableDate: ISODate('1970-01-01T00:00:00.000Z'),
      lastAppliedWallTime: ISODate('1970-01-01T00:00:00.000Z'),
      lastDurableWallTime: ISODate('1970-01-01T00:00:00.000Z'),
      lastHeartbeat: ISODate('2024-02-08T08:18:28.791Z'),
      lastHeartbeatRecv: ISODate('1970-01-01T00:00:00.000Z'),
      pingMs: Long('0'),
      lastHeartbeatMessage: '',
      syncSourceHost: '',
      syncSourceId: -1,
      infoMessage: '',
      configVersion: -2,
      configTerm: -1
    },
    {
      _id: 2,
      name: '10.0.14.18:27017',
      health: 1,
      state: 0,
      stateStr: 'STARTUP',
      uptime: 2895,
      optime: { ts: Timestamp({ t: 0, i: 0 }), t: Long('-1') },
      optimeDurable: { ts: Timestamp({ t: 0, i: 0 }), t: Long('-1') },
      optimeDate: ISODate('1970-01-01T00:00:00.000Z'),
      optimeDurableDate: ISODate('1970-01-01T00:00:00.000Z'),
      lastAppliedWallTime: ISODate('1970-01-01T00:00:00.000Z'),
      lastDurableWallTime: ISODate('1970-01-01T00:00:00.000Z'),
      lastHeartbeat: ISODate('2024-02-08T08:18:28.918Z'),
      lastHeartbeatRecv: ISODate('1970-01-01T00:00:00.000Z'),
      pingMs: Long('0'),
      lastHeartbeatMessage: '',
      syncSourceHost: '',
      syncSourceId: -1,
      infoMessage: '',
      configVersion: -2,
      configTerm: -1
    }   ]

 
2

There are 2 answers

0
R2D2 On

Most probably you are affected by this:

Starting in MongDB 5.0, split horizon DNS nodes that are only configured with an IP address fail startup validation and report an error. See disableSplitHorizonIPCheck.

0
A Hequibal On

I resolved this issue. My primary must be also an IP address. it resolved my problem. Thank you everyone for all your suggestions. :)