Tested Against Version Ambari 2.1.2

Delete Mapreduce History Server if server died

curl -u admin:admin -H "X-Requested-By: ambari" -X PUT -d '{"RequestInfo":{"context":"Stop Service"},"Body":{"ServiceInfo":{"state":"INSTALLED"}}}' http://<ambari-server-name>:8080/api/v1/clusters/<cluster-name>/services/MAPREDUCE2

curl -u admin:admin -H "X-Requested-By: ambari" -X PUT -d '{"RequestInfo":{"context":"Stop Component"},"Body":{"HostRoles":{"state":"INSTALLED"}}}' http://<ambari-server-name>:8080/api/v1/clusters/<cluster-name>/hosts/<old-host-name>/host_components/HISTORYSERVER

curl -u admin:admin -H "X-Requested-By: ambari" -X DELETE http://<ambari-server-name>:8080/api/v1/clusters/<cluster-name>/services/MAPREDUCE2/components/HISTORYSERVER

Add Mapreduce History Server to New Server

curl -u admin:admin -H "X-Requested-By: ambari" -i -X POST http://<ambari-server-name>:8080/api/v1/clusters/<cluster-name>/services/MAPREDUCE2/components/HISTORYSERVER

curl -u admin:admin -H "X-Requested-By: ambari" -i -X POST -d '{"host_components" : [{"HostRoles":{"component_name":"HISTORYSERVER"}}] }' http://<ambari-server-name>:8080/api/v1/clusters/<cluster-name>/hosts?Hosts/host_name=<new-host-name>

curl -u admin:admin -H "X-Requested-By: ambari" -i -X PUT -d '{"ServiceInfo": {"state" : "INSTALLED"}}' http://<ambari-server-name>:8080/api/v1/clusters/<cluster-name>/services/MAPREDUCE2

Go to Ambari Web > Services > MapReduce2 > Configs > Advanced, and modify mapreduce.jobhistory.address and mapreduce.jobhistory.webapp.address to point to the new History Server host.

Restart MapReduce2 Service after saving the configuration.

  • No labels