Support Questions

Find answers, ask questions, and share your expertise

Ambari API to find HDFS HA enabled

avatar

Can someone please let me know the Ambari API to find whether HDFS is HA enabled or not ?

1 ACCEPTED SOLUTION

avatar
Rising Star

@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

View solution in original post

3 REPLIES 3

avatar

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"

avatar
Master Mentor

@Santhosh B Gowda

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...

.

avatar
Rising Star

@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