When i switched ssl to tls in my replica set, synchronization does not work

Im using docker compose to build up replica set for testing, when i switched SSL to TLS net configuration, the secondary does not do any synchronization. I use self-signed certificates

This is my ssl configuration, everything works well at this time

net:
  port: 27017
  bindIp: 0.0.0.0
  ssl:
    mode: preferSSL
    PEMKeyFile: /keys/mongo.pem
    CAFile: /keys/mongoCA.crt
    clusterFile: /keys/mongo.pem
    allowConnectionsWithoutCertificates: false
    disabledProtocols: TLS1_0,TLS1_1

security:
  authorization: enabled
  clusterAuthMode: x509

But out of control now

net:
  port: 27017
  bindIp: 0.0.0.0
  tls:
    mode: preferTLS  # requireTLS
    certificateKeyFile: /keys/mongo.pem
    CAFile: /keys/mongoCA.crt
    clusterFile: /keys/mongo.pem
    allowInvalidCertificates: true
    allowConnectionsWithoutCertificates: false
    disabledProtocols: TLS1_0

security:
  authorization: enabled
  clusterAuthMode: x509

replica set status

{
members: [
    {
      _id: 1,
      name: 'mongo1:27017',
      health: 1,
      state: 1,
      stateStr: 'PRIMARY',
      uptime: 912,
      optime: [Object],
      optimeDurable: [Object],
      optimeDate: 2023-03-24T15:30:07.000Z,
      optimeDurableDate: 2023-03-24T15:30:07.000Z,
      lastAppliedWallTime: 2023-03-24T15:30:07.297Z,
      lastDurableWallTime: 2023-03-24T15:30:07.297Z,
      lastHeartbeat: 2023-03-24T15:30:07.803Z,
      lastHeartbeatRecv: 2023-03-24T15:30:07.802Z,
      pingMs: Long("0"),
      lastHeartbeatMessage: '',
      syncSourceHost: '',
      syncSourceId: -1,
      infoMessage: '',
      electionTime: Timestamp({ t: 1679670917, i: 1 }),
      electionDate: 2023-03-24T15:15:17.000Z,
      configVersion: 1,
      configTerm: 7
    },
    {
      _id: 2,
      name: 'mongo2:27017',
      health: 1,
      state: 2,
      stateStr: 'SECONDARY',
      uptime: 912,
      optime: [Object],
      optimeDurable: [Object],
      optimeDate: 2023-03-24T15:30:07.000Z,
      optimeDurableDate: 2023-03-24T15:30:07.000Z,
      lastAppliedWallTime: 2023-03-24T15:30:07.297Z,
      lastDurableWallTime: 2023-03-24T15:30:07.297Z,
      lastHeartbeat: 2023-03-24T15:30:07.828Z,
      lastHeartbeatRecv: 2023-03-24T15:30:08.831Z,
      pingMs: Long("0"),
      lastHeartbeatMessage: '',
      syncSourceHost: 'mongo1:27017',
      syncSourceId: 1,
      infoMessage: '',
      configVersion: 1,
      configTerm: 7
    },
    {
      _id: 3,
      name: 'mongo3:27017',
      health: 1,
      state: 2,
      stateStr: 'SECONDARY',
      uptime: 915,
      optime: [Object],
      optimeDate: 2023-03-24T15:30:07.000Z,
      lastAppliedWallTime: 2023-03-24T15:30:07.297Z,
      lastDurableWallTime: 2023-03-24T15:30:07.297Z,
      syncSourceHost: 'mongo2:27017',
      syncSourceId: 2,
      infoMessage: '',
      configVersion: 1,
      configTerm: 7,
      self: true,
      lastHeartbeatMessage: ''
    }
  ],
}

Everything is done, why i asking this question because mongo compass does not show database if readPreference is default. So i think my configuration goes wrong

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.