返回到文章

采纳

编辑于
+

关于KAFKA11.0.1使用SASL_PLAINTEXT遇到的问题

kafka

完成SASL之后,生产和消费的时候就报如下错误,请大神们帮忙,快疯了

消费者命令:./bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic test --from-beginning
生产者命令:./bin/kafka-console-producer.sh --broker-list localhost:9092 --topic test

[2017-11-14 15:29:54,651] WARN Bootstrap broker localhost:9092 (id: -1 rack: null) disconnected (org.apache.kafka.clients.NetworkClient)
[2017-11-14 15:29:54,706] WARN Bootstrap broker localhost:9092 (id: -1 rack: null) disconnected (org.apache.kafka.clients.NetworkClient)
[2017-11-14 15:29:54,810] WARN Bootstrap broker localhost:9092 (id: -1 rack: null) disconnected (org.apache.kafka.clients.NetworkClient)
[2017-11-14 15:29:54,863] WARN Bootstrap broker localhost:9092 (id: -1 rack: null) disconnected (org.apache.kafka.clients.NetworkClient)
[2017-11-14 15:29:54,916] WARN Bootstrap broker localhost:9092 (id: -1 rack: null) disconnected (org.apache.kafka.clients.NetworkClient)
[2017-11-14 15:29:54,969] WARN Bootstrap broker localhost:9092 (id: -1 rack: null) disconnected (org.apache.kafka.clients.NetworkClient)
[2017-11-14 15:29:55,073] WARN Bootstrap broker localhost:9092 (id: -1 rack: null) disconnected (org.apache.kafka.clients.NetworkClient)
[2017-11-14 15:29:55,127] WARN Bootstrap broker localhost:9092 (id: -1 rack: null) disconnected (org.apache.kafka.clients.NetworkClient)
[2017-11-14 15:29:55,180] WARN Bootstrap broker localhost:9092 (id: -1 rack: null) disconnected (org.apache.kafka.clients.NetworkClient)
[2017-11-14 15:29:55,283] WARN Bootstrap broker localhost:9092 (id: -1 rack: null) disconnected (org.apache.kafka.clients.NetworkClient)
[2017-11-14 15:29:55,335] WARN Bootstrap broker localhost:9092 (id: -1 rack: null) disconnected (org.apache.kafka.clients.NetworkClient)
[2017-11-14 15:29:55,388] WARN Bootstrap broker localhost:9092 (id: -1 rack: null) disconnected (org.apache.kafka.clients.NetworkClient)
[2017-11-14 15:29:55,440] WARN Bootstrap broker localhost:9092 (id: -1 rack: null) disconnected (org.apache.kafka.clients.NetworkClient)
[2017-11-14 15:29:55,493] WARN Bootstrap broker localhost:9092 (id: -1 rack: null) disconnected (org.apache.kafka.clients.NetworkClient)
[2017-11-14 15:29:55,595] WARN Bootstrap broker localhost:9092 (id: -1 rack: null) disconnected (org.apache.kafka.clients.NetworkClient)
[2017-11-14 15:29:55,649] WARN Bootstrap broker localhost:9092 (id: -1 rack: null) disconnected (org.apache.kafka.clients.NetworkClient)
[2017-11-14 15:29:55,752] WARN Bootstrap broker localhost:9092 (id: -1 rack: null) disconnected (org.apache.kafka.clients.NetworkClient)
[2017-11-14 15:29:55,805] WARN Bootstrap broker localhost:9092 (id: -1 rack: null) disconnected (org.apache.kafka.clients.NetworkClient)
[2017-11-14 15:29:55,857] WARN Bootstrap broker localhost:9092 (id: -1 rack: null) disconnected (org.apache.kafka.clients.NetworkClient)
[2017-11-14 15:29:55,960] WARN Bootstrap broker localhost:9092 (id: -1 rack: null) disconnected (org.apache.kafka.clients.NetworkClient)
[2017-11-14 15:29:56,012] WARN Bootstrap broker localhost:9092 (id: -1 rack: null) disconnected (org.apache.kafka.clients.NetworkClient)
[2017-11-14 15:29:56,064] WARN Bootstrap broker localhost:9092 (id: -1 rack: null) disconnected (org.apache.kafka.clients.NetworkClient)

server.properties配置如下:

port=9092
listeners=SASL_PLAINTEXT://localhost:9092
security.inter.broker.protocol=SASL_PLAINTEXT
sasl.enabled.mechanisms=PLAIN
sasl.mechanism.inter.broker.protocol=PLAIN
authorizer.class.name=kafka.security.auth.SimpleAclAuthorizer
allow.everyone.if.no.acl.found=true
super.users=User:admin

kafka_server_jaas.conf配置如下:

sasl_plaintext.KafkaServer {
        org.apache.kafka.common.security.plain.PlainLoginModule required
        username="admin"
        password="admin-pwd"
        user_admin="admin-pwd"
        user_bob="bob-pwd";
};

Client {
        org.apache.kafka.common.security.plain.PlainLoginModule required
        username="admin"
        password="admin-pwd";
};

kafka_client_jaas.conf配置如下:

Client {
        org.apache.kafka.common.security.plain.PlainLoginModule required
        username="bob"
        password="bob-pwd";
};