删除kafka数据(docker安装)

1.删除topic
①进入kafka容器

docker exec -it kfk bash

②使用客户端连接zookeeper

cd /opt/zookeeper/bin/
./zkCli.sh -server ip:2181  #此处写kafka地址,端口默认2181

执行删除命令

rmr /brokers/topics/topicname		#topicname为要删除的topic
rmr /brokers/topics/__consumer_offsets
quit

2.查看kafka的挂载目录

cat /opt/kafka/config/server.properties | grep log.dirs
   log.dirs=/kfk/kfk/data

3.退出容器、并删除topic

进入kafka的存储目录/kfk/kfk/data
cd /kfk/kfk/data
rm -rf topicname

4.重启kafka

你可能感兴趣的:(kafka)