Kafka Operations

From NovaOrdis Knowledge Base
Revision as of 21:38, 5 October 2023 by Ovidiu (talk | contribs) (→‎Run)
Jump to navigation Jump to search

Internal

Installation

Followed this procedure: https://kafka.apache.org/documentation/#quickstart

Run

Followed this procedure: https://kafka.apache.org/documentation/#quickstart

Run the server:

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

Create a topic:

bin/kafka-topics.sh --create --topic blue --bootstrap-server localhost:9092

Publish:

bin/kafka-console-producer.sh --topic blue --bootstrap-server localhost:9092

Consume:

bin/kafka-console-consumer.sh --topic blue --from-beginning --bootstrap-server localhost:9092

Flush a Topic

bin/kafka-delete-records.sh --bootstrap-server localhost:9092 --offset-json-file <file-name>

The file content:

{"partitions": [
  {"topic": "blue", "partition": 1, "offset": 1}],
  "version":1
}