Skip to Content
Kafka权威指南
book

Kafka权威指南

by Neha Narkhede, Gwen Shapira, Todd Palino
January 2018
Beginner to intermediate
234 pages
7h 8m
Chinese
Posts & Telecom Press
Content preview from Kafka权威指南
98
6
6.6.1
 配置验证
从应用程序里可以很容易对
broker
和客户端配置进行验证,我们之所以建议这么做,有以
下两方面的原因。
验证配置是否满足你的需求。
帮助你理解系统的行为,了解系统的真正行为是什么,了解你对
Kafka
基本准则的理解
是否存在偏差,然后加以改进,同时了解这些准则是如何被应用到各种场景里的。这一
章的内容偏重理论,所以要确保你能够理解这些理论是如何运用于实际当中的。
Kafka
提供了两个重要的工具用于验证配置:
org.apache.kafka.tools
包里的 Verifiable
Producer VerifiableConsumer 这两个类。我们可以从命令行运行这两个类,或者把它们
嵌入到自动化测试框架里。
其思想是,VerifiableProducer 生成一系列消息,这些消息包含从
1
到你指定的某个数
字。你可以使用与生产者相同的方式来配置 VerifiableProducer,比如配置相同的 acks
重试次数和消息生成速度。在运行 VerifiableProducer 时,它会把每个消息是否成功发送
broker
的结果打印出来。VerifiableConsumer 执行的是另一个检查——它读取事件(由
VerifiableProducer 生成)并按顺序打印出这些事件。它也会打印出已提交的偏移量和再
均衡的相关信息。
你可以考虑运行以下一些测试。
首领选举:如果我停掉首领会发生什么事情?生产者和消费者重新恢复正常状态需要多
长时间?
控制器选举:重启控制器后系统需要多少时间来恢复状态? ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

精通機器學習

精通機器學習

Aurélien Géron
精通特征工程

精通特征工程

Alice Zheng, Amanda Casari
高效能PYTHON程式設計

高效能PYTHON程式設計

Micha Gorelick, Ian Ozsvald

Publisher Resources

ISBN: 9787115473271