Created 03-16-2017 06:21 AM
Can someone please let me know the Ambari API to find whether HDFS is HA enabled or not ?
Created 03-16-2017 08:21 AM
@Santhosh B Gowda There is no direct rest api call where we find out "isHAEnabled" for HDFS. But when we enabled HA for HDFS, "dfs.nameservices" parameter will gets set. So we get the value of dfs.nameservices from the configs and if it is empty then HA is not enabled. If it contains value HA is enabled.
you can get the configs using the following API.
http://<AMBARI-SERVER>/api/v1/clusters/cl1/configurations?type=hdfs-site&tag=TOPOLOGY_RESOLVED
Created 03-16-2017 06:55 AM
I can only see looking for no# of NameNode components. Is there any better way of doing this ?
curl -u admin:admin -H"X-Requested-by:ambari" -i -k -X GET "http://XXX.XXX.XXX.XXX:8080/api/v1/clusters/santhosh/services/HDFS/components/NAMENODE?fields=host_components/HostRoles/component_name"
Created 03-16-2017 07:35 AM
I see that ambari finds out if the NameNode HA is enabled or not using the following logic: https://github.com/apache/ambari/blob/trunk/ambari-server/src/main/resources/common-services/HDFS/2....
I did not find a direct Ambari API to findout "isHAEnabled" for HDFS. However we might use the following api to findout the state of the standby/active nodes. That will give an idea if HA is enabled or not.
http://erie1.example.com:8080/api/v1/clusters/ErieCluster/host_components?HostRoles/component_name=N... http://erie1.example.com:8080/api/v1/clusters/ErieCluster/host_components?HostRoles/component_name=N...
.
Created 03-16-2017 08:21 AM
@Santhosh B Gowda There is no direct rest api call where we find out "isHAEnabled" for HDFS. But when we enabled HA for HDFS, "dfs.nameservices" parameter will gets set. So we get the value of dfs.nameservices from the configs and if it is empty then HA is not enabled. If it contains value HA is enabled.
you can get the configs using the following API.
http://<AMBARI-SERVER>/api/v1/clusters/cl1/configurations?type=hdfs-site&tag=TOPOLOGY_RESOLVED