kafka概述

image.png

Apache kafka 開源分布式事件流平臺,用于數(shù)據(jù)管道、流分析、數(shù)據(jù)集成等。
kafka由servers和clients組成,通過TCP網(wǎng)絡(luò)協(xié)議交流。

event (record or message)

Event key: "Alice"
Event value: "Made a payment of $200 to Bob"
Event timestamp: "Jun. 25, 2020 at 2:06 p.m."
optional metadata headers

Producer vs Consumer

Producers are those client applications that publish (write) events to Kafka, and consumers are those that subscribe to (read and process) these events.

Topic

事件存儲在topic中
Topics in Kafka are always multi-producer and multi-subscriber: a topic can have zero, one, or many producers that write events to it, as well as zero, one, or many consumers that subscribe to these events.
每個topic都支持多生產(chǎn)者&多消費(fèi)者。

partition 分區(qū)

Topics are partitioned, meaning a topic is spread over a number of "buckets" located on different Kafka brokers.
topic是分區(qū)的,這意味著一個topic分布在位于不同Kafka代理上的多個“桶”上。

image.png

Kafka guarantees that any consumer of a given topic-partition will always read that partition's events in exactly the same order as they were written.
消費(fèi)的順序跟生產(chǎn)的順序嚴(yán)格一致。

數(shù)據(jù)安全

A common production setting is a replication factor of 3, i.e., there will always be three copies of your data.
數(shù)據(jù)都是備份的,默認(rèn)備3份。

APIs

admin API 管理
producer API 生產(chǎn)
consumer API 消費(fèi)
streams API 事件流處理高級功能
connect API 負(fù)責(zé)導(dǎo)入導(dǎo)出數(shù)據(jù)

安裝

  1. tar包安裝,像ES
  2. docker鏡像
  3. Zookeeper

python SDK kafka-python(kafka-python-ng)

查看官方文檔https://kafka-python.readthedocs.io/en/master/index.html

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容