「Confluent」:修訂間差異
跳至導覽
跳至搜尋
本頁面具有訪問限制。如果您看見此訊息,這代表您沒有訪問本頁面的權限。
(→訊息) |
|||
(未顯示同一使用者於中間所作的 28 次修訂) | |||
行 9: | 行 9: | ||
在PoC時我使用了三台<code>t3.small</code>(2 GB RAM,另外手動設定加上512 MB Swap),三台都安裝完整的套件並且跑起來,一開始不會有問題,但跑一陣子後會因為記憶體不足而異常。 | 在PoC時我使用了三台<code>t3.small</code>(2 GB RAM,另外手動設定加上512 MB Swap),三台都安裝完整的套件並且跑起來,一開始不會有問題,但跑一陣子後會因為記憶體不足而異常。 | ||
建議在正式環境 | 建議在正式環境 下,ZooKeeper與Kafka 分 開跑,都 使用<code>m5.large</code>(8 GB RAM)或是更好的機器執行。 | ||
== 安裝 == | == 安裝 == | ||
當然要先裝[[Java]]: | 當然要先裝[[Java]] ,然後安裝社群版本 : | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
sudo apt install -y default-jre | sudo apt install -y default-jre | ||
wget -qO - https://packages.confluent.io/deb/5.3/archive.key | sudo apt-key add -; sudo add-apt-repository "deb [arch=amd64] https://packages.confluent.io/deb/5.3 stable main"; sudo apt install -y confluent-community-2.12 | |||
</syntaxhighlight> | </syntaxhighlight> | ||
== 設定ZooKeeper == | |||
{{Main|Confluent/ZooKeeper}} | |||
== 設定Kafka == | |||
{{Main|Confluent/Kafka}} | |||
== | == 基本操作 == | ||
=== topic === | |||
topic的操作都是透過<code>kafka-topics</code>處理,使用<code>--zookeeper</code>指定ZooKeeper位置(可省略Port資訊,預 設 使用2181)。 | |||
建立是<code>--create</code>: | |||
<syntaxhighlight lang=" | <syntaxhighlight lang="bash"> | ||
kafka-topics --zookeeper internal-test-kafka-zookeeper-lb-123456789.ap-southeast-1.elb.amazonaws.com --create --topic test --replication-factor 3 --partitions 1 | |||
zookeeper | |||
</syntaxhighlight> | </syntaxhighlight> | ||
觀看是透過<code>--list</code> (簡易)或是<code>--describe</code> (詳細) : | |||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
kafka-topics --zookeeper internal-test-kafka-zookeeper-lb-123456789.ap-southeast-1.elb.amazonaws.com --list | |||
</syntaxhighlight> | </syntaxhighlight> | ||
<syntaxhighlight lang="bash"> | |||
kafka-topics --zookeeper internal-test-kafka-zookeeper-lb-123456789.ap-southeast-1.elb.amazonaws.com --describe | |||
</syntaxhighlight> | |||
刪除topic則是透過<code>--delete</code> : | |||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
kafka-topics --zookeeper internal-test-kafka-zookeeper-lb-123456789.ap-southeast-1.elb.amazonaws.com --delete --topic test | |||
</syntaxhighlight> | </syntaxhighlight> | ||
預 設 值只會標記(<code>MarkedForDeletion</code>), 而非實際刪除 : | |||
<syntaxhighlight lang=" | <pre> | ||
Topic test is marked for deletion. | |||
Note: This will have no impact if delete.topic.enable is not set to true. | |||
</pre> | |||
=== 訊息 === | |||
{{更新|time=2019-12-31T10:36:45+00:00}} | |||
把目前的日期資訊傳到<code>test</code>裡: | |||
<syntaxhighlight lang="bash"> | |||
date | kafka-console-producer --zookeeper internal-test-kafka-zookeeper-lb-123456789.ap-southeast-1.elb.amazonaws.com --topic test | |||
</syntaxhighlight> | </syntaxhighlight> | ||
接收訊息,並且從頭開始收(<code>--from-beginning</code>) : | |||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
kafka-console-consumer --zookeeper internal-test-kafka-zookeeper-lb-123456789.ap-southeast-1.elb.amazonaws.com --topic test --from-beginning | |||
</syntaxhighlight> | </syntaxhighlight> | ||
== 設定其他套件 == | == 設定其他套件 == | ||
上面提到的是Kafka最低運作的設定,通常會安裝其他的套件提供服務。要注意其他的套件會需要額外的CPU與記憶體資源。 | |||
啟動Schema Registry: | 啟動Schema Registry: |
於 2019年12月31日 (二) 10:36 的修訂
Confluent是一家公司,也是該公司的Apache Kafka產品線的產品名。
簡介
Confluent是Apache Kafka發明人出來開的公司,也是目前最知名的Kafka商業支援服務。同時Confluent也是該公司推出的軟體品牌,提供了眾多的Open Source套件用以管理Kafka Cluster(即社群版本元件),另外提供商用版本,包括Control Center(提供三十天試用)。
硬體
在PoC時我使用了三台t3.small
(2 GB RAM,另外手動設定加上512 MB Swap),三台都安裝完整的套件並且跑起來,一開始不會有問題,但跑一陣子後會因為記憶體不足而異常。
建議在正式環境下,ZooKeeper與Kafka分開跑,都使用m5.large
(8 GB RAM)或是更好的機器執行。
安裝
當然要先裝Java,然後安裝社群版本:
sudo apt install -y default-jre
wget -qO - https://packages.confluent.io/deb/5.3/archive.key | sudo apt-key add -; sudo add-apt-repository "deb [arch=amd64] https://packages.confluent.io/deb/5.3 stable main"; sudo apt install -y confluent-community-2.12
設定ZooKeeper
設定Kafka
基本操作
topic
topic的操作都是透過kafka-topics
處理,使用--zookeeper
指定ZooKeeper位置(可省略Port資訊,預設使用2181)。
建立是--create
:
kafka-topics --zookeeper internal-test-kafka-zookeeper-lb-123456789.ap-southeast-1.elb.amazonaws.com --create --topic test --replication-factor 3 --partitions 1
觀看是透過--list
(簡易)或是--describe
(詳細):
kafka-topics --zookeeper internal-test-kafka-zookeeper-lb-123456789.ap-southeast-1.elb.amazonaws.com --list
kafka-topics --zookeeper internal-test-kafka-zookeeper-lb-123456789.ap-southeast-1.elb.amazonaws.com --describe
刪除topic則是透過--delete
:
kafka-topics --zookeeper internal-test-kafka-zookeeper-lb-123456789.ap-southeast-1.elb.amazonaws.com --delete --topic test
預設值只會標記(MarkedForDeletion
),而非實際刪除:
Topic test is marked for deletion. Note: This will have no impact if delete.topic.enable is not set to true.
訊息
本條目需要更新。(2019年12月31日) |
把目前的日期資訊傳到test
裡:
date | kafka-console-producer --zookeeper internal-test-kafka-zookeeper-lb-123456789.ap-southeast-1.elb.amazonaws.com --topic test
接收訊息,並且從頭開始收(--from-beginning
):
kafka-console-consumer --zookeeper internal-test-kafka-zookeeper-lb-123456789.ap-southeast-1.elb.amazonaws.com --topic test --from-beginning
設定其他套件
上面提到的是Kafka最低運作的設定,通常會安裝其他的套件提供服務。要注意其他的套件會需要額外的CPU與記憶體資源。
啟動Schema Registry:
sudo service confluent-schema-registry start
sudo service confluent-schema-registry status
啟動Kafka Connect:
sudo service confluent-kafka-connect start
sudo service confluent-kafka-connect status
啟動Kafka REST Proxy:
sudo service confluent-kafka-rest start
sudo service confluent-kafka-rest status
啟動KSQL:
sudo service confluent-ksql start
sudo service confluent-ksql status