Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to clear NiFi queues?

We are creating some flows in NiFi and there might be some cases where the queues are being build up but due to some reason the flow doesn't work as expected.

At the end of the day, i would like to clear the queues and somehow would like to automate it. The question is how can we delete the queues from backend? Is there any way we can achieve that?

like image 778
Swati Sood Avatar asked Sep 30 '16 06:09

Swati Sood


People also ask

How do I delete state in NiFi?

To forget everything except flow file about processors and controllers. Bojan, stop the processor in question, right-click -> view state -> Clear.

What happens to be data if NiFi goes down?

When a node goes down, NiFi cluster manager will route the data to another node. However, queued data for the failed node will still be queued for failed node. Only that data must be manually sent over to the live node in the cluster or just bring the failed node up.

Where is NiFi data stored?

The default location of this repository is in the root directory of apache NiFi. The location of this repository can be changed by changing the property named "nifi. flowfile.

How do I check my NiFi performance?

For performance, you should be able to get a good idea of the performance by looking at the various statistics in NiFI, there are stats on each processor, process groups, and from the global menu Summary page, they all show things like FlowFiles in/out and bytes in/out.


2 Answers

In addition to the explicit "Drop Queue" function Bryan mentioned, a couple other features you may be interested are the "Back Pressure" and "FlowFile Expiration" settings on connections. These allow you to automatically control the the amount of data in any given connection. A simple explanation for each is below but for a more detail explanation I'd refer you to the Apache NiFi User Guide

Back Pressure: When a queue gets to a certain size, stop triggering the processor that feeds it.

FlowFile expiration: Once a FlowFile has spent X amount of time in the queue, it will be dropped.

like image 80
JDP10101 Avatar answered Oct 02 '22 02:10

JDP10101


In the Apache NiFi UI if you right-click on a queue there is an option to empty the queue. Anything you can do in the UI is backed by a REST service, so take a look at the REST API docs:

https://nifi.apache.org/docs/nifi-docs/rest-api/index.html

Specifically a POST to /flowfile-queues/{id}/drop-requests.

You can also use Chrome and open developer tools while using the application to see what calls it makes to the REST API when you perform certain actions.

like image 28
Bryan Bende Avatar answered Oct 02 '22 04:10

Bryan Bende