1

I followed this tutorial: Getting started with MiNiFi

Therefore, there is a input port in my root process group and a process group for MiNiFi. The MiNiFi Process Group, contains a Tail File Processor, a Remote Process Groupand a Connection between them.

Inside the MiNiFi Process Group I'm saving the Template, after this I download it from the Templates List and run the command:

minifi-toolkit-0.5.0\bin\config.bat transform minifi\MiNiFi2.xml minifi\minifi_config\config.yml

But it fails and says:

The JAVA_HOME environment variable is not defined correctly.
Instead the PATH will be used to find the java executable.

There are validation errors with the template, still outputting YAML but it will need to be edited.
Connection with id 10de7342-41ef-37a5-0000-000000000000 has invalid destination id 9b02eb45-3c2d-3fb4-91cf-880d5038c0cd

I re-created everything and the issue still exists.

This is my Template:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<template encoding-version="1.3">
    <description></description>
    <groupId>db4ce9c5-016e-1000-bce2-b531930a6edd</groupId>
    <name>MiNiFi</name>
    <snippet>
        <connections>
            <id>10de7342-41ef-37a5-0000-000000000000</id>
            <parentGroupId>e544a343-e2f0-3112-0000-000000000000</parentGroupId>
            <backPressureDataSizeThreshold>1 GB</backPressureDataSizeThreshold>
            <backPressureObjectThreshold>10000</backPressureObjectThreshold>
            <destination>
                <groupId>1e18bdb9-7df3-3fba-0000-000000000000</groupId>
                <id>9b02eb45-3c2d-3fb4-91cf-880d5038c0cd</id>
                <type>REMOTE_INPUT_PORT</type>
            </destination>
            <flowFileExpiration>0 sec</flowFileExpiration>
            <labelIndex>1</labelIndex>
            <loadBalanceCompression>DO_NOT_COMPRESS</loadBalanceCompression>
            <loadBalancePartitionAttribute></loadBalancePartitionAttribute>
            <loadBalanceStatus>LOAD_BALANCE_NOT_CONFIGURED</loadBalanceStatus>
            <loadBalanceStrategy>DO_NOT_LOAD_BALANCE</loadBalanceStrategy>
            <name></name>
            <selectedRelationships>success</selectedRelationships>
            <source>
                <groupId>e544a343-e2f0-3112-0000-000000000000</groupId>
                <id>246f7d78-f8e1-3c88-0000-000000000000</id>
                <type>PROCESSOR</type>
            </source>
            <zIndex>0</zIndex>
        </connections>
        <processors>
            <id>246f7d78-f8e1-3c88-0000-000000000000</id>
            <parentGroupId>e544a343-e2f0-3112-0000-000000000000</parentGroupId>
            <position>
                <x>0.0</x>
                <y>16.0</y>
            </position>
            <bundle>
                <artifact>nifi-standard-nar</artifact>
                <group>org.apache.nifi</group>
                <version>1.10.0</version>
            </bundle>
            <config>
                <bulletinLevel>WARN</bulletinLevel>
                <comments></comments>
                <concurrentlySchedulableTaskCount>1</concurrentlySchedulableTaskCount>
                <descriptors>
                    <entry>
                        <key>tail-mode</key>
                        <value>
                            <name>tail-mode</name>
                        </value>
                    </entry>
                    <entry>
                        <key>File to Tail</key>
                        <value>
                            <name>File to Tail</name>
                        </value>
                    </entry>
                    <entry>
                        <key>Rolling Filename Pattern</key>
                        <value>
                            <name>Rolling Filename Pattern</name>
                        </value>
                    </entry>
                    <entry>
                        <key>tail-base-directory</key>
                        <value>
                            <name>tail-base-directory</name>
                        </value>
                    </entry>
                    <entry>
                        <key>Initial Start Position</key>
                        <value>
                            <name>Initial Start Position</name>
                        </value>
                    </entry>
                    <entry>
                        <key>File Location</key>
                        <value>
                            <name>File Location</name>
                        </value>
                    </entry>
                    <entry>
                        <key>tailfile-recursive-lookup</key>
                        <value>
                            <name>tailfile-recursive-lookup</name>
                        </value>
                    </entry>
                    <entry>
                        <key>tailfile-lookup-frequency</key>
                        <value>
                            <name>tailfile-lookup-frequency</name>
                        </value>
                    </entry>
                    <entry>
                        <key>tailfile-maximum-age</key>
                        <value>
                            <name>tailfile-maximum-age</name>
                        </value>
                    </entry>
                </descriptors>
                <executionNode>ALL</executionNode>
                <lossTolerant>false</lossTolerant>
                <penaltyDuration>30 sec</penaltyDuration>
                <properties>
                    <entry>
                        <key>tail-mode</key>
                        <value>Single file</value>
                    </entry>
                    <entry>
                        <key>File to Tail</key>
                        <value>/opt/minifi/minifi_test_dir</value>
                    </entry>
                    <entry>
                        <key>Rolling Filename Pattern</key>
                    </entry>
                    <entry>
                        <key>tail-base-directory</key>
                    </entry>
                    <entry>
                        <key>Initial Start Position</key>
                        <value>Beginning of File</value>
                    </entry>
                    <entry>
                        <key>File Location</key>
                        <value>Local</value>
                    </entry>
                    <entry>
                        <key>tailfile-recursive-lookup</key>
                        <value>false</value>
                    </entry>
                    <entry>
                        <key>tailfile-lookup-frequency</key>
                        <value>10 minutes</value>
                    </entry>
                    <entry>
                        <key>tailfile-maximum-age</key>
                        <value>24 hours</value>
                    </entry>
                </properties>
                <runDurationMillis>0</runDurationMillis>
                <schedulingPeriod>0 sec</schedulingPeriod>
                <schedulingStrategy>TIMER_DRIVEN</schedulingStrategy>
                <yieldDuration>1 sec</yieldDuration>
            </config>
            <executionNodeRestricted>false</executionNodeRestricted>
            <name>TailFile</name>
            <relationships>
                <autoTerminate>false</autoTerminate>
                <name>success</name>
            </relationships>
            <state>STOPPED</state>
            <style/>
            <type>org.apache.nifi.processors.standard.TailFile</type>
        </processors>
        <remoteProcessGroups>
            <id>1e18bdb9-7df3-3fba-0000-000000000000</id>
            <parentGroupId>e544a343-e2f0-3112-0000-000000000000</parentGroupId>
            <position>
                <x>696.0</x>
                <y>0.0</y>
            </position>
            <comments></comments>
            <communicationsTimeout>30 sec</communicationsTimeout>
            <contents>
                <inputPorts>
                    <batchSettings/>
                    <comments></comments>
                    <concurrentlySchedulableTaskCount>1</concurrentlySchedulableTaskCount>
                    <connected>true</connected>
                    <exists>true</exists>
                    <groupId>db4d2e20-016e-1000-d3c7-73a67e2b1d67</groupId>
                    <id>9b02eb45-3c2d-3fb4-91cf-880d5038c0cd</id>
                    <name>input_minifi</name>
                    <targetId>dadd7f29-016e-1000-3c91-89495c813674</targetId>
                    <targetRunning>false</targetRunning>
                    <transmitting>false</transmitting>
                    <useCompression>false</useCompression>
                </inputPorts>
            </contents>
            <proxyHost></proxyHost>
            <proxyUser></proxyUser>
            <targetUri>http://nifi-server:8080/nifi</targetUri>
            <targetUris>http://nifi-server:8080/nifi</targetUris>
            <transportProtocol>RAW</transportProtocol>
            <yieldDuration>10 sec</yieldDuration>
        </remoteProcessGroups>
    </snippet>
    <timestamp>12/06/2019 13:04:03 UTC</timestamp>
