There was a problem loading the comments.

Unable to login after MongoDB update

Support Portal  »  Knowledgebase  »  Viewing Article

  Print

Original Question

or Issue:

I did a sudo apt update/sudo apt upgrade on the mongo DB cluster and I think it stopped working after that.

Environment:

  • Product - FileCloud Server
  • Version - Any 
  • Platform - Linux
Steps to Reproduce:

 

This use case requires multiple DB Nodes.
Run an update on Linux via apt.
Afterwards attempt to login to your FileCloud Admin or User Portal.
The page will attempt to load but you will still remain on the login screen. 

Error or Log Message:  

Defect or

Enhancement Number:

 
Cause:  
The apt update may have changed the Primary DB Node unintentionally.

This can be seen when running rs.status() from the Mongo Shell.

replica1 [direct: secondary] test> rs0:PRIMARY> rs.status();

ReferenceError: PRIMARY is not defined

replica1 [direct: secondary] test> rs.status

[Function: status] AsyncFunction {

  apiVersions: [ 0, 0 ],

  returnsPromise: true,

  serverVersions: [ '0.0.0', '999.999.999' ],

  topologies: [ 'ReplSet', 'Sharded', 'LoadBalanced', 'Standalone' ],

  returnType: { type: 'unknown', attributes: {} },

  deprecated: false,

  platforms: [ 'Compass', 'Browser', 'CLI' ],

  isDirectShellCommand: false,

  acceptsRawInput: false,

  shellCommandCompleter: undefined,

  help: [Function (anonymous)] Help

}

replica1 [direct: secondary] test> rs.status();

{

  set: 'replica1',

  date: ISODate('2024-12-12T12:33:27.256Z'),

  myState: 2,

  term: Long('17'),

  syncSourceHost: 'mdb3:27017',

  syncSourceId: 2,

  heartbeatIntervalMillis: Long('2000'),

  majorityVoteCount: 2,

  writeMajorityCount: 2,

  votingMembersCount: 3,

  writableVotingMembersCount: 3,

  optimes: {

    lastCommittedOpTime: { ts: Timestamp({ t: 1734006803, i: 1 }), t: Long('17') },

    lastCommittedWallTime: ISODate('2024-12-12T12:33:23.680Z'),

    readConcernMajorityOpTime: { ts: Timestamp({ t: 1734006803, i: 1 }), t: Long('17') },

    appliedOpTime: { ts: Timestamp({ t: 1734006803, i: 1 }), t: Long('17') },

    durableOpTime: { ts: Timestamp({ t: 1734006803, i: 1 }), t: Long('17') },

    lastAppliedWallTime: ISODate('2024-12-12T12:33:23.680Z'),

    lastDurableWallTime: ISODate('2024-12-12T12:33:23.680Z')

  },

  lastStableRecoveryTimestamp: Timestamp({ t: 1734006783, i: 1 }),

  members: [

    {

      _id: 0,

      name: '10.10.100.51:27017',

      health: 1,

      state: 2,

      stateStr: 'SECONDARY',

      uptime: 72070,

      optime: { ts: Timestamp({ t: 1734006803, i: 1 }), t: Long('17') },

      optimeDate: ISODate('2024-12-12T12:33:23.000Z'),

      lastAppliedWallTime: ISODate('2024-12-12T12:33:23.680Z'),

      lastDurableWallTime: ISODate('2024-12-12T12:33:23.680Z'),

      syncSourceHost: 'mdb3:27017',

      syncSourceId: 2,

      infoMessage: '',

      configVersion: 5,

      configTerm: 17,

      self: true,

      lastHeartbeatMessage: ''

    },

    {

      _id: 1,

      name: 'mdb2:27017',

      health: 1,

      state: 1,

      stateStr: 'PRIMARY',

      uptime: 72061,

      optime: { ts: Timestamp({ t: 1734006803, i: 1 }), t: Long('17') },

      optimeDurable: { ts: Timestamp({ t: 1734006803, i: 1 }), t: Long('17') },

      optimeDate: ISODate('2024-12-12T12:33:23.000Z'),

      optimeDurableDate: ISODate('2024-12-12T12:33:23.000Z'),

      lastAppliedWallTime: ISODate('2024-12-12T12:33:23.680Z'),

      lastDurableWallTime: ISODate('2024-12-12T12:33:23.680Z'),

      lastHeartbeat: ISODate('2024-12-12T12:33:25.391Z'),

      lastHeartbeatRecv: ISODate('2024-12-12T12:33:26.970Z'),

      pingMs: Long('0'),

      lastHeartbeatMessage: '',

      syncSourceHost: '',

      syncSourceId: -1,

      infoMessage: '',

      electionTime: Timestamp({ t: 1733934731, i: 1 }),

      electionDate: ISODate('2024-12-11T16:32:11.000Z'),

      configVersion: 5,

      configTerm: 17

    },

    {

      _id: 2,

      name: 'mdb3:27017',

      health: 1,

      state: 2,

      stateStr: 'SECONDARY',

      uptime: 72061,

      optime: { ts: Timestamp({ t: 1734006803, i: 1 }), t: Long('17') },

      optimeDurable: { ts: Timestamp({ t: 1734006803, i: 1 }), t: Long('17') },

      optimeDate: ISODate('2024-12-12T12:33:23.000Z'),

      optimeDurableDate: ISODate('2024-12-12T12:33:23.000Z'),

      lastAppliedWallTime: ISODate('2024-12-12T12:33:23.680Z'),

      lastDurableWallTime: ISODate('2024-12-12T12:33:23.680Z'),

      lastHeartbeat: ISODate('2024-12-12T12:33:25.390Z'),

      lastHeartbeatRecv: ISODate('2024-12-12T12:33:26.970Z'),

      pingMs: Long('0'),

      lastHeartbeatMessage: '',

      syncSourceHost: 'mdb2:27017',

      syncSourceId: 1,

      infoMessage: '',

      configVersion: 5,

      configTerm: 17

    }

  ],

  ok: 1,

  '$clusterTime': {

    clusterTime: Timestamp({ t: 1734006803, i: 1 }),

    signature: {

      hash: Binary.createFromBase64('pe4F/9YaIdiw7Pj+r8fu/epNh04=', 0),

      keyId: Long('7412554116225826818')

    }

  },

  operationTime: Timestamp({ t: 1734006803, i: 1 })

}

replica1 [direct: secondary] test> rs0:PRIMARY

ReferenceError: PRIMARY is not defined

replica1 [direct: secondary] test>


In this case ID 0 should be the Primary but ID 1 has this instead.

Resolution or

Workaround:


You can set the Priority of a Node higher than the others to ensure that it remains the primary.
This can be done via the following commands.

cfg = rs.conf()
cfg.members[0].priority = 1
cfg.members[1].priority = 0.5
cfg.members[2].priority = 0.5
rs.reconfig(cfg)

This will ensure ID 0 remains as the primary.
Notes:   

Share via

Related Articles


Self-Hosted Help Desk Software by SupportPal
© FileCloud