I also the same issue. I was setup kafka with kraft and I want to config SASL_PLAIN with SCRAM-SHA-512 for controller and broker, but when start it was error "org.apache.kafka.common.errors.SaslAuthenticationException: Authentication failed during authentication due to invalid credentials with SASL mechanism SCRAM-SHA-512"
This is my config:
server.properties
process.roles=broker,controller
node.id=1
broker.id=1
broker.rack=rack1
[email protected]:9095,[email protected]:9095,[email protected]:9095
listeners=INTERNAL://:9092,EXTERNAL://:19092,CONTROLLER://:9095
inter.broker.listener.name=INTERNAL
advertised.listeners=EXTERNAL://192.169.1.1:19092,INTERNAL://192.169.1.1:9092,CONTROLLER://192.169.1.1:9095
controller.listener.names=CONTROLLER
listener.security.protocol.map=EXTERNAL:PLAINTEXT,INTERNAL:SASL_PLAINTEXT,CONTROLLER:SASL_PLAINTEXT
sasl.enabled.mechanisms=SCRAM-SHA-512
sasl.mechanism.inter.broker.protocol=SCRAM-SHA-512
sasl.mechanism.controller.protocol=SCRAM-SHA-512
kafka_jaas.conf
internal.KafkaServer {
org.apache.kafka.common.security.scram.ScramLoginModule required
username="admin"
password="admin-secret";
};
controller.KafkaServer {
org.apache.kafka.common.security.scram.ScramLoginModule required
username="admin"
password="admin-secret";
};
ERROR [kafka-1-raft-outbound-request-thread]: Failed to send the following request due to authentication error: ClientRequest(expectResponse=true, callback=org.apache.kafka.raft.KafkaNetworkChannel$$Lambda/0x00007f2e2042b978@269e7e54, destination=3, correlationId=997, clientId=raft-client-1, createdTimeMs=1757950053205, requestBuilder=VoteRequestData(clusterId='kafkacluster', voterId=3, topics=[TopicData(topicName='__cluster_metadata', partitions=[PartitionData(partitionIndex=0, replicaEpoch=0, replicaId=1, replicaDirectoryId=YPRulu-ZAqyqmkdm2vYEGA, voterDirectoryId=AAAAAAAAAAAAAAAAAAAAAA, lastOffsetEpoch=0, lastOffset=0, preVote=true)])])) (org.apache.kafka.raft.KafkaNetworkChannel$SendThread)
org.apache.kafka.common.errors.SaslAuthenticationException: Authentication failed during authentication due to invalid credentials with SASL mechanism SCRAM-SHA-512