Thursday, April 5, 2018

Removing Kafka topics


Removing Kafka topics
This will remove all Kafka topics and its data in the system

Delete the kafka topic as the topic would be existing already with a different configuration (replication factor, partitions and retention period). 

·            Stop kafka in all the nodes and remove all the kafka logs from each node
Stop Kafka 
service kafka stop
# confirm that it has really stopped in all the nodes
service kafka status

# remove kafka data directories
rm -rf /data/[123]/kafka/*
·            In anyone of the node, login to zookeeper command line and remove the metadata.
Remove Kafka Metadata 
# zookeeper-client
rmr /controller_epoch
rmr /brokers
rmr /admin
rmr /consumers
rmr /config
·            Start the Kafka server on all the nodes.
Remove Kafka log and start the service 
# rm -rf /var/log/kafka/*
service kafka start
# Check the kafka log to ensure that server is started properly
tail -f /var/log/kafka/logs/server.out 

No comments: