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"}}}'
我的操作:
curl -u admin:admin -H "X-Requested-By: ambari" -X PUT -d '{"RequestInfo":{"context":"Stop Service"},"Body":{"ServiceInfo":{"state":"INSTALLED"}}}'
2、设置HISTORYSERVER参数
curl -u admin:admin -H "X-Requested-By: ambari" -X PUT -d '{"RequestInfo":{"context":"Stop Component"},"Body":{"HostRoles":{"state":"INSTALLED"}}}'
我的操作:
curl -u admin:admin -H "X-Requested-By: ambari" -X PUT -d '{"RequestInfo":{"context":"Stop Component"},"Body":{"HostRoles":{"state":"INSTALLED"}}}'
3、删除HISTORYSERVER服务
curl -u admin:admin -H "X-Requested-By: ambari" -X DELETE /components/HISTORYSERVER
我的操作:
curl -u admin:admin -H "X-Requested-By: ambari" -X DELETE /components/HISTORYSERVER
二、增加 Add Mapreduce History Server to New Server
curl -u admin:admin -H "X-Requested-By: ambari" -i -X POST /components/HISTORYSERVER
我的操作:
curl -u admin:admin -H "X-Requested-By: ambari" -i -X POST /components/HISTORYSERVER
curl -u admin:admin -H "X-Requested-By: ambari" -i -X POST -d '{"host_components" : [{"HostRoles":{"component_name":"HISTORYSERVER"}}] }'
我的操作:
curl -u admin:admin -H "X-Requested-By: ambari" -i -X POST -d '{"host_components" : [{"HostRoles":{"component_name":"HISTORYSERVER"}}] }'
curl -u admin:admin -H "X-Requested-By: ambari" -i -X PUT -d '{"ServiceInfo": {"state" : "INSTALLED"}}'
我的操作:
curl -u admin:admin -H "X-Requested-By: ambari" -i -X PUT -d '{"ServiceInfo": {"state" : "INSTALLED"}}'
三、修改配置
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.
参考: