我使用默认的kafka安装(来自Apache: https://archive.apache.org/dist/kafka/2.0.0/kafka_2.11-2.0.0.tgz)版本kafka_1 .11-0.11.0.1。
在我的服务器。属性,我使用侦听器作为listeners=PLAINTEXT://myhostname.com:9092
在我的消费者。属性我使用zookeeper.connect=myhostname.com:2181
在我的生产者。属性我使用bootstrap.servers=myhostname.com:9092
其他配置与默认包相同。
也没有应用身份验证,但在我的jass.conf (/home/user_aiman/jass.conf)中,我看到了以下几个实体,尽管我不知道它们是做什么的:
KafkaClient {
com.sun.security.auth.module.Krb5LoginModule required
useKeyTab=true
storeKey=false
debug=true
doNotPrompt=true
keyTab="/local/1/home/user_aiman/.krb5/user_aiman.keytab"
principal="user_aiman@INTRANET.BARCAPINT.COM";
client=true
refreshKrb5Config=true;
}
但是当我启动zookeeper时,它给我错误:
user_aiman@myhostname:~/kafka_local/kafka_2.11-0.11.0.1$ bin/zookeeper-server-start.sh config/zookeeper.properties
[2023-04-06 03:44:01,616] INFO Reading configuration from: config/zookeeper.properties (org.apache.zookeeper.server.quorum.QuorumPeerConfig)
[2023-04-06 03:44:01,623] INFO autopurge.snapRetainCount set to 3 (org.apache.zookeeper.server.DatadirCleanupManager)
[2023-04-06 03:44:01,623] INFO autopurge.purgeInterval set to 0 (org.apache.zookeeper.server.DatadirCleanupManager)
[2023-04-06 03:44:01,623] INFO Purge task is not scheduled. (org.apache.zookeeper.server.DatadirCleanupManager)
[2023-04-06 03:44:01,623] WARN Either no config or no quorum defined in config, running in standalone mode (org.apache.zookeeper.server.quorum.QuorumPeerMain)
[2023-04-06 03:44:01,691] INFO Reading configuration from: config/zookeeper.properties (org.apache.zookeeper.server.quorum.QuorumPeerConfig)
[2023-04-06 03:44:01,693] INFO Starting server (org.apache.zookeeper.server.ZooKeeperServerMain)
[2023-04-06 03:44:01,724] INFO Server environment:zookeeper.version=3.4.10-39d3a4f269333c922ed3db283be479f9deacaa0f, built on 03/23/2017 10:13 GMT (org.apache.zookeeper.server.ZooKeeperServer)
[2023-04-06 03:44:01,725] INFO Server environment:host.name=myhostname.intranet.barcapint.com (org.apache.zookeeper.server.ZooKeeperServer)
[2023-04-06 03:44:01,725] INFO Server environment:java.version=1.8.0_141 (org.apache.zookeeper.server.ZooKeeperServer)
[2023-04-06 03:44:01,725] INFO Server environment:java.vendor=Oracle Corporation (org.apache.zookeeper.server.ZooKeeperServer)
[2023-04-06 03:44:01,725] INFO Server environment:java.home=/usr/java/jdk1.8.0_141/jre (org.apache.zookeeper.server.ZooKeeperServer)
[2023-04-06 03:44:01,726] INFO Server environment:java.class.path=:/home/user_aiman/kafka_local/kafka_2.11-0.11.0.1/bin/../libs/aopalliance-repackaged-2.5.0-b05.jar:/home/user_aiman/kafka_local/kafka_2.11-0.11.0.1/bin/../libs/argparse4j-0.7.0.jar:/home/user_aiman/kafka_local/kafka_2.11-0.11.0.1/bin/../libs/commons-lang3-3.5.jar:/home/user_aiman/kafka_local/kafka_2.11-0.11.0.1/bin/../libs/connect-api-0.11.0.1.jar:/home/user_aiman/kafka_local/kafka_2.11-0.11.0.1/bin/../libs/connect-file-0.11.0.1.jar:/home/user_aiman/kafka_local/kafka_2.11-0.11.0.1/bin/../libs/connect-json-0.11.0.1.jar:/home/user_aiman/kafka_local/kafka_2.11-0.11.0.1/bin/../libs/connect-runtime-0.11.0.1.jar:/home/user_aiman/kafka_local/kafka_2.11-0.11.0.1/bin/../libs/connect-transforms-0.11.0.1.jar:/home/user_aiman/kafka_local/kafka_2.11-0.11.0.1/bin/../libs/guava-20.0.jar:/home/user_aiman/kafka_local/kafka_2.11-0.11.0.1/bin/../libs/hk2-api-2.5.0-b05.jar:/home/user_aiman/kafka_local/kafka_2.11-0.11.0.1/bin/../libs/hk2-locator-2.5.0-b05.jar:/home/user_aiman/kafka_local/kafka_2.11-0.11.0.1/bin/../libs/hk2-utils-2.5.0-b05.jar:/home/user_aiman/kafka_local/kafka_2.11-0.11.0.1/bin/../libs/jackson-annotations-2.8.5.jar:/home/user_aiman/kafka_local/kafka_2.11-0.11.0.1/bin/../libs/jackson-core-2.8.5.jar:/home/user_aiman/kafka_local/kafka_2.11-0.11.0.1/bin/../libs/jackson-databind-2.8.5.jar:/home/user_aiman/kafka_local/kafka_2.11-0.11.0.1/bin/../libs/jackson-jaxrs-base-2.8.5.jar:/home/user_aiman/kafka_local/kafka_2.11-0.11.0.1/bin/../libs/jackson-jaxrs-json-provider-2.8.5.jar:/home/user_aiman/kafka_local/kafka_2.11-0.11.0.1/bin/../libs/jackson-module-jaxb-annotations-2.8.5.jar:/home/user_aiman/kafka_local/kafka_2.11-0.11.0.1/bin/../libs/javassist-3.21.0-GA.jar:/home/user_aiman/kafka_local/kafka_2.11-0.11.0.1/bin/../libs/javax.annotation-api-1.2.jar:/home/user_aiman/kafka_local/kafka_2.11-0.11.0.1/bin/../libs/javax.inject-1.jar:/home/user_aiman/kafka_local/kafka_2.11-0.11.0.1/bin/../libs/javax.inject-2.5.0-b05.jar:/home/user_aiman/kafka_local/kafka_2.11-0.11.0.1/bin/../libs/javax.servlet-api-3.1.0.jar:/home/user_aiman/kafka_local/kafka_2.11-0.11.0.1/bin/../libs/javax.ws.rs-api-2.0.1.jar:/home/user_aiman/kafka_local/kafka_2.11-0.11.0.1/bin/../libs/jersey-client-2.24.jar:/home/user_aiman/kafka_local/kafka_2.11-0.11.0.1/bin/../libs/jersey-common-2.24.jar:/home/user_aiman/kafka_local/kafka_2.11-0.11.0.1/bin/../libs/jersey-container-servlet-2.24.jar:/home/user_aiman/kafka_local/kafka_2.11-0.11.0.1/bin/../libs/jersey-container-servlet-core-2.24.jar:/home/user_aiman/kafka_local/kafka_2.11-0.11.0.1/bin/../libs/jersey-guava-2.24.jar:/home/user_aiman/kafka_local/kafka_2.11-0.11.0.1/bin/../libs/jersey-media-jaxb-2.24.jar:/home/user_aiman/kafka_local/kafka_2.11-0.11.0.1/bin/../libs/jersey-server-2.24.jar:/home/user_aiman/kafka_local/kafka_2.11-0.11.0.1/bin/../libs/jetty-continuation-9.2.15.v20160210.jar:/home/user_aiman/kafka_local/kafka_2.11-0.11.0.1/bin/../libs/jetty-http-9.2.15.v20160210.jar:/home/user_aiman/kafka_local/kafka_2.11-0.11.0.1/bin/../libs/jetty-io-9.2.15.v20160210.jar:/home/user_aiman/kafka_local/kafka_2.11-0.11.0.1/bin/../libs/jetty-security-9.2.15.v20160210.jar:/home/user_aiman/kafka_local/kafka_2.11-0.11.0.1/bin/../libs/jetty-server-9.2.15.v20160210.jar:/home/user_aiman/kafka_local/kafka_2.11-0.11.0.1/bin/../libs/jetty-servlet-9.2.15.v20160210.jar:/home/user_aiman/kafka_local/kafka_2.11-0.11.0.1/bin/../libs/jetty-servlets-9.2.15.v20160210.jar:/home/user_aiman/kafka_local/kafka_2.11-0.11.0.1/bin/../libs/jetty-util-9.2.15.v20160210.jar:/home/user_aiman/kafka_local/kafka_2.11-0.11.0.1/bin/../libs/jopt-simple-5.0.3.jar:/home/user_aiman/kafka_local/kafka_2.11-0.11.0.1/bin/../libs/kafka_2.11-0.11.0.1.jar:/home/user_aiman/kafka_local/kafka_2.11-0.11.0.1/bin/../libs/kafka_2.11-0.11.0.1-sources.jar:/home/user_aiman/kafka_local/kafka_2.11-0.11.0.1/bin/../libs/kafka_2.11-0.11.0.1-test-sources.jar:/home/user_aiman/kafka_local/kafka_2.11-0.11.0.1/bin/../libs/kafka-clients-0.11.0.1.jar:/home/user_aiman/kafka_local/kafka_2.11-0.11.0.1/bin/../libs/kafka-log4j-appender-0.11.0.1.jar:/home/user_aiman/kafka_local/kafka_2.11-0.11.0.1/bin/../libs/kafka-streams-0.11.0.1.jar:/home/user_aiman/kafka_local/kafka_2.11-0.11.0.1/bin/../libs/kafka-streams-examples-0.11.0.1.jar:/home/user_aiman/kafka_local/kafka_2.11-0.11.0.1/bin/../libs/kafka-tools-0.11.0.1.jar:/home/user_aiman/kafka_local/kafka_2.11-0.11.0.1/bin/../libs/log4j-1.2.17.jar:/home/user_aiman/kafka_local/kafka_2.11-0.11.0.1/bin/../libs/lz4-1.3.0.jar:/home/user_aiman/kafka_local/kafka_2.11-0.11.0.1/bin/../libs/maven-artifact-3.5.0.jar:/home/user_aiman/kafka_local/kafka_2.11-0.11.0.1/bin/../libs/metrics-core-2.2.0.jar:/home/user_aiman/kafka_local/kafka_2.11-0.11.0.1/bin/../libs/osgi-resource-locator-1.0.1.jar:/home/user_aiman/kafka_local/kafka_2.11-0.11.0.1/bin/../libs/plexus-utils-3.0.24.jar:/home/user_aiman/kafka_local/kafka_2.11-0.11.0.1/bin/../libs/reflections-0.9.11.jar:/home/user_aiman/kafka_local/kafka_2.11-0.11.0.1/bin/../libs/rocksdbjni-5.0.1.jar:/home/user_aiman/kafka_local/kafka_2.11-0.11.0.1/bin/../libs/scala-library-2.11.11.jar:/home/user_aiman/kafka_local/kafka_2.11-0.11.0.1/bin/../libs/scala-parser-combinators_2.11-1.0.4.jar:/home/user_aiman/kafka_local/kafka_2.11-0.11.0.1/bin/../libs/slf4j-api-1.7.25.jar:/home/user_aiman/kafka_local/kafka_2.11-0.11.0.1/bin/../libs/slf4j-log4j12-1.7.25.jar:/home/user_aiman/kafka_local/kafka_2.11-0.11.0.1/bin/../libs/snappy-java-1.1.2.6.jar:/home/user_aiman/kafka_local/kafka_2.11-0.11.0.1/bin/../libs/validation-api-1.1.0.Final.jar:/home/user_aiman/kafka_local/kafka_2.11-0.11.0.1/bin/../libs/zkclient-0.10.jar:/home/user_aiman/kafka_local/kafka_2.11-0.11.0.1/bin/../libs/zookeeper-3.4.10.jar (org.apache.zookeeper.server.ZooKeeperServer)
[2023-04-06 03:44:01,728] INFO Server environment:java.library.path=/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib (org.apache.zookeeper.server.ZooKeeperServer)
[2023-04-06 03:44:01,728] INFO Server environment:java.io.tmpdir=/tmp (org.apache.zookeeper.server.ZooKeeperServer)
[2023-04-06 03:44:01,728] INFO Server environment:java.compiler=<NA> (org.apache.zookeeper.server.ZooKeeperServer)
[2023-04-06 03:44:01,728] INFO Server environment:os.name=Linux (org.apache.zookeeper.server.ZooKeeperServer)
[2023-04-06 03:44:01,728] INFO Server environment:os.arch=amd64 (org.apache.zookeeper.server.ZooKeeperServer)
[2023-04-06 03:44:01,728] INFO Server environment:os.version=2.6.32-696.18.7.el6.x86_64 (org.apache.zookeeper.server.ZooKeeperServer)
[2023-04-06 03:44:01,728] INFO Server environment:user.name=user_aiman (org.apache.zookeeper.server.ZooKeeperServer)
[2023-04-06 03:44:01,729] INFO Server environment:user.home=/home/user_aiman (org.apache.zookeeper.server.ZooKeeperServer)
[2023-04-06 03:44:01,729] INFO Server environment:user.dir=/local/1/home/user_aiman/kafka_local/kafka_2.11-0.11.0.1 (org.apache.zookeeper.server.ZooKeeperServer)
[2023-04-06 03:44:01,745] INFO tickTime set to 3000 (org.apache.zookeeper.server.ZooKeeperServer)
[2023-04-06 03:44:01,745] INFO minSessionTimeout set to -1 (org.apache.zookeeper.server.ZooKeeperServer)
[2023-04-06 03:44:01,745] INFO maxSessionTimeout set to -1 (org.apache.zookeeper.server.ZooKeeperServer)
[2023-04-06 03:44:01,773] ERROR No JAAS configuration section named 'Server' was foundin '/local/1/home/user_aiman/jass.conf'. (org.apache.zookeeper.server.ServerCnxnFactory)
[2023-04-06 03:44:01,775] ERROR Unexpected exception, exiting abnormally (org.apache.zookeeper.server.ZooKeeperServerMain)
java.io.IOException: No JAAS configuration section named 'Server' was foundin '/local/1/home/user_aiman/jass.conf'.
at org.apache.zookeeper.server.ServerCnxnFactory.configureSaslLogin(ServerCnxnFactory.java:200)
at org.apache.zookeeper.server.NIOServerCnxnFactory.configure(NIOServerCnxnFactory.java:82)
at org.apache.zookeeper.server.ZooKeeperServerMain.runFromConfig(ZooKeeperServerMain.java:117)
at org.apache.zookeeper.server.ZooKeeperServerMain.initializeAndRun(ZooKeeperServerMain.java:87)
at org.apache.zookeeper.server.ZooKeeperServerMain.main(ZooKeeperServerMain.java:53)
at org.apache.zookeeper.server.quorum.QuorumPeerMain.initializeAndRun(QuorumPeerMain.java:116)
at org.apache.zookeeper.server.quorum.QuorumPeerMain.main(QuorumPeerMain.java:78)
我错过了什么?是否有一种方法可以重定向到没有身份验证的其他自定义json .conf ?或者最简单的方法是什么?
-
这个链接是为Kafka 2.0.0,而不是0.11.0.1,正如你提到的。我建议你使用最新的3.4.0版本,有很多改进。
-
listeners
为0.0.0.0
监听所有接口。只有advertised.listeners
应该使用你的FQDN -
Kerberos不能与
PLAINTEXT://
一起工作,但是关于您的错误
没有名为'Server'的JAAS配置节
当你运行zookeeper-server-start
(你的错误是从Zookeeper启动,而不是Kafka)时,它说你需要一个这样的部分
Server {
...
}
更多信息
- https://docs.confluent.io/platform/current/security/zk-security.html sasl认证
- https://kafka.apache.org/documentation/security_sasl_kerberos_brokerconfig
KafkaClient
用于Kafka客户端(外部Java应用程序),而不是Zookeeper JAAS文件。
你需要一个类似的Zookeeper客户端除了Kafka自己的ServerJAAS section+一个Kafka客户端部分(至少三个JAAS部分用于安全环境),用于Kafka客户端协议上的跨代理复制。
我不明白这个问题。JAAS文件来自重定向到其他自定义jass.conf
KAFKA_OPTS
环境变量…因此,如果您实际上不想使用Kerberos,请取消此设置。
Confluent维护了Ansible安装脚本,可以为您简化这个过程…