Skip to main content
sampathkumar_ma
Gold ⭐️
February 14, 2019
Solved

NN/RM failover through REST API

Hi,

Is it possible to perform Namenode and Resource Manager failover through rest api in Ambari?

Any help and suggestions will be greatly appreciated.

Thank you.

jsensharma
Platinum ⭐️⭐️
February 14, 2019

@Sampath Kumar

Ambari does not control this part. Hence it does not have any inbuilt API to achieve the same.

.

The RMs have an option to embed the Zookeeper-based ActiveStandbyElector to decide which RM should be the Active. When the Active goes down or becomes unresponsive, another RM is automatically elected to be the Active which then takes over. ActiveStandbyElector embedded in RMs acts as a failure detector.

Similarly in case of NameNode HA, a separate ZKFC daemon is needed which is responsible for deciding when to failover.

3 replies

jsensharma
Platinum ⭐️⭐️
Platinum ⭐️⭐️
February 14, 2019

@Sampath Kumar

Ambari does not control this part. Hence it does not have any inbuilt API to achieve the same.

.

The RMs have an option to embed the Zookeeper-based ActiveStandbyElector to decide which RM should be the Active. When the Active goes down or becomes unresponsive, another RM is automatically elected to be the Active which then takes over. ActiveStandbyElector embedded in RMs acts as a failure detector.

Similarly in case of NameNode HA, a separate ZKFC daemon is needed which is responsible for deciding when to failover.

Translate
jsensharma
Platinum ⭐️⭐️
Platinum ⭐️⭐️
February 14, 2019

@Sampath Kumar

However Ambari Provides users an option to register their own custom Actions and execute them via API calls.

For that you will need to write your own Python scripts (and inside those python screipt you can write your logic to force failover) like "yarn rmadmin -failover" and then make it run as part of your python script.

.

You can find similar info on how to register custom commands and execute them via ambari API calls in the following article:

https://community.hortonworks.com/articles/139788/running-custom-scripts-through-ambari.html

Translate