</template>

This is the toolkit result:

MiNiFi Config Version: 3
Flow Controller:
  name: MiNiFi
  comment: ''
Core Properties:
  flow controller graceful shutdown period: 10 sec
  flow service write delay interval: 500 ms
  administrative yield duration: 30 sec
  bored yield duration: 10 millis
  max concurrent threads: 1
  variable registry properties: ''
FlowFile Repository:
  partitions: 256
  checkpoint interval: 2 mins
  always sync: false
  Swap:
    threshold: 20000
    in period: 5 sec
    in threads: 1
    out period: 5 sec
    out threads: 4
Content Repository:
  content claim max appendable size: 10 MB
  content claim max flow files: 100
  always sync: false
Provenance Repository:
  provenance rollover time: 1 min
  implementation: org.apache.nifi.provenance.MiNiFiPersistentProvenanceRepository
Component Status Repository:
  buffer size: 1440
  snapshot frequency: 1 min
Security Properties:
  keystore: ''
  keystore type: ''
  keystore password: ''
  key password: ''
  truststore: ''
  truststore type: ''
  truststore password: ''
  ssl protocol: ''
  Sensitive Props:
    key:
    algorithm: PBEWITHMD5AND256BITAES-CBC-OPENSSL
    provider: BC
Processors:
- id: 246f7d78-f8e1-3c88-0000-000000000000
  name: TailFile
  class: org.apache.nifi.processors.standard.TailFile
  max concurrent tasks: 1
  scheduling strategy: TIMER_DRIVEN
  scheduling period: 0 sec
  penalization period: 30 sec
  yield period: 1 sec
  run duration nanos: 0
  auto-terminated relationships list: []
  Properties:
    File Location: Local
    File to Tail: /opt/minifi/minifi_test_dir
    Initial Start Position: Beginning of File
    Rolling Filename Pattern:
    tail-base-directory:
    tail-mode: Single file
    tailfile-lookup-frequency: 10 minutes
    tailfile-maximum-age: 24 hours
    tailfile-recursive-lookup: 'false'
