Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

KAFKA - ERROR Failed to write meta.properties due to (kafka.server.BrokerMetadataCheckpoint)

Tags:

apache-kafka

I set up Kafka source code read environment on Windows10, and encourted with error below, so what is wrong, I am a fresh man to learn kafka

[2021-04-29 19:57:42,957] ERROR Failed to write meta.properties due to (kafka.server.BrokerMetadataCheckpoint)
java.nio.file.AccessDeniedException: C:\Users\a\workspace\kafka\logs
    at sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:83)
    at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:97)
    at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:102)
    at sun.nio.fs.WindowsFileSystemProvider.newFileChannel(WindowsFileSystemProvider.java:115)
[2021-04-29 19:57:42,973] ERROR [KafkaServer id=0] Fatal error during KafkaServer startup. Prepare to shutdown (kafka.server.KafkaServer)
java.nio.file.AccessDeniedException: C:\Users\a\workspace\kafka\logs
    at sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:83)
    at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:97)
    at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:102)
    at sun.nio.fs.WindowsFileSystemProvider.newFileChannel(WindowsFileSystemProvider.java:115)

and another ERROR below

[2021-04-29 19:57:43,821] ERROR Error while writing to checkpoint file C:\Users\a\workspace\kafka\logs\recovery-point-offset-checkpoint (kafka.server.LogDirFailureChannel)
java.nio.file.AccessDeniedException: C:\Users\a\workspace\kafka\logs
    at sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:83)
    at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:97)
    at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:102)
    at sun.nio.fs.WindowsFileSystemProvider.newFileChannel(WindowsFileSystemProvider.java:115)
[2021-04-29 19:57:43,823] ERROR Disk error while writing recovery offsets checkpoint in directory C:\Users\a\workspace\kafka\logs: Error while writing to checkpoint file C:\Users\a\workspace\kafka\logs\recovery-point-offset-checkpoint (kafka.log.LogManager)
[2021-04-29 19:57:43,833] ERROR Error while writing to checkpoint file C:\Users\a\workspace\kafka\logs\log-start-offset-checkpoint (kafka.server.LogDirFailureChannel)
java.nio.file.AccessDeniedException: C:\Users\a\workspace\kafka\logs
    at sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:83)
    at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:97)
    at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:102)
    at sun.nio.fs.WindowsFileSystemProvider.newFileChannel(WindowsFileSystemProvider.java:115)
[2021-04-29 19:57:43,834] ERROR Disk error while writing log start offsets checkpoint in directory C:\Users\a\workspace\kafka\logs: Error while writing to checkpoint file C:\Users\a\workspace\kafka\logs\log-start-offset-checkpoint (kafka.log.LogManager)
like image 606
IT man Avatar asked Apr 29 '21 12:04

IT man


People also ask

How do I fix Kafka cluster ID error?

The following steps fixed my Kafka’s problem. Step 1: Get the new Cluster ID from the error logs. You can check the error logs and find the new cluster id. There is a file with the name meta.properties. This file is located within the kafka-logs directory.

Is it possible to run Kafka on Linux?

You can try to run Kafka on a Linux file system using WSL 2 (not WSL 1). @GQuintana Yes. Running on WSL 2 seems to be the only working way. Thanks. I have the same problem. Previous version of Kafka (2.8.1) works ok.

What happens to Kafka broker when system reboots?

Kafka uses zookeeper for broker to broker communication. By default zookeeper’s data directory is configured to /tmp location. So if the system reboots, the tmp directory gets cleared and this results in a complete new registration of the Kafka cluster which results in a new cluster id.

Does Kafka have a data directory?

Similarly Kafka also has a data directory. The permanent solution is to maintain a persistent data directory for kafka and zookeeper. This will ensure the same state even after a server reboot.


Video Answer


2 Answers

I downgraded to the Kafka 2.8.1 version (https://dlcdn.apache.org/kafka/2.8.1) and after that everything is working perfectly.

like image 126
João Godinho Avatar answered Oct 19 '22 02:10

João Godinho


This is a common error when log retention happens. Version does not matter.

Kafka simply doesn't have good support for windows filesystem.

You can use WSL2 or Docker to work around these limitations - https://www.confluent.io/blog/set-up-and-run-kafka-on-windows-linux-wsl-2/

like image 37
OneCricketeer Avatar answered Oct 19 '22 03:10

OneCricketeer