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权威指南
18
2
# /usr/local/kafka/bin/kafka-console-consumer.sh --zookeeper
localhost:2181 --topic test --from-beginning
Test Message 1
Test Message 2
^C
Consumed 2 messages
#
2.3
 
broker
配置
Kafka
发行包里自带的配置样本可以用来安装单机服务,但并不能满足大多数安装场景的
要求。
Kafka
有很多配置选项,涉及安装和调优的方方面面。不过大多数调优选项可以使
用默认配置,除非你对调优有特别的要求。
2.3.1
 常规配置
有一些配置选项,在单机安装时可以直接使用默认值,但在部署到其他环境时要格外小
心。这些参数是单个服务器最基本的配置,它们中的大部分需要经过修改后才能用在集
群里。
1. broker.id
每个
broker
都需要有一个标识符,使用
broker.id
来表示。它的默认值是
0
,也可以被设置
成其他任意整数。这个值在整个
Kafka
集群里必须是唯一的。这个值可以任意选定,如果
出于维护的需要,可以在服务器节点间交换使用这些
ID
。建议把它们设置成与机器名具有
相关性的整数,这样在进行维护时,将
ID
号映射到机器名就没那么麻烦了。例如,如果
机器名包含唯一性的数字(比如
host1.example.com
host2.example.com
),那么用这些数字
来设置
broker.id
就再好不过了。
2. port
如果使用配置样本来启动
Kafka ...
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