控制台生产者中的领导者不可用Kafka,带有ssl + acl配置

时间:2017-11-29 12:58:43

标签: ssl apache-kafka kafka-producer-api

我正在尝试使用kafka 0.11.0.1和ssl + acls 。我的配置如下。

server.properties:

broker.id=0
listeners=PLAINTEXT://127.0.0.1:9092,SSL://127.0.0.1:9093
advertised.listeners=SSL://127.0.0.1:9093
num.network.threads=3
num.io.threads=8
socket.send.buffer.bytes=102400
socket.receive.buffer.bytes=102400  
socket.request.max.bytes=104857600 
log.dirs=/tmp/kafka-logs
num.partitions=1
num.recovery.threads.per.data.dir=1
offsets.topic.replication.factor=1
transaction.state.log.replication.factor=1
transaction.state.log.min.isr=1
log.segment.bytes=1073741824
zookeeper.connect=localhost:2181
zookeeper.connection.timeout.ms=6000
group.initial.rebalance.delay.ms=0
ssl.keystore.location=/u/jewel/ssl+acl/kafka_2.11-0.11.0.1/kaf-new/server.keystore.jks
ssl.keystore.password=test1234
ssl.key.password=test1234
ssl.truststore.location=/u/jewel/ssl+acl/kafka_2.11-0.11.0.1/kaf-new/server.truststore.jks
ssl.truststore.password=test1234

producer.properties:

bootstrap.servers=localhost:9093
compression.type=none
ssl.keystore.location=/u/jewel/ssl+acl/kafka_2.11-0.11.0.1/prod/server.keystore.jks
ssl.keystore.password=test123
ssl.key.password=test123
security.protocol=SSL
ssl.truststore.location=/u/jewel/ssl+acl/kafka_2.11-0.11.0.1/kaf-new/client.truststore.jks
ssl.truststore.password=test1234

服务器上的CN如下:

subject=/C=in/ST=maha/L=mum/O=atos/OU=atos/CN=kafka    
issuer=/C=in/ST=maha/L=mum/O=atos/OU=atos/CN=kafka/emailAddress=abc@gmail.com

生产者的CN如下:

subject=/C=in/ST=maha/L=mum/O=atos/OU=atos/CN=kaf

当我运行生成_i.e。

的命令时
$ kafka-console-producer.sh --broker-list localhost:9093 --topic test --producer.config client-ssl.properties

我能够制作。但是,只要我将下面的行添加到server.properties包括带有SSL生成的ACLS失败:

authorizer.class.name=kafka.security.auth.SimpleAclAuthorizer

我使用以下命令创建了acls:

$ bin/kafka-acls --authorizer-properties zookeeper.connect=localhost:2181 --add --allow-principal User:CN=kaf,OU=atos,O=atos,L=mum,ST=maha,C=in --producer --topic hel  

失败,出现以下错误:

>helo  
 [2017-11-29 12:29:02,845] WARN Error while fetching metadata with 
  correlation id 1 : {hel=LEADER_NOT_AVAILABLE} 
 (org.apache.kafka.clients.NetworkClient)  

请建议一种方法来继续这些配置。

1 个答案:

答案 0 :(得分:1)

我忘了添加必须是server.properties的典型CN的super.users属性。

添加解决了我的问题