英文:
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论