I am trying to setup two nodes in my kafka cluster under the kraft protocol.
I downloaded a kafka zip from the offical website, unzipped it on my Ubuntu that is running on as a VM with windows OS being the host.
As I wanted to set up a kraft mode kafka, I ignored the server.properties given with the bundle. I noticed that in server.properties it was configured to connect with zookeeper. So, I have created two new config files called broker1.properties and broker2.properties following a tutorial. The property files are shown below.
#node1
node.id=1
process.roles=broker,controller
controller.quorum.voters=1@localhost:9093
listeners=PLAINTEXT://localhost:9092,CONTROLLER://localhost:9093
advertised.listeners=PLAINTEXT://172.22.240.1:9092
controller.listener.names=CONTROLLER
inter.broker.listener.name=PLAINTEXT
log.dirs=/tmp/KafkaClusterLogs/
#node2
node.id=2
process.roles=broker
controller.quorum.voters=1@localhost:9093
listeners=PLAINTEXT://localhost:9095
advertised.listeners=PLAINTEXT://172.22.240.1:9095
controller.listener.names=CONTROLLER
inter.broker.listener.name=PLAINTEXT
log.dirs=/tmp/KafkaClusterLogs1/
listener.security.protocol.map=CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT
In node 2 I have listed the listner.security.protocol referring to another stackoverflow question when I found the broker 2 was not starting up without this and failed with an error stating this key is not configured.
I have a basic understanidng of the broker configurations stated above. In my view things are looking fine but I am not able to progress to set it in a way that it successfully works.
The plan is to make node1 as a controller-broker node and node2 as the broker only node.
172.22.240.1 this is the IP of the Hyper-V that is running on windows as shown below.
Ethernet adapter vEthernet (WSL (Hyper-V firewall)):
Connection-specific DNS Suffix . :
Link-local IPv6 Address . . . . . : fe80::efa6:5938:9104:38be%41
IPv4 Address. . . . . . . . . . . : 172.22.240.1
Subnet Mask . . . . . . . . . . . : 255.255.240.0
Default Gateway . . . . . . . . . :
I can see the two nodes running fine on their respective ports – 9092 and 9095. I examined this by making a telnet to the nodes from the VM (Ubuntu). The problem arises when I try to execute the kafka-topics.sh command to do anything like listing the topics or creating the topics. When I try the below command,
bin/kafka-topics.sh --list --bootstrap-server localhost:9092
The prompt does not return at all. After a while, I get the error
Error while executing topic command : Timed out waiting for a node assignment. Call: listTopics
[2024-05-01 17:10:49,303] ERROR org.apache.kafka.common.errors.TimeoutException: Timed out waiting for a node assignment. Call: listTopics
(kafka.admin.TopicCommand$)
Another Observation :: I am able to telnet to 9092 port from windows command prompt but NOT to 9095. Just stating this out here to see if the issue is connected to the problem I have stated above.