ambari管理界面没有提供move HistoryServer功能,所以需要使用命令进行迁移操作。

操作前提示:如果你对ambari这些操作一点都不熟悉,建议不要进行操作,以免ambari管理界面异常,导致无法管理。
可以先在测试环境操作练习,确认无误后,再进行正式环境操作。


测试环境 Ambari 2.0

一、删除 Delete Mapreduce History Server if server died

1、设置MAPREDUCE2参数
curl -u admin:admin -H "X-Requested-By: ambari" -X PUT -d '{"RequestInfo":{"context":"Stop Service"},"Body":{"ServiceInfo":{"state":"INSTALLED"}}}' http://:8080/api/v1/clusters//services/MAPREDUCE2

我的操作:
curl -u admin:admin -H "X-Requested-By: ambari" -X PUT -d '{"RequestInfo":{"context":"Stop Service"},"Body":{"ServiceInfo":{"state":"INSTALLED"}}}' http://10.111.32.50:8080/api/v1/clusters/testhadoop/services/MAPREDUCE2

2、设置HISTORYSERVER参数
curl -u admin:admin -H "X-Requested-By: ambari" -X PUT -d '{"RequestInfo":{"context":"Stop Component"},"Body":{"HostRoles":{"state":"INSTALLED"}}}' http://:8080/api/v1/clusters//hosts//host_components/HISTORYSERVER

我的操作:
curl -u admin:admin -H "X-Requested-By: ambari" -X PUT -d '{"RequestInfo":{"context":"Stop Component"},"Body":{"HostRoles":{"state":"INSTALLED"}}}' http://10.111.32.50:8080/api/v1/clusters/testhadoop/hosts/testserver4.bj/host_components/HISTORYSERVER


3、删除HISTORYSERVER服务
curl -u admin:admin -H "X-Requested-By: ambari" -X DELETE http://:8080/api/v1/clusters//services/MAPREDUCE2/components/HISTORYSERVER

我的操作:
curl -u admin:admin -H "X-Requested-By: ambari" -X DELETE http://10.111.32.50:8080/api/v1/clusters/testhadoop/services/MAPREDUCE2/components/HISTORYSERVER


二、增加 Add Mapreduce History Server to New Server

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

我的操作:
curl -u admin:admin -H "X-Requested-By: ambari" -i -X POST http://10.111.32.50:8080/api/v1/clusters/testhadoop/services/MAPREDUCE2/components/HISTORYSERVER


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

我的操作:
curl -u admin:admin -H "X-Requested-By: ambari" -i -X POST -d '{"host_components" : [{"HostRoles":{"component_name":"HISTORYSERVER"}}] }' http://10.111.32.50:8080/api/v1/clusters/testhadoop/hosts?Hosts/host_name=testserver2.bj


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

我的操作:
curl -u admin:admin -H "X-Requested-By: ambari" -i -X PUT -d '{"ServiceInfo": {"state" : "INSTALLED"}}' http://10.111.32.50:8080/api/v1/clusters/testhadoop/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.

我的操作
mapreduce.jobhistory.address testserver4.bj:10020
修改为
mapreduce.jobhistory.address testserver2.bj:10020


mapreduce.jobhistory.webapp.address testserver4.bj:19888
修改后
mapreduce.jobhistory.webapp.address testserver2.bj:19888

四、重启服务
Restart MapReduce2 Service after saving the configuration.

参考:
https://cwiki.apache.org/confluence/display/AMBARI/Move+Mapreduce2+History+Server
09-07 12:25