5

I am trying to use ruby-kafka gem to send messages but i am getting the error Could not connect to any of the seed brokers

kafka::ConnectionError: Could not connect to any of the seed brokers:
- kafka:broker1: Connection error EOFError: EOFError
- kafka:broker2: Connection error EOFError: EOFError
- kafka:broker3: Connection error EOFError: EOFError
- kafka:broker4: Connection error EOFError: EOFError

https://github.com/zendesk/ruby-kafka

I created krb5.keytab file for authentication.

kafka = Kafka.new(["broker1",
                   "broker2",
                   "broker3",
                   "broker4"
                      ],
    sasl_gssapi_keytab: '/etc/krb5.keytab')
    kafka.deliver_message("Hello, World!", topic: "TestTopic")

Does anyone know why i am getting that error?

john simons
  • 81
  • 1
  • 7
  • What do you get if you run this command from where you're trying to run your ruby code: `nc -z broker1 9092`, and repeat for all brokers? – mjuarez Oct 17 '18 at 20:46
  • so the broker i have is something like this mxq575643d.abcd.xyz.net:9093 and if i do `nc -z mxq575643d.abcd.xyz.net 9093` i get connection succeeded. – john simons Oct 17 '18 at 21:47
  • Ok, that's a good first step. That means at least one of the brokers is available, which should be enough for starting a connection. I notice you reference a `krb5.keytab` for SASL. Can you connect to the servers _without_ using SASL? Try connecting without auth/SASL on port 9092. – mjuarez Oct 17 '18 at 21:54
  • I took `sasl_gssapi_keytab` and tried to connect to `localhost\9092` but got response `nil`. I did `kafka = Kafka.new(["localhost:9092")` but when i try with other gem 'delivery_boy' I got Successfully appended 1 messages to TestTopic/0 on 127.0.0.01:9092 (node_id=1001) – john simons Oct 17 '18 at 22:05
  • I assume in your real code, `broker1` is replaced with `mxq575643d.abcd.xyz.net:9093`? – OneCricketeer Oct 18 '18 at 00:13
  • @cricket_007 that is correct – john simons Oct 18 '18 at 01:00
  • @johnsimons hello, did you manage to make it work at the end? I am at the very same situation. Thank you – Sergio A. Oct 09 '19 at 14:05

1 Answers1

1

You might be using Kafka 0.10. From version 0.7.x, the support for Kafka 0.10 is dropped, in the replacement of new Record Batch format in kafka 0.11. So, please use 0.6.x branches, or upgrade your kafka version. As described here:

https://github.com/zendesk/ruby-kafka/issues/672

Rene B.
  • 6,557
  • 7
  • 46
  • 72