You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by "Yoshiaki Takahashi (JIRA)" <ji...@apache.org> on 2019/03/15 02:39:00 UTC

[jira] [Commented] (NIFI-6112) Add some useful commands to NiFi Toolkit for automating NiFi cluster construction.

    [ https://issues.apache.org/jira/browse/NIFI-6112?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16793259#comment-16793259 ] 

Yoshiaki Takahashi commented on NIFI-6112:
------------------------------------------

I fixed to support both UUID and identity for user / user group specification.
https://github.com/apache/nifi/pull/3366/commits/16905fc6384ed40cedc2ecd29e588c6fcd4ff4ea

* nifi create-user-group
** Add a user group
{code}
% ./cli.sh nifi create-user-group --userGroupName admin --userNameList user_1 --userIdList 6ba54b58-0169-1000-0000-000069e8abcc
7b549153-0169-1000-ffff-ffffd227f2c7

% ./cli.sh nifi create-user-group --userGroupName users --userNameList user_1,user_2 --userIdList 6bd400c3-0169-1000-ffff-ffffc605c27f,7b553ff5-0169-1000-ffff-fffff791e873
7b56695f-0169-1000-0000-0000210f2267

% ./cli.sh nifi list-user-groups

#   Name             Members                                    
-   --------------   ----------------------------------------   
1   admin            user_2, user_1                             
2   users            user_2, user_1, user_4, user_3             

{code}

* nifi update-user-group
** Update users belonging the user group
{code}
% # User with comma in the name is also OK
% ./cli.sh nifi update-user-group --userGroupName admin --userNameList 'user_1,"user,5"' --userIdList 6bd400c3-0169-1000-ffff-ffffc605c27f

% ./cli.sh nifi update-user-group --userGroupId 7b56695f-0169-1000-0000-0000210f2267 --userNameList 'user_2,user_3' --userIdList 7b553ff5-0169-1000-ffff-fffff791e873,7b57b34e-0169-1000-ffff-ffffc7c7b5b3

% ./cli.sh nifi list-user-groups

#   Name             Members                                    
-   --------------   ----------------------------------------   
1   admin            user_1, user_3, user,5                     
2   users            user_2, user_4, user_3, user,5             

{code}

* nifi update-policy
** Update users authorized for the resource
{code}
% ./cli.sh nifi update-policy --accessPolicyResource /tenants --accessPolicyAction write --userNameList user_1,user_2 --userIdList 6bd400c3-0169-1000-ffff-ffffc605c27f,7b553ff5-0169-1000-ffff-fffff791e873 --groupNameList admin,users --groupIdList 7f2569d5-0169-1000-ffff-ffffc83d4a80,7b5e8f50-0169-1000-0000-000020bfe76a
User "user_1" already included
User "user_2" added
User (id: 6bd400c3-0169-1000-ffff-ffffc605c27f) already included
User (id: 7b553ff5-0169-1000-ffff-fffff791e873) added
User group "admin" already included
User group "users" added
User group (id: 7f2569d5-0169-1000-ffff-ffffc83d4a80) already included
User group (id: 7b5e8f50-0169-1000-0000-000020bfe76a) 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, user_4, user_3
Groups  : admin, users, users2, admin2
{code}


> Add some useful commands to NiFi Toolkit for automating NiFi cluster construction.
> ----------------------------------------------------------------------------------
>
>                 Key: NIFI-6112
>                 URL: https://issues.apache.org/jira/browse/NIFI-6112
>             Project: Apache NiFi
>          Issue Type: New Feature
>          Components: Tools and Build
>    Affects Versions: 1.9.0
>            Reporter: Yoshiaki Takahashi
>            Assignee: Yoshiaki Takahashi
>            Priority: Major
>          Time Spent: 1.5h
>  Remaining Estimate: 0h
>
> Add toolkit commands useful for automating NiFi cluster construction.
> h2. Commands for "User"
>  * nifi create-user
>  ** Add a user
> {code}
> % ./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
> {code}
> * nifi list-users
> ** Retrieve the user list
> {code}
> % ./cli.sh nifi list-users
> #   Name                                       Member of   
> -   ----------------------------------------   ---------   
> 1   user_1                                                 
> 2   user_2                                                 
> 3   user_3                                                 
> {code}
> h2. Commands for "User group"
> * nifi create-user-group
> ** Add a user group
> {code}
> % ./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
> {code}
> * nifi list-user-groups
> ** Retrieve the user group list
> {code}
> % ./cli.sh nifi list-user-groups                       
> #   Name             Members                                    
> -   --------------   ----------------------------------------   
> 1   admin            user_1                                     
> 2   users                                                       
> {code}
> * nifi update-user-group
> ** Update users belonging the user group
> {code}
> % ./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                             
> {code}
> h2. Commands for "Access policy"
> * nifi get-policy
> ** Retrieve the access policy
> {code}
> % ./cli.sh nifi get-policy --accessPolicyResource /tenants --accessPolicyAction write
> Resource: /tenants
> Action  : write
> Users   :
> Groups  : admin
> {code}
> * nifi update-policy
> ** Update users authorized for the resource
> {code}
> % ./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
> {code}
> h2. Commands for "Controller service"
> * nifi create-service
> ** Create a controller service
> {code}
> % 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
> {code}
> * nifi get-services
> ** Retrieve all reporting task controller services
> {code}
> % ./cli.sh nifi get-services
> #   Name                             State      
> -   ------------------------------   --------   
> 1   Sample SSL context service       DISABLED   
> 2   Sample SSL context service (2)   DISABLED   
> {code}
> * nifi get-service
> ** Retrieve the controller service by specifying ID
> {code}
> % ./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
> {code}
> * nifi pg-create-service
> ** Create a controller service in specified process group
> {code}
> % ./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   
> {code}
> h2. Commands for "Reporting task"
> * nifi create-reporting-task
> ** Create a reporting task
> {code}
> % 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
> {code}
> * nifi get-reporting-tasks
> ** Retrieve all reporting tasks
> {code}
> % ./cli.sh nifi get-reporting-tasks                          
> #   Name                         Type                              Run Status   
> -   --------------------------   -------------------------------   ----------   
> 1   Sample s2s bulletin report   SiteToSiteBulletinReportingTask   STOPPED      
> {code}
> h2. Commands for "Flow template"
> * nifi download-template
> ** Download the flow template file
> {code}
> % ./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
> {code}
> * nifi upload-template
> ** Upload the flow template file
> {code}
> % ./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
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)