1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Kafka OpenShift

Posted at

#コピペで即動くKafka速習

JDKインストール

apt-get install java-1.8.0-openjdk-devel

Kafka Brokerインストール

wget http://ftp.tsukuba.wide.ad.jp/software/apache/kafka/2.8.1/kafka_2.12-2.8.1.tgz
tar -xvf kafka_2.12-2.8.1.tgz
mv kafka_2.12-2.8.1 /usr/local/
cd /usr/local/kafka_2.12-2.8.1

Zookeeper起動

./bin/zookeeper-server-start.sh -daemon ./config/zookeeper.properties

Broker起動

./kafka-server-start.sh ../config/server.properties

Topic作成

./kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test
./kafka-topics.sh --list --zookeeper localhost:2181
test

Topicにメッセージ生成

./kafka-console-producer.sh --broker-list localhost:9092 --topic test
>Hellow World!
>How has COVID-19 affected your country?

Topicからメッセージ取得

./kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic test --from-beginning
Hellow World!
How has COVID-19 affected your country?
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?