Created 09-16-2019 01:40 AM
Below article shows how to restart clients on Specific host.
https://cwiki.apache.org/confluence/display/AMBARI/Restarting+host+components+via+the+API
Is there any way we can perform the same on all the hosts in the cluster at one time.
Thank you in advance.
Created 09-16-2019 04:00 AM
I was able to figure out with the help of below community article.
https://community.cloudera.com/t5/Community-Articles/How-to-install-all-clients-on-all-nodes-in-your...
script.sh
---------
curl -s -u admin:admin http://ambari:8080/api/v1/hosts|grep host_name|sed -n 's/.*"host_name" : "\([^\"]*\)".*/\1/p'>hostcluster.txt
while read line ;
do
j=$line
mkdir -p $j
curl -s -u admin:admin -H "X-Requested-By:ambari" -i -X PUT -d '{"RequestInfo":{"context":"Restart HDFS Client","operation_level":{"level":"HOST_COMPONENT","cluster_name":"rest","host_name":"$j","service_name":"HDFS"}},"Body":{"HostRoles":{"state":"INSTALLED"}}}' http://ambari:8080/api/v1/clusters/rest/hosts/$j/host_components/HDFS_CLIENT
done < hostcluster.txt
Created 09-16-2019 04:00 AM
I was able to figure out with the help of below community article.
https://community.cloudera.com/t5/Community-Articles/How-to-install-all-clients-on-all-nodes-in-your...
script.sh
---------
curl -s -u admin:admin http://ambari:8080/api/v1/hosts|grep host_name|sed -n 's/.*"host_name" : "\([^\"]*\)".*/\1/p'>hostcluster.txt
while read line ;
do
j=$line
mkdir -p $j
curl -s -u admin:admin -H "X-Requested-By:ambari" -i -X PUT -d '{"RequestInfo":{"context":"Restart HDFS Client","operation_level":{"level":"HOST_COMPONENT","cluster_name":"rest","host_name":"$j","service_name":"HDFS"}},"Body":{"HostRoles":{"state":"INSTALLED"}}}' http://ambari:8080/api/v1/clusters/rest/hosts/$j/host_components/HDFS_CLIENT
done < hostcluster.txt