provectus / kafka-ui

Open-Source Web UI for Apache Kafka Management
Apache License 2.0
9.71k stars 1.18k forks source link

Green tick sign with an active controller is placed next to the wrong controller #4363

Open KrzysztofDzioba opened 9 months ago

KrzysztofDzioba commented 9 months ago

Issue submitter TODO list

Describe the bug (actual behavior)

Hi. I created 3 kafka brokers. In "Brokers" section, I can see "Active Controller" with a value 2. However, in the list of brokers below, I can see a green 'tick' mark next to broker ID 3. When I move a curson on this tick, I can read "Active Controller".

I checked the logs on each broker. I can read there following: broker1: DEBUG [Controller id=1] Broker 2 has been elected as the controller, so stopping the election process. broker2: INFO [Controller id=2] 2 successfully elected as the controller. broker3: DEBUG [Controller id=3] Broker 2 has been elected as the controller, so stopping the election process.

So the active one is 2. That means that tick mark next to broker id 3 is wrong. (Or it's me that I can't get something here)

All best, Chris

Expected behavior

Green tick mark should be next to broker id 2

Your installation details

tested on: 56fa824 v0.7.1

Steps to reproduce

Use following docker file:

---
version: '2'
services:
  zookeeper-1:
    image: confluentinc/cp-zookeeper:latest
    environment:
      ZOOKEEPER_CLIENT_PORT: 2181
      ZOOKEEPER_TICK_TIME: 2000
    ports:
      - 22181:2181

  zookeeper-2:
    image: confluentinc/cp-zookeeper:latest
    environment:
      ZOOKEEPER_CLIENT_PORT: 2181
      ZOOKEEPER_TICK_TIME: 2000
    ports:
      - 32181:2181

  kafka-1:
    image: confluentinc/cp-kafka:latest
    depends_on:
      - zookeeper-1
      - zookeeper-2

    ports:
      - 29092:29092
    environment:
      KAFKA_BROKER_ID: 1
      KAFKA_ZOOKEEPER_CONNECT: zookeeper-1:2181,zookeeper-2:2181
      KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka-1:9092,PLAINTEXT_HOST://localhost:29092
      KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT
      KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT
      KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
  kafka-2:
    image: confluentinc/cp-kafka:latest
    depends_on:
      - zookeeper-1
      - zookeeper-2
    ports:
      - 39092:39092
    environment:
      KAFKA_BROKER_ID: 2
      KAFKA_ZOOKEEPER_CONNECT: zookeeper-1:2181,zookeeper-2:2181
      KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka-2:9092,PLAINTEXT_HOST://localhost:39092
      KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT
      KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT
      KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
  kafka-3:
    image: confluentinc/cp-kafka:latest
    depends_on:
      - zookeeper-1
      - zookeeper-2
    ports:
      - 49092:49092
    environment:
      KAFKA_BROKER_ID: 3
      KAFKA_ZOOKEEPER_CONNECT: zookeeper-1:2181,zookeeper-2:2181
      KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka-3:9092,PLAINTEXT_HOST://localhost:49092
      KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT
      KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT
      KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1  
  kafka-ui:
    image: provectuslabs/kafka-ui
    container_name: kafka-ui
    ports:
      - 8090:8080
    depends_on:
     - zookeeper-1
     - zookeeper-2
     - kafka-1
     - kafka-2
    environment:
      KAFKA_CLUSTERS_0_NAME: local
      KAFKA_CLUSTERS_0_BOOTSTRAP_SERVERS: kafka-2:9092
      KAFKA_CLUSTERS_0_ZOOKEEPER: zookeeper-1:2181

Screenshots

image

Logs

image

image

image

Additional context

No response

github-actions[bot] commented 9 months ago

Hello there KrzysztofDzioba! πŸ‘‹

Thank you and congratulations πŸŽ‰ for opening your very first issue in this project! πŸ’–

In case you want to claim this issue, please comment down below! We will try to get back to you as soon as we can. πŸ‘€

KrzysztofDzioba commented 9 months ago

Hi, please take a look on this

liudaac commented 8 months ago

It`s surely a bug in 0.7.1. And has been fixed in master branch. But also exist another bug as the activeController node is not the correct one when the cluster is running on kraft. I have commited a pr on this problem.

lxb6476 commented 3 months ago

It`s surely a bug in 0.7.1. And has been fixed in master branch. But also exist another bug as the activeController node is not the correct one when the cluster is running on kraft. I have commited a pr on this problem.

I have reviewed the PR code you submitted and noticed that you obtained the correct active controller id for the KRaft mode deployment via JMX. In the master branch implementation, it seemed to be obtained directly through Java's kafka-clients, but it would get active controlelr id from the broker nodes, similar to the way the active controller is obtained in a Zookeeper-deployed mode.

Haarolean commented 3 months ago

this repo is not maintained (#4255), please refer to https://github.com/kafbat/kafka-ui where we've fixed all the related issues (IIRC)