Home >Backend Development >Golang >Is SASL lost? Franz-go kafka authentication issue

Is SASL lost? Franz-go kafka authentication issue

WBOY
WBOYforward
2024-02-08 21:40:18698browse

SASL 丢失了吗? Franz-go kafka 身份验证问题

php editor Xinyi is here to introduce to you about SASL loss and Franz-go kafka authentication issues. When using Franz-go kafka for authentication, sometimes you encounter SASL loss, causing authentication failure. This issue can be caused by a variety of reasons, such as configuration errors, network issues, etc. There are many ways to solve this problem, which can be solved by checking the configuration, restarting the service, troubleshooting the network connection, etc. In this article, we will introduce the causes and solutions to this problem in detail, hoping to help everyone.

Question content

I am getting these error messages

<code>
"re-updating metadata due to err: broker closed the connection immediately after a request was issued, which happens when SASL is required but not provided: is SASL missing?"
"read from broker errored, killing connection after 0 successful responses (is SASL missing?)"
</code>

I'm trying to add authentication. My code is:

auth := scram.Auth{
        User: "kafka_user",
        Pass: "kafka_pass",
    }
    
    cl, err := kgo.NewClient(
        kgo.SeedBrokers(seeds...),
        kgo.DialTLSConfig(tlsConfig),
        kgo.SASL(auth.AsSha512Mechanism()),
        kgo.ConsumerGroup(consumerGroupId),
        kgo.ConsumeTopics(topics...),
        kgo.WithLogger(kzap.New(logger.GetLogger())),
    )

The requirements for authentication are:

  • SSL: false
  • Security protocol: SASL_PLAINTEXT
  • SASL mechanism: SCRAM-SHA-512
  • Username:a8093152e673feb7aba1828c43532094
  • Password:a8093152e673feb7aba1828c43532094

I tried everything in the documentation. Even with the help of google bard and Bing AI and trying all possible solutions, this problem still persists.

Solution

There is no problem with the package. The code is not deployed, so the problem is not with the code but with the deployment.

The above is the detailed content of Is SASL lost? Franz-go kafka authentication issue. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:stackoverflow.com. If there is any infringement, please contact admin@php.cn delete