The above procedure is to configure Kerberos authentication with Kafka using the producer.properties file. For those who are using plain username and password authentication instead of Kerberos authentication, you can use the same stand-alone program for testing in the following way;
- Change the sasl.jaas.config in the producer.properties file in the following form;
sasl.jaas.config=org.apache.kafka.common.security.plain.PlainLoginModule required username="username" password="password";
- Run the program. You can use a dummy file for the argument <full path to krb5.conf file>
- Once you have a successful result, configure the username and password credentials as per the following Knowledge Center page for Kafka nodes to pick them.
https://www.ibm.com/support/knowledgecenter/en/SSMKHH_10.0.0/com.ibm.etools.mft.doc/bz91050_.htm
The stand alone program is built using Java KafkaProducer class. You can refer to the Javadoc for further information;
https://kafka.apache.org/0102/javadoc/index.html?org/apache/kafka/clients/producer/KafkaProducer.html
Acknowledgement and thanks to Amar Shah for his technical support and advice in the construction of this article.