DEV Community

Carlos A. Martinez
Carlos A. Martinez

Posted on • Updated on

How to Install and Run Apache Kafka on Windows?

Hi coders

Apache Kafka

Apache Kafka is an open-source distributed event streaming platform used by thousands of companies for high-performance data pipelines, streaming analytics, data integration, and mission-critical applications.

Download Apache Kafka

Save and extract file for example:
C:\Software\Kafka\kafka_2.13-3.1.0

Change the directory into file zookeper.properties and server.properties

zookeper.properties

Image description

Typing next command

> zookeeper-server-start.bat ..\..\config\zookeeper.properties

server.properties

Image description

Typing next command

> kafka-server-start.bat ..\..\config\server.properties

Topic

Create

>kafka-topics.bat --bootstrap-server localhost:9092 --create --replication-factor 1 --partitions 1 --topic test1

Created topic test1.

Describe

>kafka-topics.bat --bootstrap-server localhost:9092 --describe --topic test1

Topic: test1
TopicId: dhcREXgtS1e_047--6necw
PartitionCount: 1
ReplicationFactor: 1
Configs: segment.bytes=1073741824
Topic: test1
Partition: 0
Leader: 0
Replicas: 0
Isr: 0

List

>kafka-topics.bat --bootstrap-server localhost:9092 --list

test1

Update

>kafka-topics.bat --bootstrap-server localhost:9092 --alter --topic test1 --partitions 10

Delete

>kafka-topics.bat --bootstrap-server localhost:9092 --delete --topic test1

Producer

Create

>kafka-console-producer.bat --broker-list localhost:9092 --topic
test1

holi
qeu mas
carlos
hola

Consumer

Create

>kafka-console-consumer.bat --bootstrap-server localhost:9092 --topic test1 --from-beginning
holi
qeu mas
carlos
hola

>kafka-console-consumer.bat --bootstrap-server localhost:9092 --topic test1 --from-beginning --property print.key=true --property key.separator=" - "

  • --property print.key=true
  • --property key.separator=" - "

Source

Top comments (0)