Reputation: 508
Environment
Apache Nifi 1.12.1 running in Docker 18.09.7 on Ubuntu 18.04.4 LTS
Problem
How do I add an existing custom NAR to Nifi running in Docker without killing the container.
Tried
I have a mount from host to container where I can drop NARs.
#1 Restart Nifi
Then I copy the NAR to the /lib
dir.
Restart Nifi but this kills container
#2 Copy NAR from mount dir to /extensions
dir
As per: https://www.nifi.rocks/auto-loading-extensions/
But nothing happens
I need to be able to add NARs to Nifi without losing my container
Any help/tips will be much appreciated
docker-compose.yml
version: '3'
services:
nifi:
build: ./nifi
container_name: nifi
ports:
- 7777:8080
volumes:
- ./data:/opt/nifi/nifi-current/data
Dockerfile
FROM apache/nifi:latest
RUN mkdir /opt/nifi/nifi-current/data
RUN chown -R nifi:nifi /opt/nifi/nifi-current/data
EXPOSE 8080
EDIT
Looks like copy of NAR into /extensions
dir is loading the NAR
020-10-06 10:35:15,707 INFO [NAR Auto-Loader] org.apache.nifi.nar.StandardNarLoader Starting load process for 1 NARs...
2020-10-06 10:35:15,836 INFO [NAR Auto-Loader] org.apache.nifi.nar.StandardNarLoader Creating class loaders for 1 NARs...
2020-10-06 10:35:15,838 INFO [NAR Auto-Loader] org.apache.nifi.nar.NarClassLoaders Loaded NAR file: /opt/nifi/nifi-current/./work/nar/extensions/my-nar-1.0-SNAPSHOT.nar-unpacked as class loader org.apache.nifi.nar.NarClassLoader[./work/nar/extensions/my-nar-1.0-SNAPSHOT.nar-unpacked]
2020-10-06 10:35:15,838 INFO [NAR Auto-Loader] org.apache.nifi.nar.StandardNarLoader Successfully created class loaders for 1 NARs, 0 were skipped
2020-10-06 10:35:16,076 INFO [NAR Auto-Loader] org.apache.nifi.nar.StandardNarLoader Finished NAR l
But it is not showing up in Add Processor
list ...
EDIT
Just needed to refresh Nifi UI in browser to see the processor
Upvotes: 0
Views: 2632
Reputation: 89
gary!
I meet this problem as same condition.
This is my solution.
mount another path and use cp XXX.nar /opt/nifi/nifi-current/extensions.
It realy work.
I guest this problem is AUTOLOAD nar use WatchService but it can't watch files are mounted by docker.
TEST IN Ubuntu
in Ubuntu,i use this command to run nifi.
docker run -d -v /root/nifitar:/opt/nifi/nifi-current/extensions -e TZ=Asia/Shanghai -p 8080:8080 apache/nifi:1.13.2
and then i copy nars into /root/nifitar in host,nar shows in UI. so it works, if you are in ubuntu, you can mount dockerdir on host filesystem,and it will work.
Upvotes: 0
Reputation: 508
Solution
#2 Copy NAR from mount dir to /extensions dir did the trick.
So I drop NAR into mounted dir, then copy NAR to /extensions
In nifi-app.log
can see the NAR being loaded
And then refresh UI and processor can be added to canvas
Upvotes: 3