Zookeeper 获取java.nio.file,在Windows上的Kafka访问被拒绝异常

beq87vna  于 2022-12-16  发布在  Apache
关注(0)|答案(3)|浏览(152)

I tried to setup kafka and zookeeper on windows. Initially I created topics, producers and consumers. It was working fine. Then I deleted one topic by using the below command:
kafka-run-class.bat kafka.admin.TopicCommand --delete --topic junk --zookeeper localhost:2181
Now every time I re-run the kafka, it gets terminated with the below error: java.nio.file.AccessDeniedException: C:\kafka_2.12-2.8.0\kafka_2.12-2.8.0kafka-logs\junk-0 -> C:\kafka_2.12-2.8.0\kafka_2.12-2.8.0kafka-logs\junk-0.305f67a1260f4cccb87d9367c6619fd2-delete
I tried to remove the zookeper and kafka directory and use a fresh directory for both. But somehow its retaining the previous saved topics and logs (I don't know what location they're stored at).
Could anyone tell me how to fix this?

osh3o9ms

osh3o9ms1#

我在使用新版本kafka_2.12-3.0.0时也遇到了同样的问题。使用较低版本kafka_2.12-2.8.1解决了这个问题

ukqbszuj

ukqbszuj2#

Login as admin, and try the below topic path/location the logs and

  1. delete it manuallyor delete all your logs (both kafka & zookeeper logs) if you want to try fresh
    /tmp/kafka-logs/[yourTopics] // Delete *** Kafka Logs
    Now go back and try again. If you are still running into the problem then disable the cleaner
    log.cleaner.enable = false
  2. Next, I would recommend stopping all services and then type %temp% in windows command, and delete all the temp files as well
  • in linux*
// find stale files older than for more than `7 days` 
// and deletes those, not folders. 
sudo find /tmp -type f -atime +7-delete
  1. Finally, you will need to delete the zookeeper logs and kill the running zoo keeper process see this answer here are you using the confluent stack?
// kill the zookeeper process
  ps aux | grep zookeeper
  sudo kill -9 <PID>     // or windows admin

 // find and delete **** ZooKeeper logs
  ps -ef | grep zookeeper | grep zookeeper.log.dir --color    
  lsof -p <pid of zookeeper> | grep log
  lsof -p <pid of zookeeper> | grep out

Update to comment below - yes you can run on windows, with the WSL 2 subsystem/Linux 2 link from official confluent site

dohp0rv5

dohp0rv53#

我假设您的Kafka服务器是绑定到Zookeeper。如果真的,那么我们得到这个错误时,任何主题被删除。
要解决此问题,我们需要删除apache-zookeeper-home\conf\zoo.cfg文件中配置的数据目录文件夹

相关问题