Search code examples
apache-kafkaapache-zookeepernode-red

Can't reach kafka producer with node-red


I have installed node-red on raspberry pi 3 to collect data from sensors and then store them in kafka but now I have some issue with kafka producer node. I've setup a kafka server on my laptop that correctly works in console: if I send messages on kafka producer console I correctly receive it on consumer console. Unfortunately when I try to inject a timestamp in kafka producer in node-red on raspberry, server gives no response.

  • Debug page of node-red says: "BrokerNotAvailableError: Broker not available"
  • In producer node ZKQuorum field I've typed the ip of the laptop and set port to 9092, as I seen in example on npm site.
  • I'm sure the topic is correct.
  • I'm sure zookeeper is running and kafka server also. Indeed if at same time I try to use kafka with laptop console it works great.
  • I've also tried to reach kafka producer port with telnet: connections are accepted.

I've already posted same question on node-red community, without success for now. Any hint about this issue?

UPDATE:

Update. I've tried to implement a python function in node-red to send a simple message to the kafka producer and I have obtained a deeper error log in: /usr/local/lib/python2.7/dist-packages/kafka/client_async.py", line 808 I opened file and at line 808 there is a function with this comment:

It can be helpful?


Solution

  • You have to configure the accepted listeners field on the kafka server properties to the IP address of your laptop. Try to change zookeeper connect to actual ip, not localhost.

    Try this property in etc/kafka/server.properties: listeners=PLAINTEXT://<your ip here>:<kafka port here>. you will have to restart kafka for this to take affect