[
https://issues.apache.org/jira/browse/NIFI-6112?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Yoshiaki Takahashi updated NIFI-6112:
-------------------------------------
Description:
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}
was:Add toolkit commands useful for automating NiFi cluster construction.
> 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
>
> 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)