英文:
Why Karafka Server Throw error query watermark offset?
问题
我正在为我的Ruby on Rails应用程序使用这个宝石来生成和消费来自Kafka服务器的消息。 https://karafka.io/docs/
这是我的karafka.rb文件
# frozen_string_literal: true
class KarafkaApp < Karafka::App
setup do |config|
config.kafka = { "bootstrap.servers": ENV["KAFKA_BOOTSTRAP_SERVERS"] }
config.client_id = "store"
config.consumer_persistence = !Rails.env.development?
end
Karafka.monitor.subscribe(Karafka::Instrumentation::LoggerListener.new)
Karafka.producer.monitor.subscribe(
WaterDrop::Instrumentation::LoggerListener.new(Karafka.logger)
)
Karafka.monitor.subscribe "error.occurred" do |event|
type = event[:type]
error = event[:error]
details = (error.backtrace || []).join("\n")
puts "Oh no! An error: #{error} of type: #{type} occurred!"
puts details
puts "=" * 100
NewRelic::Agent.notice_error(error)
end
routes.draw do
topic "payment-order" do
consumer PaymentOrderConsumer
end
topic "payment-method-config" do
consumer PaymentMethodConsumer
end
topic "order-refund" do
consumer OrderRefundConsumer
end
end
end
Karafka::Web.enable!
相当长一段时间后,我遇到了这个错误
“查询karafka_consumers_states的分区0的水印偏移错误 - 本地:未知分区(unknown_partition)
”
消费者仍然正常消费新消息,但我定期收到上面的错误。
我在Google上没有找到其他错误。
我尝试在服务器上安装bash和librdkafka。
只使用一个Kafka引导服务器。
这是Kafka服务器上已经存在的主题。
1: https://i.stack.imgur.com/a7zPr.jpg
英文:
I'm using this gem for my Ruby on Rails Apps to produce and consume message from kafka server.
https://karafka.io/docs/
and this is my karafka.rb file
# frozen_string_literal: true
class KarafkaApp < Karafka::App
setup do |config|
config.kafka = {"bootstrap.servers": ENV["KAFKA_BOOTSTRAP_SERVERS"]}
config.client_id = "store"
config.consumer_persistence = !Rails.env.development?
end
Karafka.monitor.subscribe(Karafka::Instrumentation::LoggerListener.new)
Karafka.producer.monitor.subscribe(
WaterDrop::Instrumentation::LoggerListener.new(Karafka.logger)
)
Karafka.monitor.subscribe "error.occurred" do |event|
type = event[:type]
error = event[:error]
details = (error.backtrace || []).join("\n")
puts "Oh no! An error: #{error} of type: #{type} occurred!"
puts details
puts "=" * 100
NewRelic::Agent.notice_error(error)
end
routes.draw do
topic "payment-order" do
consumer PaymentOrderConsumer
end
topic "payment-method-config" do
consumer PaymentMethodConsumer
end
topic "order-refund" do
consumer OrderRefundConsumer
end
end
end
Karafka::Web.enable!
After quite sometimes, i got this error
Error querying watermark offsets for partition 0 of karafka_consumers_states - Local: Unknown partition (unknown_partition)
The consumer still consuming new message without problem, but i got error above periodically.
I'm not found another error on google.
I've tried install bash and librdkafka on server.
Only using 1 kafka bootstrap server.
答案1
得分: 1
我是Karafka的作者。
你没有仔细遵循说明。Web界面需要进行引导:https://karafka.io/docs/Web-UI-Getting-Started/
第三步:
> 运行以下命令以在您的项目中安装karafka-web:
bundle exec karafka-web install
如果没有这个步骤,Karafka Web-UI将无法获取所需的数据来运行。
您可以选择运行安装或禁用Web界面。选择权在您手中。
Karafka Web-UI提供了一个状态页面,可以帮助您识别和减轻导致Web UI出现故障或不正常工作的问题。如果您看到404页面或在Karafka Web UI上遇到问题,值得访问此页面。
英文:
I'm the Karafka author.
You did not follow the instructions thoughtfully. The web-ui requires a bootstrap: https://karafka.io/docs/Web-UI-Getting-Started/
Point 3:
> Run the following command to install the karafka-web in your project:
bundle exec karafka-web install
Without that, Karafka Web-UI cannot get the expected data to operate.
You can either run the install or you can disable the web-ui. The choice is yours.
Karafka Web-UI provides a status page that can help you identify and mitigate problems that would cause the Web UI to malfunction or misbehave. If you see the 404 page or have issues with Karafka Web UI, this page is worth visiting.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论