Controller Services: []
Process Groups: []
Input Ports: []
Output Ports: []
Funnels: []
Connections:
- id: 10de7342-41ef-37a5-0000-000000000000
  name: TailFile/success/9b02eb45-3c2d-3fb4-91cf-880d5038c0cd
  source id: 246f7d78-f8e1-3c88-0000-000000000000
  source relationship names:
  - success
  destination id: 9b02eb45-3c2d-3fb4-91cf-880d5038c0cd
  max work queue size: 10000
  max work queue data size: 1 GB
  flowfile expiration: 0 sec
  queue prioritizer class: ''
Remote Process Groups:
- id: 1e18bdb9-7df3-3fba-0000-000000000000
  name: ''
  url: http://nifi-server:8080/nifi
  comment: ''
  timeout: 30 sec
  yield period: 10 sec
  transport protocol: RAW
  proxy host: ''
  proxy port: ''
  proxy user: ''
  proxy password: ''
  local network interface: ''
  Input Ports:
  - id: dadd7f29-016e-1000-3c91-89495c813674
    name: input_minifi
    comment: ''
    max concurrent tasks: 1
    use compression: false
  Output Ports: []
NiFi Properties Overrides: {}
seb
  • 4,279
  • 2
  • 25
  • 36

1 Answers1

3

Edit:

It appears there is a bug in the toolkit (MINIFI-521 reported by @seb) where the targetId is used in the template as the input port id but the connection id isn't being mapped appropriately.

Previous:

If I remember correctly, the toolkit expects the template it processes to be entirely self-contained.

The template is referencing the input port from the root process group.

This will cause it to be missing when only the template is exported and converted for use with MiNiFi.

I'd suggest moving your input port down into the process group that you're going to create a template of.

Bryan
  • 963
  • 4
  • 8
  • But this seems unituitive, isn't the template to run inside MiNiFi. Why should the MiNiFi handle an input port which should be remote? (I added only a Remote-PG entered the url and the input port was added by NiFi) – seb Dec 06 '19 at 14:11
  • The template is for logic that should run solely in MiNiFi, your NiFi flow should be designed separately. You can send data from MiNiFi to NiFi by putting a remote output port inside the template that's pointed at your NiFi instance and then exporting it. You could send data from NiFi to MiNiFi by having the remote output port in your NiFi flow and pointing it at an input port in the template. – Bryan Dec 06 '19 at 14:21
  • Thank you for helping me. I tried the output port, but there is no setting for defining the remote host. The RPG seems to be the right thing to do, as described here: https://community.cloudera.com/t5/Support-Questions/Sending-data-from-local-pc-to-remote-process-group-on-azure/td-p/219773 – seb Dec 06 '19 at 14:52
  • Sorry, I misspoke, Remote Process Group was what I meant by 'remote output port' – Bryan Dec 06 '19 at 15:07
  • "You can send data from MiNiFi to NiFi by putting a remote output port [RPG] inside the template that's pointed at your NiFi instance and then exporting it." Yes, that's what I did and tried to accomplish. When I misentered the URL, it failed because it couldn't detect the remote input port. So, I know that the RPG is setup correctly, it finds the input port, and I can use it. But when exporting and transforming it to MiNiFi, the script has a problem with that input port. (https://nifi.apache.org/assets/images/minifi/minifi-flow.png) – seb Dec 06 '19 at 15:13
  • This could be a toolkit bug, it looks like it's taking the targetId from the template and substituting it for the input port id in the template, not properly updating connection id... – Bryan Dec 06 '19 at 16:11
  • I thought the same! I just saw that there are 3 id-types (groupId, id, target_id) and I hoped the toolkit knows what it has to use. At least the last two were suspicous. – seb Dec 06 '19 at 16:15
  • 1
    It looks like you might be able to work around the issue by deleting targetId from that template, mind trying it? – Bryan Dec 06 '19 at 16:22
  • https://github.com/apache/nifi-minifi/blob/2a1f34472d35bbd07d6d1dfcd871616771736d1e/minifi-toolkit/minifi-toolkit-configuration/src/main/java/org/apache/nifi/minifi/toolkit/configuration/dto/RemotePortSchemaFunction.java – seb Dec 06 '19 at 16:23
  • Yeah it ends, with: "No validation errors found in converted configuration." Yet, why was the targetId the problem? – seb Dec 06 '19 at 16:29
  • It doesn't look to me like it would've worked w/ targetId at any point in the repo's history, I'm wondering if that field wasn't commonly set before NiFi 1.10.0 meaning it wouldn't have mattered before? – Bryan Dec 06 '19 at 16:43
  • I can write up a JIRA for it or you can if you want your name on it :) – Bryan Dec 06 '19 at 16:43
  • It works! Thank you! (Maybe you can edit the post a little bit) – seb Dec 06 '19 at 16:48
  • I was celebrating to early, just removing the `targetId` does not fix it. A downgrade of NiFi from 1.10.0 to 1.9.2 helped, the template is now exported with the right ids! – seb Dec 09 '19 at 15:42