Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Namenode switch monitoring

Highlighted

Namenode switch monitoring

Explorer

Hi All,

I am trying to write a script that would monitor the namenodes (i have HA enabled) and notify me when a failover happens between the namenodes. I am thinking of using Ambari rest api to achieve this, but I am not sure which field/parameter i should use in the namenode component withing HDFS service that would provide me with the Active namenode.

I am open to other ideas :-)

3 REPLIES 3
Highlighted

Re: Namenode switch monitoring

I'm not sure if there is a way to check the state of the given namenode - its easy to find if its up and running. I think you have to put up a script to monitor the Namenode log or Zkfc to identify successful transitions.

Highlighted

Re: Namenode switch monitoring

Contributor

@Wael Emam

  • getServiceState - determine whether the given NameNode is Active or Standby

    Connect to the provided NameNode to determine its current state, printing either "standby" or "active" to STDOUT appropriately. This subcommand might be used by cron jobs or monitoring scripts which need to behave differently based on whether the NameNode is currently Active or Standby.

Highlighted

Re: Namenode switch monitoring

Expert Contributor
@Wael Emam

Please find below Ambari rest API to retrieve Active NameNode at any point of time:

http://${ambari_server_hostname}:8080/api/v1/clusters/${cluster_name}/host_components?HostRoles/comp...

Please replace above ${ambari_server_hostname} with the actual ambari server hostname (FQDN) and ${cluster_name} with the cluster name.

If you have customized ambari-server port or you are using ambari with https enabled then you need to change the API construct accordingly.

Don't have an account?
Coming from Hortonworks? Activate your account here