简体   繁体   English

Kafka SASL_SSL 认证错误,如何认证?

[英]Kafka SASL_SSL Authentication error, how authenticate?

I'm working in Java with a pipeline that consumes data from a Kafka Cluster, it's available on我在 Java 工作,使用一条从 Kafka 集群消耗数据的管道,它可以在

https://github.com/confluentinc/confluent-google-examples/blob/master/ccloud-dataflow-demo/entry-df-pipeline/src/main/java/com/ecuevas/DataflowPipeline.java https://github.com/confluentinc/confluent-google-examples/blob/master/ccloud-dataflow-demo/entry-df-pipeline/src/main/java/com/ecuevas/DataflowPipeline.java

According to the repository, the props and pipeline are defined:根据存储库, propspipeline被定义为:

        Map<String, Object> props = new HashMap<>();
        props.put("auto.offset.reset", "earliest");
        props.put("ssl.endpoint.identification.algorithm", "https");
        props.put("sasl.mechanism", "PLAIN");
        props.put("request.timeout.ms", 20000);
        props.put("retry.backoff.ms", 500);
        props.put("security.protocol", "SASL_SSL");
        props.put("sasl.jaas.config",String.format("org.apache.kafka.common.security.
        plain.PlainLoginModule required username=\"%s\" password=\"%s\";",username, password));

        LogKafkaMsg logKafkaMsg = new LogKafkaMsg();

        Pipeline pipeline = Pipeline.create(options);

        PCollection<KV<String, String>> entries =
                pipeline
                        .apply(
                                "Read Entries from Confluent Cloud Topic",
                                KafkaIO.<String, String>read()
                                        .withBootstrapServers("<your-bootstrap-server>")
                                        .withTopic("entries")
                                        .withConsumerConfigUpdates(props)
                                        .withKeyDeserializer(StringDeserializer.class)
                                        .withValueDeserializer(StringDeserializer.class)
                                        .withoutMetadata()
                        );

My problem is when the code is executed, returns the following error:我的问题是执行代码时,返回以下错误:

at org.apache.beam.runners.dataflow.DataflowRunner.run(DataflowRunner.java:969)
        at org.apache.beam.runners.dataflow.DataflowRunner.run(DataflowRunner.java:198)
        at org.apache.beam.sdk.Pipeline.run(Pipeline.java:322)
        at org.apache.beam.sdk.Pipeline.run(Pipeline.java:308)
        at com.ecuevas.DataflowPipeline.main(DataflowPipeline.java:214)
Caused by: org.apache.kafka.common.errors.SaslAuthenticationException: Invalid SASL/PLAIN response: expected 3 tokens, got 4

Probably the issue is related with the SASL/PLAIN authentication, but I don't know a possible solution.问题可能与 SASL/PLAIN 身份验证有关,但我不知道可能的解决方案。 I think that is related with:我认为这与以下方面有关:

  • SSL authentication: Include ca-cert , ca-key , ca-password or another special. SSL 身份验证:包括ca-certca-keyca-password或其他特殊的。
  • Dependencies updates: The libraries versions aren't updated.依赖项更新:库版本未更新。

Seems like Dataflow VMs are not authenticated to connect to the Kafka cluster.似乎 Dataflow 虚拟机未通过身份验证以连接到 Kafka 集群。 Have you tried authenticating using a keystore certificate file per instructions here ?您是否尝试过按照此处的说明使用密钥库证书文件进行身份验证?

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用 SASL_SSL / PLAIN 连接时出现 Kafka AdminClient 错误 - Kafka AdminClient error when connecting using SASL_SSL / PLAIN 如何在Java中使用sasl机制PLAIN和安全协议SASL_SSL配置kafka使用者? - How to configure kafka consumer with sasl mechanism PLAIN and with security protocol SASL_SSL in java? 如何使用 SASL_SSL 连接 Apache Kafka 设置 Spring Cloud Kafka 项目? - How can I setup Spring Cloud Kafka project with SASL_SSL connect Apache Kafka? Java 堆空间 - 超出 memory 错误 - 带有 SASL_SSL 的 Kafka 代理 - Java heap space - Out of memory error - Kafka Broker with SASL_SSL 我们需要 Kafka SASL_SSL 证书吗? - Do we need Certificate for Kafka SASL_SSL? Kafka SaslAuthenticationException在Ad-hoc基础上发布SASL_SSL协议 - Kafka SaslAuthenticationException Occuring on Ad-hoc basis for SASL_SSL Protocol SASL_SSL 安全协议如何工作? 客户端是否验证服务器(X.509 证书)? - How does SASL_SSL security protocol work? Does client verify the server (X.509 cert)? Smack和SASL身份验证错误-没有已知的身份验证机制 - Smack and SASL Authentication error - No known authentication mechanisims 设置客户端 SASL 身份验证以连接两个不同的 kafka 集群 - Setup client side SASL authentication to connect with two different kafka clusters org.apache.kafka.common.errors.TimeoutException:使用 jaas SASL 配置身份验证获取 Kafka 集群的主题元数据时超时 - org.apache.kafka.common.errors.TimeoutException: Timeout expired while fetching topic metadata for Kafka Cluster using jaas SASL config authentication
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM