Back

Explore Courses Blog Tutorials Interview Questions
+1 vote
2 views
in Big Data Hadoop & Spark by (47.6k points)

I created a Kafka topic and pushed large messages to that Kafka topic. Now I am getting an error saying:

kafka.common.InvalidMessageSizeException: invalid message size

How do I want to purge the topic so, that I can set the fetch.size for the topic?

1 Answer

0 votes
by (106k points)

To delete all the messages from a Kafka topic, you need to change the retention time of that topic the default retention time of Kafka topic is 168 hours, i.e. 7 days. In this case, you have to change the retention time to 1 second, after which the messages from the topic will be deleted. After changing the retention time, you can go ahead and change the retention time of the topic back to 168 hours.

You can change the retention of the topic by using the following command:

kafka-topics.sh --zookeeper localhost:2181 --alter --topic topic1 --config retention.ms=1000

If you wish to know about Kafka visit this Kafka Tutorial and Kafka Interview Questions.

Related questions

0 votes
1 answer
0 votes
1 answer
asked Feb 17, 2020 in Big Data Hadoop & Spark by anmolj (9k points)
0 votes
1 answer
asked Feb 17, 2020 in Big Data Hadoop & Spark by anmolj (9k points)
0 votes
1 answer
asked Feb 17, 2020 in Big Data Hadoop & Spark by anmolj (9k points)
0 votes
1 answer

Browse Categories

...