Uploaded image for project: 'Apache NiFi'
  1. Apache NiFi
  2. NIFI-6112

Add some useful commands to NiFi Toolkit for automating NiFi cluster construction.

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.9.0
    • 1.10.0
    • Tools and Build

    Description

      Add toolkit commands useful for automating NiFi cluster construction.

      Commands for "User"

      • nifi create-user
        • Add a user
          % ./cli.sh nifi create-user --userName user_1
          6ba52e46-0169-1000-0000-000049c07246
          % ./cli.sh nifi create-user --userName user_2
          6ba54b58-0169-1000-0000-000069e8abcc
          % ./cli.sh nifi create-user --userName user_3          
          6bd400c3-0169-1000-ffff-ffffc605c27f
          
      • nifi list-users
        • Retrieve the user list
          % ./cli.sh nifi list-users
          
          #   Name                                       Member of   
          -   ----------------------------------------   ---------   
          1   user_1                                                 
          2   user_2                                                 
          3   user_3                                                 
          

      Commands for "User group"

      • nifi create-user-group
        • Add a user group
          % ./cli.sh nifi create-user-group --userGroupName admin --userList 6ba52e46-0169-1000-0000-000049c07246
          6bd06533-0169-1000-ffff-ffffac5cfbcf
          % ./cli.sh nifi create-user-group --userGroupName users
          6bd1b4b2-0169-1000-ffff-ffffdd0ff820
          
      • nifi list-user-groups
        • Retrieve the user group list
          % ./cli.sh nifi list-user-groups                       
          
          #   Name             Members                                    
          -   --------------   ----------------------------------------   
          1   admin            user_1                                     
          2   users                                                       
          
          
      • nifi update-user-group
        • Update users belonging the user group
          % ./cli.sh nifi update-user-group --userGroupId 6bd1b4b2-0169-1000-ffff-ffffdd0ff820 --userList 6ba54b58-0169-1000-0000-000069e8abcc,6bd400c3-0169-1000-ffff-ffffc605c27f
          
          % ./cli.sh nifi list-user-groups
          
          #   Name             Members                                    
          -   --------------   ----------------------------------------   
          1   admin            user_1                                     
          2   users            user_2, user_3                             
          
          

      Commands for "Access policy"

      • nifi get-policy
        • Retrieve the access policy
          % ./cli.sh nifi get-policy --accessPolicyResource /tenants --accessPolicyAction write
          Resource: /tenants
          Action  : write
          Users   :
          Groups  : admin
          
      • nifi update-policy
        • Update users authorized for the resource
          % ./cli.sh nifi update-policy --accessPolicyResource /tenants --accessPolicyAction write --userList 6ba52e46-0169-1000-0000-000049c07246,6ba54b58-0169-1000-0000-000069e8abcc --groupList 6bd06533-0169-1000-ffff-ffffac5cfbcf,6bd1b4b2-0169-1000-ffff-ffffdd0ff820
          User "user_2" (id 6ba54b58-0169-1000-0000-000069e8abcc) added
          User "user_1" (id 6ba52e46-0169-1000-0000-000049c07246) added
          User group id 6bd06533-0169-1000-ffff-ffffac5cfbcf already included
          User group "users" (id 6bd1b4b2-0169-1000-ffff-ffffdd0ff820) added
          Access policy was updated
          id: 15e4e0bd-cb28-34fd-8587-f8d15162cba5
          
          % ./cli.sh nifi get-policy --accessPolicyResource /tenants --accessPolicyAction write
          Resource: /tenants
          Action  : write
          Users   : user_2, user_1
          Groups  : admin, users
          

      Commands for "Controller service"

      • nifi create-service
        • Create a controller service
          % cat ./ssl_service.json
          {
            "component": {
              "name": "Sample SSL context service",
              "type": "org.apache.nifi.ssl.StandardRestrictedSSLContextService",
              "properties": {
                "Keystore Filename": "/tmp/sample_keystore.jks",
                "Keystore Password": "xxxxxxxxxx",
                "key-password": "xxxxxxxxxx",
                "Keystore Type": "JKS",
                "Truststore Filename": "/tmp/sample_truststore.jks",
                "Truststore Password": "xxxxxxxxxx",
                "Truststore Type": "JKS",
                "SSL Protocol": "TLS"
              }
            }
          }
          
          % ./cli.sh nifi create-service --input ./ssl_service.json
          6c31686f-0169-1000-0000-000039801d18
          
          % diff ssl_service.json ssl_service_2.json
          3c3
          <     "name": "Sample SSL context service",
          ---
          >     "name": "Sample SSL context service (2)",
          
          % ./cli.sh nifi create-service --input ./ssl_service_2.json
          6c33a5eb-0169-1000-0000-00002026adb6
          
      • nifi get-services
        • Retrieve all reporting task controller services
          % ./cli.sh nifi get-services
          
          #   Name                             State      
          -   ------------------------------   --------   
          1   Sample SSL context service       DISABLED   
          2   Sample SSL context service (2)   DISABLED   
          
          
      • nifi get-service
        • Retrieve the controller service by specifying ID
          % ./cli.sh nifi get-service --controllerServiceId 6c31686f-0169-1000-0000-000039801d18
          Name  : Sample SSL context service
          Type  : StandardRestrictedSSLContextService 1.9.0
          Bundle: org.apache.nifi - nifi-ssl-context-service-nar
          State : DISABLED
          
      • nifi pg-create-service
        • Create a controller service in specified process group
          % ./cli.sh nifi pg-create-service --input ./ssl_service.json --processGroupId $(./cli.sh nifi get-root-id)
          6c366df2-0169-1000-ffff-ffff9695c831
          
          % ./cli.sh nifi pg-get-services --processGroupId $(./cli.sh nifi get-root-id)
          
          #   Name                               State      
          -   --------------------------------   --------   
          1   Sample SSL context service         DISABLED   
          
          

      Commands for "Reporting task"

      • nifi create-reporting-task
        • Create a reporting task
          % cat s2s_report.json
          {
            "component": {
              "name": "Sample s2s bulletin report",
              "type": "org.apache.nifi.reporting.SiteToSiteBulletinReportingTask",
              "properties": {
                "Destination URL": "https://${hostname(true)}:9443/nifi",
                "Input Port Name": "s2s_report_port",
                "SSL Context Service": "6c31686f-0169-1000-0000-000039801d18",
                "Instance URL": "https://${hostname(true)}:9443/nifi",
                "Compress Events": "true",
                "Communications Timeout": "30 secs",
                "s2s-transport-protocol": "RAW",
                "Platform": "nifi"
              }
            }
          }
          
          % ./cli.sh nifi create-reporting-task --input s2s_report.json
          6c424303-0169-1000-0000-000078c1291f
          
      • nifi get-reporting-tasks
        • Retrieve all reporting tasks
          % ./cli.sh nifi get-reporting-tasks                          
          
          #   Name                         Type                              Run Status   
          -   --------------------------   -------------------------------   ----------   
          1   Sample s2s bulletin report   SiteToSiteBulletinReportingTask   STOPPED      
          
          

      Commands for "Flow template"

      • nifi download-template
        • Download the flow template file
          % ./cli.sh nifi download-template --templateId 4ad1fbc0-98d0-3a55-9033-379a6191de7a -o /tmp/sample_template.xml
          % ls -l /tmp/sample_template.xml
          -rw------- 1 root root 41378 Mar 11 17:53 /tmp/sample_template.xml
          
      • nifi upload-template
        • Upload the flow template file
          % ./cli.sh nifi upload-template -i /tmp/sample_template.xml --processGroupId $(./cli.sh nifi get-root-id -p ./other_cluster.properties) -p ./other_cluster.properties
          b2b39e4c-ed93-315b-b857-82e0af12053e
          

      Attachments

        Issue Links

          Activity

            People

              yoshiata Yoshiaki Takahashi
              yoshiata Yoshiaki Takahashi
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 4h 10m
                  4h 10m