发布到Redpanda代理时代理不可用

huangapple go评论93阅读模式
英文:

Broker not available when publishing to Redpanda broker

问题

当我尝试向Redpanda代理发布消息时,我遇到了错误The broker is not available.。我正在使用Sarama Go Kafka客户端。以下是我创建生产者并发布消息的代码:

kafkaConfig := sarama.NewConfig()
kafkaConfig.Producer.Return.Successes = true
producer, err := sarama.NewSyncProducer(brokerList, kafkaConfig)

if err != nil {
    log.Fatalf("NewSyncProducer failed: %s", err)
    return nil, err
}

message := sarama.ProducerMessage{Topic: "my-topic", Value: sarama.ByteEncoder([]byte("foo"))}

partition, offset, err := producer.SendMessage(&message)

if err != nil {
    log.Errorln(err)
}

err包含kafka server: Broker not available. Not a client facing error, we should never receive this!!!

当我发布消息时,在systemctl日志中我看到了以下内容:

WARN  2022-11-21 17:53:23,148 [shard 3] kafka - [127.0.0.1:46790] rejecting produce request: no disk space; bytes free less than configurable threshold
ERROR 2022-11-21 17:53:25,941 [shard 0] cluster - (rate limiting dropped 359 similar messages) storage space alert: free space at 18.208% on /var/lib/redpanda/data: 23.517GiB total, 4.282GiB free, min. free 0.000bytes. Please adjust retention policies as needed to allow writing again

哪个设置控制了这个阈值?

英文:

I get error The broker is not available. when I attempt to publish a message to a Redpanda broker. I am using the Sarama Go Kafka client. Here's how I create the producer and publish a message:

kafkaConfig := sarama.NewConfig()
kafkaConfig.Producer.Return.Successes = true
producer, err := sarama.NewSyncProducer(brokerList, kafkaConfig)

if err != nil {
	log.Fatalf("NewSyncProducer failed: %s", err)
	return nil, err
}

message := sarama.ProducerMessage{Topic: "my-topic", Value: sarama.ByteEncoder([]byte("foo"))}

partition, offset, err := producer.SendMessage(&message)

if err != nil {
	log.Errorln(err)
}

err contains kafka server: Broker not available. Not a client facing error, we should never receive this!!!

In the systemctl log I see this when I publish a message:

WARN  2022-11-21 17:53:23,148 [shard 3] kafka - [127.0.0.1:46790] rejecting produce request: no disk space; bytes free less than configurable threshold
ERROR 2022-11-21 17:53:25,941 [shard 0] cluster - (rate limiting dropped 359 similar messages) storage space alert: free space at 18.208% on /var/lib/redpanda/data: 23.517GiB total, 4.282GiB free, min. free 0.000bytes. Please adjust retention policies as needed to allow writing again

What setting controls this threshold?

答案1

得分: 1

@user2233706 - 你需要先创建主题。否则,请确保 etc/redpanda/redpanda.yaml 中的 autocreate topics 设置为 true。

英文:

@user2233706 - you need to create the topic first. Otherwise ensure that etc/redpanda/redpanda.yaml has autocreate topics set to true.

huangapple
  • 本文由 发表于 2022年11月22日 06:10:39
  • 转载请务必保留本文链接:https://go.coder-hub.com/74525422.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定