Persist apache nifi flow.xml.gz file in docker volume
Asked Answered
U

2

7

How can I persist the flow.xml.gz file in nifi docker container?
I am using a docker-compose file, it is giving me errors such as not finding certain files.
Didi you encounter the same issue?
Thanks

    version: "3.3"
services:
  nifi:
    image: apache/nifi
    volumes:
      - /home/ubuntu/nifi/conf:/opt/nifi/nifi-current/conf
      #- ./flow/flow.xml.gz:/opt/nifi/nifi-current/conf/flow.xml.gz
    ports:
      - "8080:8080"
Unsatisfactory answered 8/5, 2019 at 11:0 Comment(6)
missing files is usually an easy to fix error if you can share your docker-compose.yml and your folders structure (tree)Corell
Apparently I cannot volume a single file but the whole folder, do you know why?Unsatisfactory
Yes you can. I am doing it. Make sure the file exists. What is the error you are getting?Corell
The commented line is the one that it is not working: "./conf/flow.xml.gz: Device or resource busy"Unsatisfactory
I got that far. So either the source or the destination are busy and cannot be accessed. You can debug this by first changing the destination to /tmp/x.tar.gz (a file that doesn't exist already)Corell
I have added detailed description hereKoan
U
3

Apparently NiFi doesn't allow you to only persist the flow.xml.gz file, it gives error and the container shuts.
You need to persist the whole /opt/nifi/nifi-current/conf/ folder

Unsatisfactory answered 28/5, 2019 at 19:41 Comment(3)
Well, yes. When you mount only a file, you cannot remove the file.. Only inline override it. So the equivalent of editing a folder inline, is editing its files!Pandemic
Can you add link to the DockerFile and docker-compose.yml. I am facing this issue and would like to understand how you resolve it. I am new to docker so not able to understand the answer.Allenaallenby
@MurtazaHaji You can follow the steps described here[https://mcmap.net/q/1626722/-versioning-and-persisting-nifi-flowfiles-with-nifi-registry-and-docker]Koan
M
0

I solved this issue changing the path for the flow.xml.gz to another directory. Here is my docker-compose.yaml for reference:

version: "3.9"
services:

  nifi:
    container_name: nifi
    image: apache/nifi:1.15.0
    ports:
      - 8443:8443
    volumes:
      - ./config:/conf
    environment:
      - SINGLE_USER_CREDENTIALS_USERNAME=admin
      - SINGLE_USER_CREDENTIALS_PASSWORD=S3curePa55word
      - NIFI_SENSITIVE_PROPS_KEY=pUaEVgyGKT61fMCAWNbjJPMwAcQDuDj4
    entrypoint: >
      bash -c "echo Overwriting entrypoint
      && echo Replace path for flow.xml.gz
      && sed -i 's#=./conf/flow.xml.gz#=/conf/flow.xml.gz#g' /opt/nifi/nifi-current/conf/nifi.properties
      && /opt/nifi/scripts/start.sh"
Mlle answered 16/12, 2021 at 14:54 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.