Apache Kafka:修订间差异

来自Gea-Suan Lin's Wiki
跳到导航 跳到搜索
此页面具有访问限制。如果您看见此消息,则说明您没有权限访问此页面。
无编辑摘要
 
(未显示同一用户的1个中间版本)
第3行: 第3行:
== 介紹 ==
== 介紹 ==


Kafka本身不過多處理多節點之間的效能分配問題,而是透過KRaft(以前的版本則是[[ZooKeeper]])處理。 可以從「[[#測試]]」的章節看到操作時都是指定ZooKeeper當作API Endpoint。 在Production環境上,一般我們會用TCP load balancer放在前面,讓用戶端架構比較簡單(僅需設定單一名稱)。
Kafka本身不過多處理多節點之間的效能分配問題,而是透過KRaft(以前的版本則是[[ZooKeeper]])處理。
 
在Production環境上,一般我們會用TCP load balancer放在前面,讓用戶端架構比較簡單(僅需設定單一名稱)。


== 安裝 ==
== 安裝 ==
第9行: 第11行:
{{See also|Confluent}}
{{See also|Confluent}}
 這邊建議直接裝[[Confluent]]的版本。
 這邊建議直接裝[[Confluent]]的版本。
== 測試 ==
可以這樣測試,可以透過建立一個topic簡單確認cluster是否有運作:
<syntaxhighlight lang="bash">
/opt/kafka/bin/kafka-topics.sh --describe --zookeeper test-gslin-zookeeper-xxxxxxxxx.us-east-1.elb.amazonaws.com:2181
/opt/kafka/bin/kafka-topics.sh --create --zookeeper test-gslin-zookeeper-xxxxxxxxx.us-east-1.elb.amazonaws.com:2181 --replication-factor 2 --partitions 1 --topic my-replicated-topic
/opt/kafka/bin/kafka-topics.sh --describe --zookeeper test-gslin-zookeeper-xxxxxxxxx.us-east-1.elb.amazonaws.com:2181
</syntaxhighlight>
如果ZooKeeper不是使用TCP load balancer時,可以直接指定所有的ZooKeeper主機:
<syntaxhighlight lang="bash">
/opt/kafka/bin/kafka-topics.sh --describe --zookeeper 1.2.3.4:2181,5.6.7.8:2181,9.10.11.12:2181
/opt/kafka/bin/kafka-topics.sh --create --zookeeper 1.2.3.4:2181,5.6.7.8:2181,9.10.11.12:2181 --replication-factor 2 --partitions 1 --topic my-replicated-topic
/opt/kafka/bin/kafka-topics.sh --describe --zookeeper 1.2.3.4:2181,5.6.7.8:2181,9.10.11.12:2181
</syntaxhighlight>
其中所有的<code>:2181</code>都可以簡化省略,因為ZooKeeper的預設Port就是Port 2181:
<syntaxhighlight lang="bash">
/opt/kafka/bin/kafka-topics.sh --describe --zookeeper test-gslin-zookeeper-xxxxxxxxx.us-east-1.elb.amazonaws.com
/opt/kafka/bin/kafka-topics.sh --create --zookeeper test-gslin-zookeeper-xxxxxxxxx.us-east-1.elb.amazonaws.com --replication-factor 2 --partitions 1 --topic my-replicated-topic
/opt/kafka/bin/kafka-topics.sh --describe --zookeeper test-gslin-zookeeper-xxxxxxxxx.us-east-1.elb.amazonaws.com
</syntaxhighlight>
<syntaxhighlight lang="bash">
/opt/kafka/bin/kafka-topics.sh --describe --zookeeper 1.2.3.4,5.6.7.8,9.10.11.12
/opt/kafka/bin/kafka-topics.sh --create --zookeeper 1.2.3.4,5.6.7.8,9.10.11.12 --replication-factor 2 --partitions 1 --topic my-replicated-topic
/opt/kafka/bin/kafka-topics.sh --describe --zookeeper 1.2.3.4,5.6.7.8,9.10.11.12
</syntaxhighlight>


== 相關連結 ==
== 相關連結 ==

2023年10月3日 (二) 06:48的最新版本

Apache Kafka是一套基于JavaScala,提供Streaming架构的软体。

介绍

Kafka本身不过多处理多节点之间的效能分配问题,而是透过KRaft(以前的版本则是ZooKeeper)处理。

在Production环境上,一般我们会用TCP load balancer放在前面,让用户端架构比较简单(仅需设定单一名称)。

安装

这边建议直接装Confluent的版本。

相关连结

外部连结