1) Create jaas.conf
KafkaClient {
com.sun.security.auth.module.Krb5LoginModule required
doNotPrompt=true
useTicketCache=false
principal="principalName@domain"
useKeyTab=true
serviceName="kafka"
keyTab="my.keytab"
client=true;
};
Client {
com.sun.security.auth.module.Krb5LoginModule required
doNotPrompt=true
useTicketCache=false
principal="principalName@domain"
useKeyTab=true
serviceName="kafka"
keyTab="my.keytab"
client=true;
};
com.sun.security.auth.module.Krb5LoginModule required
doNotPrompt=true
useTicketCache=false
principal="principalName@domain"
useKeyTab=true
serviceName="kafka"
keyTab="my.keytab"
client=true;
};
Client {
com.sun.security.auth.module.Krb5LoginModule required
doNotPrompt=true
useTicketCache=false
principal="principalName@domain"
useKeyTab=true
serviceName="kafka"
keyTab="my.keytab"
client=true;
};
2) Create consumer.properties
sasl.mechanism=GSSAPI
security.protocol=SASL_SSL
sasl.kerberos.service.name=kafka
ssl.truststore.location=truststore.jks
ssl.truststore.password=changeit
group.id=consumer-group-name2
3) Execute following -
>export KAFKA_OPTS="-Djava.security.auth.login.config=/path/to/your/jaas.conf"
>sh kafka-console-consumer.sh --bootstrap-server kafkabroker.charter.com:6668 --topic TopicName --new-consumer --from-beginning --consumer.config /path/to/consumer.properties
Comments
Post a Comment