Monitoring Kafka cluster for frequent active controller changes in hospital setting

hello everyone!
i’m working in a big hospital in Paris, France
we use Kafka to process high resolution physiological signals coming from all bedside monitors
we have a kafka cluster (3.6-IV2) with two brokers, and we’re using KRaft for electing which broker is the ‘active controller’
it seems that the active controller keeps changing between broker A and broker B
we don’t understand if this is supposed to happen, or if this is abnormal and we should fix our configuration
any insight?

Hi
Possible Reasons for Frequent Switching:
Broker Instability: If either broker A or B is frequently restarting, experiencing crashes, or has high resource utilization,
Network Issues: Network connectivity problems between the brokers can confuse the election process.
Incorrect Configuration:
Troubleshooting Steps:

  1. Monitor Broker Logs
  2. Review Network Connectivity between brokers
  3. Check Kafka Configuration

thanks
one question, could it be because we have 2 brokers instead of an odd number (e.g. 3)?
i know that with zookeeper, the election process does not work well when there are exactly 2 brokers. it fails to decide which one should be the active controller

Hi : You’re partially right. The KRaft consensus algorithm used in Kafka KRaft mode can experience split-brain scenarios with only two brokers.
Increase Election Timeouts: You can adjust the <http://election.timeout.ms|election.timeout.ms> configuration property in both brokers. Increasing the timeout might give the brokers more time to reconnect and resolve the split-brain situation.