Kafka is not restarting - cleared logs, disk space. Restarted but it turns off again and again - apache-kafka

We are a talent system and have installed Zookeeper and Kafka on our AWS instance to send our requests to the core engine to get matches.
On our UI we are getting the error:
NoBrokersAvailable
and when we check Kafka is down. We restart it and it's still down. We checked for the logs and cleared it and also we checked cleared disk space.
Still the same problem of Kafka not starting. What should we do?

Related

When one Broker has a problem, what is the best way to resolve the situation?

If I have three Brokers running in Kafka cluster, and one of them failed due to an error. So I only have two running brokers left.
1) Usually, when this happens, restarting a failed broker will solve the problem?
2) If restarting the broker wouldn't solve the problem, can I erase all the data that the failed Broker had and restart it? (Because all the data will be restored by two other Brokers). Is this method okay in production? If not, why?
When I was testing Kafka with my desktop on Windows 10 long time ago, if a Broker has an error and the restarting the server wouldn't work, I erased all the data. Then, it began to run okay. (I am aware of Kafka and Windows issues.) So, I am curious if this would work on multi-clustered Kafka (Linux) environments.
Ultimately, it depends what the error is. If it is a networking error, then there is nothing necessarily wrong with the logs, so you should leave them alone (unless they are not being replicated properly).
The main downside of deleting all data from a broker is that some topics may only have one replica, and it is on that node. Or if you lose other brokers while the replication is catching up, then all data is potentially gone. Also, if you have many TB of data that is replicating back to one node, then you have to be aware of any disk/network contention that may occur, and consider throttling the replication (which would take hours for the node to be healthy again)
But yes, Windows and Linux ultimately work the same in this regard, and it is one way to address a clustered environment

Kafka Storage Exception

I am getting this Kafka Storage Exception : Halting due to unrecoverable IO error in handling produce requests exception periodically in every 3-4 days from some time. It causes my broker to shutdown which causes uncommitted offsets resulting in loss of data.
Can someone please suggest reason for the same.
One of the reasons could be If you are using windows machine to run kafka broker.Kafka logs might be getting stored in windows drive(C:) . Try changing the kafka logs Dir from C: drive to D: \ drive and never faced the issue.
Ensure that you disk has enough space.
Try deleting Kafka-logs dir(Please do not even think of trying this in production) and perform zookeeper logs clean up as well.

After reboot KAFKA topic appears to be lost

Having installed KAFKA and having looked at these posts:
kafka loses all topics on reboot
Kafka topic no longer exists after restart
and thus moving kafka-logs to /opt... location, I still note that when I reboot:
I can re-create the topic again.
the kafka-logs directory contains information on topics, offsets etc. but it gets corrupted.
I am wondering how to rectify this.
Testing of new topics prior to reboot works fine.
There can be two potential problems
If it is kafka running in docker, then docker image restart always cleans up the previous state and creates a new cluster hence all topics are lost.
Check the log.dir or Zookeeper data path. If either is set to /tmp directory, it will be cleaned on each reboot. Hence you will lose all logs and topics will be lost.
In this VM I noted the Zookeeper log was defined on /tmp. Changed that to /opt (presume it should be /var though) and the clearing of Kafka data when instance terminated was corrected. Not sure how to explain this completely.

kafka-manager process getting automatically killed?

I am using kafka-manager version 1.1 to monitor kafka, and kafka version is 2.11-1.1.0. And zk version is 3.4.10.
zookeeper is working fine. But sometimes kafka brokers gets automatically killed, and it thorows only a single message on terminal "killed" and gets stopped the same is happening for kafka manager too.
I have 64GB RAM and when I checked RAM usage then I found that only 1GB RAM is being used by all the processes and still I have 63GB RAM. So I think memory is not an issue here. But I did not find the reason why it is stopping processes.
Please suggest me what I need to change?
Thanks in advance.

How to create a durable topic in kafka

I am new to kafka and am still learning the basics of the same. I want to create a durable topic which is preserved even after the zoopkeeper and/or kafka server shutdown.
What I notice it this - I have a zookeeper and kafka server running on my local macbook. When I shutdown the zookeeper server and again bring it up quickly I can see the previously created topics. But If I restart the system and then restart the zookeeper server - I dont see the topic that I had created earlier.
I am running kafka_2.9.2-0.8.1.1 on my local system.
It happens because /tmp is getting cleaned after reboot resulting in loss of your data.
To fix this modify your Zookeeper dataDir property (in config/zookeeper.properties) and Kafka log.dirs (in config/server.properties) to be somewhere NOT in /tmp.