Kafka Server-在JAAS中找不到"KafkaServer" [英] Kafka Server - Could not find a 'KafkaServer' in JAAS
问题描述
我有一个独立的kafka代理,我正在尝试为其配置SASL.配置如下.我正在尝试在代理上设置SASL_PLAIN身份验证.
I have a standalone kafka broker that I'm trying to configure SASL for. Configurations are below. I'm trying to set up SASL_PLAIN authentication on the broker.
我的理解是,通过server.properties中的listener.name ...配置,我不需要jaas文件.但是我已经尝试过一种方法,看看是否可能是更好的方法.
My understanding is that with the listener.name... configuration in the server.properties, I shouldn't need the jaas file. But I've experimented with one to see if that might be a better approach.
我已经尝试了这些命令中的每一个,但是都导致相同的异常.
I have experimented with each of these commands, but both result in the same exception.
-
sudo bin/kafka-server-start etc/kafka/server.properties
-
sudo -Djava.security.auth.login.config = etc/kafka/kafka_server_jaas.conf bin/kafka-server-start etc/kafka/server.properties
显示的异常是:
KafkaServer启动期间发生致命错误.准备关闭...可以找不到'KafkaServer'或'sasl_plaintext.KafkaServer'条目JAAS配置.系统属性"java.security.auth.login.config"没有设置
Fatal error during KafkaServer startup. Prepare to shutdown... Could not find a 'KafkaServer' or 'sasl_plaintext.KafkaServer' entry in the JAAS configuration. System property 'java.security.auth.login.config' is not set
server.properties:
server.properties:
listeners=SASL_PLAINTEXT://0.0.0.0:9092
listener.security.protocol.map: SASL_PLAINTEXT:SASL_PLAINTEXT
listener.name.SASL_PLAINTEXT.plain.sasl.jaas.config:
org.apache.kafka.common.security.plain.PlainLoginModule required /
username="username" /
password="Password" /
user_username="Password";
advertised.listeners=SASL_PLAINTEXT://[ipaddress]:9092
sasl.enabled.mechanisms=PLAIN
sasl.mechanism.inter.broker.protocol=PLAIN
secutiy.inter.broker.protocol=SASL_PLAINTEXT
kafka_server_jaas.conf:
kafka_server_jaas.conf:
KafkaServer {
org.apache.kafka.common.security.plain.PlainLoginModule required
username="username"
password="Password"
user_username="Password";
};
我已经花了整整一天的时间在研究-其他人是否有这个问题的经验?
I've spent a day looking at this already - has anyone else had experience with this problem?
推荐答案
在这里输入我的错误以节省开支:
Putting my mistakes here for austerity:
- 不要从cli执行启动命令,请将它们放在.sh文件中,然后从那里运行:例如,如下所示:
zkstart
export KAFKA_OPTS="-Djava.security.auth.login.config=etc/kafka/zookeeper_jaas.conf"
bin/zookeeper-server-start etc/kafka/zookeeper.properties &
kafkastart
kafkastart
export KAFKA_OPTS=-Djava.security.auth.login.config=etc/kafka/kafka_server_jaas.conf
bin/kafka-server-start etc/kafka/server.properties
- 如果仍然遇到与配置有关的错误,请检查_jaas文件,以确保显示错误消息中的所有配置部分.如果是,则格式可能不太正确-检查每个部分中的两个分号,如果失败,请尝试完全从头(或从文档中的c&p)重新创建文件.
修改因此,对我来说,最终的解决方案是将export ....行添加到相应的kafka-server-start和zookeeper-server-start文件的开头.我花了一段时间才终于点击了一切都是文件",我才意识到脚本文件是服务的实际基础.
edit So, the final solution for me was to add the export.... lines to the beginning of the corresponding kafka-server-start and zookeeper-server-start files. It took me a while before the 'everything is a file' finally clicked and I realized the script files were the actual basis for the services.
这篇关于Kafka Server-在JAAS中找不到"KafkaServer"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!