Skip to main content
mike_bronson7
Gold ⭐️⭐️⭐️
Jul 7, 2019 10:49 PM UTC
Solved

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


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 )


jsensharma
Platinum ⭐️⭐️
Jul 8, 2019 5:27 AM UTC

@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"


.

1 reply

jsensharma
Platinum ⭐️⭐️
Platinum ⭐️⭐️
Jul 8, 2019 5:27 AM UTC

@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"


.

Translate