When sending messages to Kafka as producer , an error is reported
There is no leader for this topic-partition as we are in the middle of a leadership election
The specific reason is not very clear, but the solution issue has been found. According to the answer below issue , the following modifications have been made:
The original Kafka is deleted_ BROKER_ ID: 1 when starting docker compose , add -- no recreate at the end of the command. The official explanation is to ensure that the container is not recreated, so as to retain its name and ID
If you still can’t solve the problem after modifying the above configuration, delete the Kafka container, re run docker compose up -- no recreate , and check the #516