0

I have a problem trying to produce messages to Apache Kafka topic from outside of Hortonworks HDP Sandbox. Right now I am using version 2.5 deployed to Azure but I experienced similar behaviour using HDP 2.6 on local VirtualBox. I was able to open port 6667 and confirm that TCP connection is getting through to the VM. I am also able to access the list of topics.

Using listeners=PLAINTEXT://0.0.0.0:6667

C:\GIT\kafka\bin\windows>kafka-console-producer.bat --broker-list MY_PUBLIC_IP:6667 --topic test1
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/C:/GIT/kafka/core/build/dependant-libs-2.11.11/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/GIT/kafka/tools/build/dependant-libs-2.11.11/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/GIT/kafka/connect/api/build/dependant-libs/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/GIT/kafka/connect/runtime/build/dependant-libs/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/GIT/kafka/connect/file/build/dependant-libs/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/GIT/kafka/connect/json/build/dependant-libs/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
>sadasdas
>[2017-11-04 23:06:14,672] WARN [Producer clientId=console-producer] Connection to node 1001 could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)
[2017-11-04 23:06:15,174] ERROR Error when sending message to topic test1 with key: null, value: 8 bytes with error: (org.apache.kafka.clients.producer.internals.ErrorLoggingCallback)
org.apache.kafka.common.errors.TimeoutException: Expiring 1 record(s) for test1-0: 1508 ms has passed since batch creation plus linger time
[2017-11-04 23:06:15,724] WARN [Producer clientId=console-producer] Connection to node 1001 could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)
[2017-11-04 23:06:16,875] WARN [Producer clientId=console-producer] Connection to node 1001 could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)

With the following configuration entries added:

  • advertised.port=6667
  • advertised.listeners=PLAINTEXT://MY_PUBLIC_IP:6667
  • advertised.host.name=MY_PUBLIC_IP

result:

C:\GIT\kafka\bin\windows>kafka-console-producer.bat --broker-list MY_PUBLIC_IP:6667 --topic test1
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/C:/GIT/kafka/core/build/dependant-libs-2.11.11/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/GIT/kafka/tools/build/dependant-libs-2.11.11/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/GIT/kafka/connect/api/build/dependant-libs/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/GIT/kafka/connect/runtime/build/dependant-libs/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/GIT/kafka/connect/file/build/dependant-libs/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/GIT/kafka/connect/json/build/dependant-libs/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
>asdasd
[2017-11-04 22:37:11,713] WARN [Producer clientId=console-producer] Error while fetching metadata with correlation id 2 : {test1=LEADER_NOT_AVAILABLE} (org.apache.kafka.clients.NetworkClient)

Could you give me any advice as to what may be wrong? I'd like to stick with the sandbox for now.

UPDATE I finally got it working. This was the solution:

advertised.listeners=PLAINTEXT://sandbox.hortonworks.com:6667

Seems like my Kafka can only talk to brokers when hostname is given, not IP...

Quass1m
  • 315
  • 2
  • 4
  • 11
  • Is there any firewall software blocking port 6667 on the client host or broker host? – Hans Jespersen Nov 05 '17 at 04:10
  • From what I can tell nothing is blocking this port. It is open on the VM according to nmap and netstat output.. I have no rules blocking port 6667 on my local machine as well. I disabled both iptable and ip6table services but the result was the same. – Quass1m Nov 05 '17 at 20:55
  • When I use the configuration with advertised.port, advertised.listeners and advertised.host.name I can at least observe new topics being created. I still can't get any messages through and only receive "LEADER_NOT_AVAILABLE" error. – Quass1m Nov 05 '17 at 21:18
  • Can you successfully produce from anywhere? If you run bin/kafka-topics —describe on the topic does it show in sync replicas? – Hans Jespersen Nov 05 '17 at 22:06
  • I can only produce from within the VM. I had to remove the advertised.port, advertised.listeners and advertised.host.name settings. With them I got "LEADER_NOT_AVAILABLE". Describing topic gives me: "Topic:test1 PartitionCount:1 ReplicationFactor:1 Configs: Topic: test1 Partition: 0 Leader: 1001 Replicas: 1001 Isr: 1001". – Quass1m Nov 05 '17 at 23:32
  • I solved the problem. Question updated. – Quass1m Nov 07 '17 at 22:17

0 Answers0