无法使用sasl\u明文身份验证启动kafka服务器

eoxn13cs  于 2021-06-05  发布在  Kafka
关注(0)|答案(1)|浏览(650)

我想逃跑 Apache KafkaWindows Server 2016 使用以下配置
服务器属性:

delete.topic.enable=true
security.inter.broker.protocol=SASL_PLAINTEXT
sasl.mechanism.inter.broker.protocol=PLAIN
sasl.enabled.mechanisms=PLAIN
authorizer.class.name=kafka.security.auth.SimpleAclAuthorizer
allow.everyone.if.no.acl.found=true
security.protocol=SASL_PLAINTEXT

listeners=SASL_PLAINTEXT://127.0.0.1:9092

advertised.listeners=SASL_PLAINTEXT://localhost:9092

listener.security.protocol.map=SASL_PLAINTEXT:SASL_PLAINTEXT

Kafka\服务器\ jaas.conf:

KafkaServer {
    org.apache.kafka.common.security.plain.PlainLoginModule required
    username="username"
    password="password"
    user_kafkaadmin="password2";
};

Client {};

开始-kafka.bat:

@echo off
SET KAFKA_OPTS = "-Djava.security.auth.login.config=C:\Kafka\config\kafka_server_jaas.conf"
C:\Kafka\bin\windows\kafka-server-start.bat C:\Kafka\config\server.properties

但是我得到以下错误

ERROR [KafkaServer id=0] Fatal error during KafkaServer startup. Prepare to shutdown (kafka.server.KafkaServer)
java.lang.IllegalArgumentException: Could not find a 'KafkaServer' or 'sasl_plaintext.KafkaServer' entry in the JAAS configuration. System property 'java.security.auth.login.config' is not set
        at org.apache.kafka.common.security.JaasContext.defaultContext(JaasContext.java:133)
        at org.apache.kafka.common.security.JaasContext.load(JaasContext.java:98)
        at org.apache.kafka.common.security.JaasContext.loadServerContext(JaasContext.java:70)
        at org.apache.kafka.common.network.ChannelBuilders.create(ChannelBuilders.java:121)
        at org.apache.kafka.common.network.ChannelBuilders.serverChannelBuilder(ChannelBuilders.java:85)
        at kafka.network.Processor.<init>(SocketServer.scala:747)
        at kafka.network.SocketServer.newProcessor(SocketServer.scala:394)
        at kafka.network.SocketServer$$anonfun$kafka$network$SocketServer$$addDataPlaneProcessors$1.apply$mcVI$sp(SocketServer.scala:279)
        at scala.collection.immutable.Range.foreach$mVc$sp(Range.scala:160)
        at kafka.network.SocketServer.kafka$network$SocketServer$$addDataPlaneProcessors(SocketServer.scala:278)
        at kafka.network.SocketServer$$anonfun$createDataPlaneAcceptorsAndProcessors$1.apply(SocketServer.scala:241)
        at kafka.network.SocketServer$$anonfun$createDataPlaneAcceptorsAndProcessors$1.apply(SocketServer.scala:238)
        at scala.collection.mutable.ResizableArray$class.foreach(ResizableArray.scala:59)
        at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:48)
        at kafka.network.SocketServer.createDataPlaneAcceptorsAndProcessors(SocketServer.scala:238)
        at kafka.network.SocketServer.startup(SocketServer.scala:121)
        at kafka.server.KafkaServer.startup(KafkaServer.scala:263)
        at kafka.server.KafkaServerStartable.startup(KafkaServerStartable.scala:44)
        at kafka.Kafka$.main(Kafka.scala:84)
        at kafka.Kafka.main(Kafka.scala)

我在配置中遗漏了什么吗?
谢谢您,

2izufjch

2izufjch1#

尝试删除等号前后的空格:
设置kafka\u opts=-djava.security.auth.login.config=c:\kafka\config\kafka\u server\u jaas.conf
因为通常你不应该在等号的两边加空格。等号前的空格将成为名称的一部分;等号后面的空格将成为值的一部分。

相关问题