node-rdkafka - debug set to all but I only see broker transport failure

2.3k views Asked by At

I am trying to connect to kafka server. Authentication is based on GSSAPI.

/opt/app-root/src/server/node_modules/node-rdkafka/lib/error.js:411
  return new LibrdKafkaError(e);
         ^
Error: broker transport failure
    at Function.createLibrdkafkaError (/opt/app-root/src/server/node_modules/node-rdkafka/lib/error.js:411:10)
    at /opt/app-root/src/server/node_modules/node-rdkafka/lib/client.js:350:28

This my test_kafka.js:

const Kafka = require('node-rdkafka');

const kafkaConf = {
  'group.id': 'espdev2',
  'enable.auto.commit': true,
  'metadata.broker.list': 'br01',
  'security.protocol': 'SASL_SSL',
  'sasl.kerberos.service.name': 'kafka',
  'sasl.kerberos.keytab': 'svc_esp_kafka_nonprod.keytab',
  'sasl.kerberos.principal': '[email protected]',
  'debug': 'all',
  'enable.ssl.certificate.verification': true,
  //'ssl.certificate.location': 'some-root-ca.cer',
  'ssl.ca.location': 'some-root-ca.cer',
  //'ssl.key.location': 'svc_esp_kafka_nonprod.keytab',
};

const topics = 'hello1';

console.log(Kafka.features);

let readStream = new Kafka.KafkaConsumer.createReadStream(kafkaConf, { "auto.offset.reset": "earliest" }, { topics })
readStream.on('data', function (message) {
  const messageString = message.value.toString();
  console.log(`Consumed message on Stream: ${messageString}`);
});
1

There are 1 answers

0
ndogac On

You can look at this issue for the explanation of this error: https://github.com/edenhill/librdkafka/issues/1987

Taken from @edenhill:

As a general rule for librdkafka-based clients: given that the cluster and client are correctly configured, all errors can be ignored as they are most likely temporary and librdkafka will attempt to recover automatically.

In this specific case; if a group coordinator request fails it will be retried (using any broker in state Up) within 500ms. The current assignment and group membership will not be affected, if a new coordinator is found before the missing heartbeats times out the membership (session.timeout.ms). Auto offset commits will be stalled until a new coordinator is found.

In a future version we'll extend the error type to include a severity, allowing applications to happily ignore non-terminal errors. At this time an application should consider all errors informational, and not terminal.