When setting up Kafka with SASL_PLAINTEXT authentication, I am getting
I did come across Kafka Server - Could not find a 'KafkaServer' in JAAS and Unable to start Kafka Server using SASL_PLAINTEXT authentication but the answers in them didn't work for me. So, any new insights would help me. Thanks.
Please find the configurations below.
The server.properties
broker.id=0
listeners=INTERNAL://127.0.0.1:9092
advertised.listeners=INTERNAL://127.0.0.1:9092
listener.security.protocol.map=INTERNAL:SASL_PLAINTEXT
num.network.threads=3
num.io.threads=8
socket.send.buffer.bytes=102400
socket.receive.buffer.bytes=102400
socket.request.max.bytes=104857600
log.dirs=/tmp/kafka-logs
num.partitions=1
num.recovery.threads.per.data.dir=1
offsets.topic.replication.factor=1
transaction.state.log.replication.factor=1
transaction.state.log.min.isr=1
log.retention.hours=168
log.segment.bytes=1073741824
inter.broker.listener.name=INTERNAL
log.retention.check.interval.ms=300000
zookeeper.connect=127.0.0.1:2181
zookeeper.connection.timeout.ms=18000
group.initial.rebalance.delay.ms=0
delete.topic.enable=true
sasl.enabled.mechanisms=SCRAM-SHA-256
sasl.mechanism.inter.broker.protocol=SCRAM-SHA-256
ssl.endpoint.identification.algorithm=
The kafka_server_jaas.conf
KafkaServer {
org.apache.kafka.common.security.scram.ScramLoginModule required
username="admin"
password="123456";
};
Client {
org.apache.kafka.common.security.plain.PlainLoginModule required
username="admin"
password="123456";
};
The command I executed.
export KAFKA_OPTS="-Djava.security.auth.login.config=/home/username/kafka/config/kafka_server_jaas.conf"
sudo bin/kafka-server-start.sh config/server.properties #In Kafka folder
When I printed KAFKA_OPTS
using echo $KAFKA_OPTS
I got -Djava.security.auth.login.config=/home/kafka/kafka/config/kafka_server_jaas.conf
as the result.
I was using Kafka 3.5.0
. I now tried 3.0.0
, everything is working just fine.