I'm using Kafka 3.0.0 and following a tutorial to run this command:
kafka-topics.sh --command-config playground.config --bootstrap-server localhost:9092 --topic first_topic --create --partitions 5 --replication-factor 1
but get the following error:
[2025-01-04 14:09:04,953] WARN [AdminClient clientId=adminclient-1] Connection to node -1 (localhost./127.0.1.1:9092) terminated during authentication. This may happen due to any of the following reasons: (1) Authentication failed due to invalid credentials with brokers older than 1.0.0, (2) Firewall blocking Kafka TLS traffic (eg it may only allow HTTPS traffic), (3) Transient network issue. (org.apache.kafka.clients.NetworkClient)
The playground config has the following settings:
security.protocol=SASL_SSL
sasl.mechanism=PLAIN
sasl.jaas.config=org.apache.kafka.common.security.plain.PlainLoginModule required username="username" password="password"
I read that the username and password is defined in the jaas.conf file, but I can't seem to find that file. I checked in the following locations:
So my question is do I need to provide a username and password? The server.properties doesn't explicitly define that SASL has to be used.
I didn't have provide a config file so the below line worked.
kafka-topics.sh --bootstrap-server localhost:9092 --topic first_topic --create --partitions 5 --replication-factor 1