Search code examples
apache-kafkakerberoskafka-producer-apiambariapache-kafka-security

kafka-console-producer with kerberos throws security-protocol is not a recognized option


I have enabled Kerberos from Ambari v2.7.3 and HDP v3.1.0 to all Hadoop services. I have verified HBase authentication using NIFI. I need to test Kafka as well. In Kafka console, I am able to create a topic. But while producing and consuming I am facing an error like below.

security-protocol is not a recognized option

Below is the Kafka producer command I have tried

/usr/hdp/3.1.0.0-78/kafka/bin/kafka-console-producer.sh --broker-list HOSTNAME:6667 --topic test_new_topic --security-protocol SASL_PLAINTEXT

Solution

  • My advise would be to add all the properties under a single file (e.g. client-ssl.properties) with the following content:

    security.protocol=SASL_PLAINTEXT
    

    and finally use –-producer.config to pass the property file to the console producer:

    /usr/hdp/3.1.0.0-78/kafka/bin/kafka-console-producer.sh –-broker-list HOSTNAME:6667 –-topic test_new_topic –-producer.config client-ssl.properties
    

    If you don't want to use a property file, you can use --producer-property to pass the security.protocol configuration:

    /usr/hdp/3.1.0.0-78/kafka/bin/kafka-console-producer.sh --broker-list HOSTNAME:6667 --topic test_new_topic  --producer-property security.protocol=SASL_PLAINTEXT