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权威指南
跨集群数据镜像
123
另外,我们还要避免循环镜像,相同的事件不能无止境地来回镜像。对于每一个“逻辑
主题”,我们可以在每个数据中心里为它创建一个单独的主题,并确保不要从远程数据中
心复制同名的主题。例如,对于逻辑主题“
users
”,我们在一个数据中心为其创建“
SF.
users
”主题,在另一个数据中心为其创建“
NYC.users
”主题。镜像进程将
SF
的“
SF.
users
”镜像到
NYC
,同时将
NYC
的“
NYC.users
”镜像到
SF
。这样一来,每一个事件只
会被镜像一次,不过在经过镜像之后,每个数据中心同时拥有了
SF.users
NYC.users
两个主题,也就是说,每个数据中心都拥有相同的用户数据。消费者如果要读取所有的用
户数据,就需要以“
*.users
”的方式订阅主题。我们也可以把这种方式理解为数据中心的
命名空间,比如在这个例子里,
NYC
SF
就是命名空间。
在不久的将来,
Kafka
将会增加记录头部信息。头部信息里可以包含源数据中心的信息,
我们可以使用这些信息来避免循环镜像,也可以用它们来单独处理来自不同数据中心的数
据。当然,你也可以通过使用结构化的数据格式(比如
Avro
)来实现这一特性,并用它在
数据里添加标签和头部信息。不过在进行镜像时,需要做一些额外的工作,因为现成的镜
像工具并不支持自定义的头部信息格式。
8.2.4
 主备架构
有时候,使用多个集群只是为了达到灾备的目的。你可能在同一个数据中心安装了两个
集群,它们包含相同的数据,平常只使用其中的一个。当提供服务的集群完全不可用时, ...
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