Certainly! Here's a concise Kafka cheat sheet that covers the essential concepts and commands:
Kafka Cheat Sheet:
1. Kafka Basics:
- Apache Kafka: A distributed streaming platform.
- Topics: Streams of records that Kafka organizes data into.
- Partitions: Divisions of a topic for scalability and parallelism.
- Producers: Applications that write data to Kafka topics.
- Consumers: Applications that read data from Kafka topics.
- Brokers: Kafka server instances that store and replicate messages.
2. Kafka Command Line Tools:
- Create a topic:
```
kafka-topics.sh --create --topic <topic_name> --bootstrap-server <bootstrap_servers> --partitions <num_partitions> --replication-factor <replication_factor>
```
- List topics:
```
kafka-topics.sh --list --bootstrap-server <bootstrap_servers>
```
- Produce messages:
```
kafka-console-producer.sh --topic <topic_name> --bootstrap-server <bootstrap_servers>
```
- Consume messages:
```
kafka-console-consumer.sh --topic <topic_name> --bootstrap-server <bootstrap_servers> [--from-beginning]
```
3. Kafka Configuration:
- server.properties: The main Kafka configuration file.
- zookeeper.connect: ZooKeeper connection string.
- listeners: Network listeners for Kafka.
- log.dirs: Directory where Kafka stores log data.
- num.partitions: Default number of partitions for new topics.