Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]
Created 09-02-2016 09:30 PM
I want to use the rest api to start / stop a specific flume agent rather than the whole flume service.
Working example: I have a 5 node cluster with Ambari on node1, flume agent running on node5.
I can get the URL for the flume agent with:
curl -u admin:admin -i -H 'X-Requested-By: ambari' -X GET http://node1:8080/api/v1/clusters/Cluster/hosts/node5/host_components
This shows:
http://node1:8080/api/v1/clusters/Cluster/hosts/node5/host_components/FLUME_HANDLER
However if you try to stop it, it stops the whole flume service not just the agent:
curl -u admin:admin -i -H 'X-Requested-By: ambari' -X PUT -d '{"HostRoles": {"state": "INSTALLED"}}' http://node1:8080/api/v1/clusters/Cluster/hosts/node5/host_components/FLUME_HANDLERIs this possible using REST API?
Created 09-07-2016 01:12 PM
Just tested the below in my local environment and worked fine:
curl -u admin:admin -H "X-Requested-By: ambari" -d '{"RequestInfo":{"context":"Stop Flume agent","flume_handler":"agent","operation_level":{"level":"HOST_COMPONENT","cluster_name":"Cluster","service_name":"FLUME","host_name":"node5"}},"Body":{"HostRoles":{"state":"INSTALLED"}}}' -X PUT "http://node1:8080/api/v1/clusters/Cluster/hosts/node5/host_components/FLUME_HANDLER"
Created 09-05-2016 08:33 AM
The passing the following:
{ "RequestInfo": { "context": "Stop Flume agent", "flume_handler": "agent", "operation_level": { "level": "HOST_COMPONENT", "cluster_name": "Cluster", "service_name": "FLUME", "host_name": "node5" } }, "Body": { "HostRoles": { "state": "INSTALLED" } } }
Created 09-06-2016 12:24 PM
Thanks - what would be the URL for this @stoader. I tried with both the service and the component. e.g.
curl -u admin:admin -i -H 'X-Requested-By: ambari' -X PUT -d '{ "RequestInfo": { "context": "Stop Flume agent", "flume_handler": "agent", "operation_level": { "level": "HOST_COMPONENT", "cluster_name": "Cluster", "service_name" "FLUME", "host_name": "node5" } }, "Body": { "HostRoles": { "state": "INSTALLED" } } }' http://node1:8080/api/v1/clusters/Cluster/services/FLUME
and
curl -u admin:admin -i -H 'X-Requested-By: ambari' -X PUT -d '{ "RequestInfo": { "context": "Stop Flume agent", "flume_handler": "agent", "operation_level": { "level": "HOST_COMPONENT", "cluster_name": "Cluster", "service_name" "FLUME", "host_name": "node5" } }, "Body": { "HostRoles": { "state": "INSTALLED" } } }' http://node1:8080/api/v1/clusters/Cluster/hosts/node5/host_components/FLUME_HANDLER
Created 09-07-2016 01:12 PM
Just tested the below in my local environment and worked fine:
curl -u admin:admin -H "X-Requested-By: ambari" -d '{"RequestInfo":{"context":"Stop Flume agent","flume_handler":"agent","operation_level":{"level":"HOST_COMPONENT","cluster_name":"Cluster","service_name":"FLUME","host_name":"node5"}},"Body":{"HostRoles":{"state":"INSTALLED"}}}' -X PUT "http://node1:8080/api/v1/clusters/Cluster/hosts/node5/host_components/FLUME_HANDLER"