Support Questions

Find answers, ask questions, and share your expertise

REST API + how to verify that component not exist on node X

avatar


hi all


by the following API we can delete the thrift server component on master01 and master03 nodes


 # curl -iv -u admin:admin -H "X-Requested-By: ambari" -X DELETE http://$AMBARI_SERVER:8080/api/v1/clusters/hdp/hosts/master01/host_components/SPARK2_THRIFTSERVER


 # curl -iv -u admin:admin -H "X-Requested-By: ambari" -X DELETE http://$AMBARI_SERVER:8080/api/v1/clusters/hdp/hosts/master03/host_components/SPARK2_THRIFTSERVER


but how to know by REST API that thrift server component , not defined on specific node ( after deletion )


Michael-Bronson
1 ACCEPTED SOLUTION

avatar
Master Mentor

@Michael Bronson

You can make the following API call to find out on how many nodes the "SPARK2_THRIFTSERVER" is installed. Please check the property "installed_count" in the response.

# curl -iv -u admin:admin -H "X-Requested-By: ambari" -X GET "http://$AMBARI_SERVER:8080/api/v1/clusters/hdp/services/SPARK2/components/SPARK2_THRIFTSERVER"


If you want to know the list of hosts where the "SPARK2_THRIFTSERVER" might be installed in your cluster and to know their current state you can make the following API call.

# curl -iv -u admin:admin -H "X-Requested-By: ambari" -X GET "http://$AMBARI_SERVER:8080/api/v1/clusters/hdp/services/SPARK2/components/SPARK2_THRIFTSERVER?fields=host_components/HostRoles/host_name,host_components/HostRoles/state"


.

View solution in original post

1 REPLY 1

avatar
Master Mentor

@Michael Bronson

You can make the following API call to find out on how many nodes the "SPARK2_THRIFTSERVER" is installed. Please check the property "installed_count" in the response.

# curl -iv -u admin:admin -H "X-Requested-By: ambari" -X GET "http://$AMBARI_SERVER:8080/api/v1/clusters/hdp/services/SPARK2/components/SPARK2_THRIFTSERVER"


If you want to know the list of hosts where the "SPARK2_THRIFTSERVER" might be installed in your cluster and to know their current state you can make the following API call.

# curl -iv -u admin:admin -H "X-Requested-By: ambari" -X GET "http://$AMBARI_SERVER:8080/api/v1/clusters/hdp/services/SPARK2/components/SPARK2_THRIFTSERVER?fields=host_components/HostRoles/host_name,host_components/HostRoles/state"


.