[
https://issues.apache.org/jira/browse/NIFI-6112?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16796854#comment-16796854
]
Yoshiaki Takahashi commented on NIFI-6112:
------------------------------------------
I Fixed output of commands, and add commands for template, controller service
and reporting tasks.
h2. fixed
* nifi list-users
** Retrieve the user list
{code}
% ./cli.sh nifi list-users
# Name ID Member of
-- ------ ------------------------------------ ------------
1 user_1 6ba52e46-0169-1000-0000-000049c07246 admin
2 user_2 6ba54b58-0169-1000-0000-000069e8abcc users
3 user_3 6bd400c3-0169-1000-ffff-ffffc605c27f admin, users
{code}
* nifi list-user-groups
** Retrieve the user group list
{code}
% ./cli.sh nifi list-user-groups
# Name ID Members
- ----- ------------------------------------ --------------
1 admin 7b549153-0169-1000-ffff-ffffd227f2c7 user_1, user_3
2 users 7b56695f-0169-1000-0000-0000210f2267 user_2, user_3
{code}
* nifi get-services
** Retrieve all reporting task controller services
{code}
% ./cli.sh nifi get-services
# Name ID
State
- ------------------------------ ------------------------------------
--------
1 Sample SSL context service 999a8a50-0169-1000-0000-000016aef111
ENABLED
2 Sample SSL context service (2) 999aafe9-0169-1000-ffff-ffff83b0061a
DISABLED
{code}
* nifi get-reporting-tasks
** Retrieve all reporting tasks
{code}
% ./cli.sh nifi get-reporting-tasks
# Name ID
Type Run Status
- ------------------------------ ------------------------------------
------------------------------- ----------
1 MonitorMemory 9946ff6f-0169-1000-ffff-ffff83d25815
MonitorMemory RUNNING
2 Sample s2s bulletin report 999f1d6a-0169-1000-ffff-ffffe8055f0e
SiteToSiteBulletinReportingTask STOPPED
3 Sample s2s bulletin report (2) 99a0819b-0169-1000-0000-00005bf4cdeb
SiteToSiteBulletinReportingTask STOPPED
{code}
* nifi get-service
** Retrieve the controller service by specifying ID
{code}
% ./cli.sh nifi get-service --controllerServiceId
999a8a50-0169-1000-0000-000016aef111
Name : Sample SSL context service
ID : 999a8a50-0169-1000-0000-000016aef111
Type : org.apache.nifi.ssl.StandardRestrictedSSLContextService
Bundle: org.apache.nifi - nifi-ssl-context-service-nar 1.8.0
State : ENABLED
{code}
h2. added
* nifi list-templates
** Retrieve the templates list
{code}
% ./cli.sh nifi list-templates
# Name ID Group ID
- ---------- ------------------------------------
------------------------------------
1 template A a2b5fbc0-e85d-33c1-9dd4-7531b9c4a027
793bc59b-0168-1000-e24c-034be9945670
2 template C 4ad1fbc0-98d0-3a55-9033-379a6191de7a
793bc59b-0168-1000-e24c-034be9945670
3 template D b2b39e4c-ed93-315b-b857-82e0af12053e
793bc59b-0168-1000-e24c-034be9945670
4 template B d916daec-20cf-3591-b4b5-3aca708914de
e5aab096-0168-1000-ffff-ffffdaf70829
5 template E 59c73cf9-d741-3d35-90f7-d8cfa614be0b
e5aab096-0168-1000-ffff-ffffdaf70829
{code}
* nifi enable-services
* nifi disable-services
** Enable/Disable all or one controller services for reporting tasks
{code}
% ./cli.sh nifi get-services
# Name ID
State
- ------------------------------ ------------------------------------
--------
1 Sample SSL context service 999a8a50-0169-1000-0000-000016aef111
DISABLED
2 Sample SSL context service (2) 999aafe9-0169-1000-ffff-ffff83b0061a
DISABLED
% ./cli.sh nifi enable-services --verbose
Controller service "Sample SSL context service (2)" (id:
999aafe9-0169-1000-ffff-ffff83b0061a) has been enabled
Controller service "Sample SSL context service" (id:
999a8a50-0169-1000-0000-000016aef111) has been enabled
% ./cli.sh nifi get-services
# Name ID
State
- ------------------------------ ------------------------------------
-------
1 Sample SSL context service 999a8a50-0169-1000-0000-000016aef111
ENABLED
2 Sample SSL context service (2) 999aafe9-0169-1000-ffff-ffff83b0061a
ENABLED
% ./cli.sh nifi disable-services --verbose
Controller service "Sample SSL context service (2)" (id:
999aafe9-0169-1000-ffff-ffff83b0061a) has been disabled
Controller service "Sample SSL context service" (id:
999a8a50-0169-1000-0000-000016aef111) has been disabled
% ./cli.sh nifi get-services
# Name ID
State
- ------------------------------ ------------------------------------
--------
1 Sample SSL context service 999a8a50-0169-1000-0000-000016aef111
DISABLED
2 Sample SSL context service (2) 999aafe9-0169-1000-ffff-ffff83b0061a
DISABLED
% ./cli.sh nifi enable-services --controllerServiceId
999aafe9-0169-1000-ffff-ffff83b0061a --verbose
Controller service "Sample SSL context service (2)" (id:
999aafe9-0169-1000-ffff-ffff83b0061a) has been enabled
% ./cli.sh nifi get-services
# Name ID
State
- ------------------------------ ------------------------------------
--------
1 Sample SSL context service 999a8a50-0169-1000-0000-000016aef111
DISABLED
2 Sample SSL context service (2) 999aafe9-0169-1000-ffff-ffff83b0061a
ENABLED
% ./cli.sh nifi enable-services
% ./cli.sh nifi get-services
# Name ID
State
- ------------------------------ ------------------------------------
-------
1 Sample SSL context service 999a8a50-0169-1000-0000-000016aef111
ENABLED
2 Sample SSL context service (2) 999aafe9-0169-1000-ffff-ffff83b0061a
ENABLED
% ./cli.sh nifi disable-services --controllerServiceId
999a8a50-0169-1000-0000-000016aef111 --verbose
Controller service "Sample SSL context service" (id:
999a8a50-0169-1000-0000-000016aef111) has been disabled
% ./cli.sh nifi get-services
# Name ID
State
- ------------------------------ ------------------------------------
--------
1 Sample SSL context service 999a8a50-0169-1000-0000-000016aef111
DISABLED
2 Sample SSL context service (2) 999aafe9-0169-1000-ffff-ffff83b0061a
ENABLED
{code}
* nifi start-reporting-tasks
* nifi stop-reporting-tasks
** Start/Stop all or one reporting tasks
{code}
% ./cli.sh nifi get-reporting-tasks
# Name ID
Type Run Status
- ------------------------------ ------------------------------------
------------------------------- ----------
1 MonitorMemory 9946ff6f-0169-1000-ffff-ffff83d25815
MonitorMemory STOPPED
2 Sample s2s bulletin report 999f1d6a-0169-1000-ffff-ffffe8055f0e
SiteToSiteBulletinReportingTask STOPPED
3 Sample s2s bulletin report (2) 99a0819b-0169-1000-0000-00005bf4cdeb
SiteToSiteBulletinReportingTask STOPPED
% ./cli.sh nifi start-reporting-tasks --verbose
Reporting task "Sample s2s bulletin report (2)" (id:
99a0819b-0169-1000-0000-00005bf4cdeb) has been running
Reporting task "Sample s2s bulletin report" (id:
999f1d6a-0169-1000-ffff-ffffe8055f0e) has been running
Reporting task "MonitorMemory" (id: 9946ff6f-0169-1000-ffff-ffff83d25815) has
been running
% ./cli.sh nifi get-reporting-tasks
# Name ID
Type Run Status
- ------------------------------ ------------------------------------
------------------------------- ----------
1 MonitorMemory 9946ff6f-0169-1000-ffff-ffff83d25815
MonitorMemory RUNNING
2 Sample s2s bulletin report 999f1d6a-0169-1000-ffff-ffffe8055f0e
SiteToSiteBulletinReportingTask RUNNING
3 Sample s2s bulletin report (2) 99a0819b-0169-1000-0000-00005bf4cdeb
SiteToSiteBulletinReportingTask RUNNING
% ./cli.sh nifi stop-reporting-tasks --verbose
Reporting task "Sample s2s bulletin report (2)" (id:
99a0819b-0169-1000-0000-00005bf4cdeb) has been stopped
Reporting task "Sample s2s bulletin report" (id:
999f1d6a-0169-1000-ffff-ffffe8055f0e) has been stopped
Reporting task "MonitorMemory" (id: 9946ff6f-0169-1000-ffff-ffff83d25815) has
been stopped
% ./cli.sh nifi get-reporting-tasks
# Name ID
Type Run Status
- ------------------------------ ------------------------------------
------------------------------- ----------
1 MonitorMemory 9946ff6f-0169-1000-ffff-ffff83d25815
MonitorMemory STOPPED
2 Sample s2s bulletin report 999f1d6a-0169-1000-ffff-ffffe8055f0e
SiteToSiteBulletinReportingTask STOPPED
3 Sample s2s bulletin report (2) 99a0819b-0169-1000-0000-00005bf4cdeb
SiteToSiteBulletinReportingTask STOPPED
% ./cli.sh nifi start-reporting-tasks --reportingTaskId
99a0819b-0169-1000-0000-00005bf4cdeb --verbose
Reporting task "Sample s2s bulletin report (2)" (id:
99a0819b-0169-1000-0000-00005bf4cdeb) has been running
% ./cli.sh nifi get-reporting-tasks
# Name ID
Type Run Status
- ------------------------------ ------------------------------------
------------------------------- ----------
1 MonitorMemory 9946ff6f-0169-1000-ffff-ffff83d25815
MonitorMemory STOPPED
2 Sample s2s bulletin report 999f1d6a-0169-1000-ffff-ffffe8055f0e
SiteToSiteBulletinReportingTask STOPPED
3 Sample s2s bulletin report (2) 99a0819b-0169-1000-0000-00005bf4cdeb
SiteToSiteBulletinReportingTask RUNNING
% ./cli.sh nifi start-reporting-tasks
% ./cli.sh nifi get-reporting-tasks
# Name ID
Type Run Status
- ------------------------------ ------------------------------------
------------------------------- ----------
1 MonitorMemory 9946ff6f-0169-1000-ffff-ffff83d25815
MonitorMemory RUNNING
2 Sample s2s bulletin report 999f1d6a-0169-1000-ffff-ffffe8055f0e
SiteToSiteBulletinReportingTask RUNNING
3 Sample s2s bulletin report (2) 99a0819b-0169-1000-0000-00005bf4cdeb
SiteToSiteBulletinReportingTask RUNNING
% ./cli.sh nifi stop-reporting-tasks --reportingTaskId
999f1d6a-0169-1000-ffff-ffffe8055f0e --verbose
Reporting task "Sample s2s bulletin report" (id:
999f1d6a-0169-1000-ffff-ffffe8055f0e) has been stopped
% ./cli.sh nifi get-reporting-tasks
# Name ID
Type Run Status
- ------------------------------ ------------------------------------
------------------------------- ----------
1 MonitorMemory 9946ff6f-0169-1000-ffff-ffff83d25815
MonitorMemory RUNNING
2 Sample s2s bulletin report 999f1d6a-0169-1000-ffff-ffffe8055f0e
SiteToSiteBulletinReportingTask STOPPED
3 Sample s2s bulletin report (2) 99a0819b-0169-1000-0000-00005bf4cdeb
SiteToSiteBulletinReportingTask RUNNING
{code}
* nifi get-reporting-task
** Retrieve the reporting task by specifying ID
{code}
% ./cli.sh nifi get-reporting-task --reportingTaskId
999f1d6a-0169-1000-ffff-ffffe8055f0e
Name : Sample s2s bulletin report
ID : 999f1d6a-0169-1000-ffff-ffffe8055f0e
Type : org.apache.nifi.reporting.SiteToSiteBulletinReportingTask
Bundle: org.apache.nifi - nifi-site-to-site-reporting-nar 1.8.0
State : STOPPED
{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: 3h 10m
> 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)