Support Questions

Find answers, ask questions, and share your expertise

Where are NiFi templates stored?

avatar

I've created a few templates and want to save them someplace. I'm aware of the ability to download from the Web UI, but for scripting's sake would prefer to copy them from a folder somewhere. Does NiFi save templates in a folder someplace?

1 ACCEPTED SOLUTION

avatar

Randy, there is a directory within NiFi under conf IIRC. However, this will not work as easily in a cluster.

The right way is to download templates via a REST api, see what UI is doing under the hood.

View solution in original post

9 REPLIES 9

avatar

Randy, there is a directory within NiFi under conf IIRC. However, this will not work as easily in a cluster.

The right way is to download templates via a REST api, see what UI is doing under the hood.

avatar

I'm not running a cluster, so copying from a directory would be easier. Looking in $NIFI_HOME/conf, I have:

[root@monitor nifi]# ls -all conf/

total 72

drwxr-xr-x.  3 root root 4096 Aug 28 21:38 .

drwxr-xr-x. 14 root root 4096 Aug 28 21:37 ..

drwxr-xr-x.  2 root root 4096 Aug 28 21:38 archive

-rw-rw-r--.  1 root root 3781 Aug  5 18:48 authorizers.xml

-rw-rw-r--.  1 root root 2119 Aug  5 18:48 bootstrap-notification-services.xml

-rw-rw-r--.  1 root root 2906 Aug  5 18:48 bootstrap.conf

-rw-r--r--.  1 root root 8300 Aug 28 21:38 flow.xml.gz

-rw-rw-r--.  1 root root 8158 Aug  5 18:48 logback.xml

-rw-rw-r--.  1 root root 6089 Aug  5 18:48 login-identity-providers.xml

-rw-rw-r--.  1 root root 8407 Aug 28 21:36 nifi.properties

-rw-rw-r--.  1 root root 3637 Aug  5 18:48 state-management.xml

-rw-rw-r--.  1 root root 1437 Aug  5 18:48 zookeeper.properties

Unfortunately none of these contains anything resembling my "Test" template. Where else should I look, @Andrew Grande?

avatar
Super Collaborator

Hi @Andrew Grande

I am trying to download a template using rest api - where do I get the id of the template

/templates/{id}/download
I have stored the template with a name.
Thanks,
Avijeet

avatar
Expert Contributor

Hi @Avijeet Dash

You need to query the template list first.

/flow/templates

Then parse the json and get the id.

Regards,

Wendell

avatar
New Contributor

Hi @Randy Gelhausen

If you still having that problem, you can export the template by the Global Menu/Templates/

There list all the templates and have a button to download. The template is downloaded in a xml file.

Hope it helps

Regards

avatar

@Randy Gelhausen Under conf there is a templates directory where all the templates are located.

avatar
New Contributor

in which way are they stored - I did not see any templates directory after creating a test template - I can still find the template in NiFi, however it is not stored under conf, so perhaps you have a different setup?

avatar
New Contributor

running on Ubuntu: the template is stored in conf directory in a flow.xml.gz file -- try to open it in vim, then you can search for your template name, perhaps you can make a script to extract template, however it seems that it is better to use the web interface where you can download to a xml file

avatar
Rising Star

@Andrew Grande I want to delete all templates visible in the Nifi UI under Templates tab how to do it? i dont want to delete it one by one from UI.

Also in my Nifi setup my templates are not being stored in /home/nifi/conf/templates directory, so where are these stored by Nifi?

please help!!