CenOS7下Ambari版本更新
一 、准备
1、备份ambari server数据库
进入postgres,
pg_dump ambari>ambari.sql
pg_dump ambarirca>ambarirca.sql
备份文件在yun5:/var/ambariBack下
备份好ambari.properties配置文件(/etc/ambari-server/conf/ambari.properties)
-
2、搭建本地仓库
- 下载ambari-2.5.0.3-centos7.tar.gz
- 下载HDP-2.6.0.3-centos7-rpm.tar.gz
http://public-repo-1.hortonworks.com/HDP/centos7/2.x/updates/2.6.0.3/HDP-2.6.0.3-centos7-rpm.tar.gz
- 下载/HDP-UTILS-1.1.0.21-centos7.tar.gz
- 下载ambari.repo
将Baseurl修改为搭建的仓库地址
官方升级版本说明
http://docs.hortonworks.com/HDPDocuments/Ambari-2.4.0.1/bk_ambari-installation/content/determine_stack_compatibility.html
官方升级步骤
http://docs.hortonworks.com/HDPDocuments/Ambari-2.4.0.1/bk_ambari-upgrade/content/preparing_to_upgrade_ambari.html
官方HDP问题搜索
https://community.hortonworks.com/answers/index.html
Upgrade Ambari
二、升级前准备
Preparing to Upgrade
- 确认版本
Be sure to review the Release Notes for this Ambari release for Known Issues and Behavioral Changes.
- 拥有root权限
You must have root, administrative, or root-equivalent authorization on the Ambari server host and all servers in the cluster.
- 备份ambari数据库
You must backup the Ambari Server database.
- 备份好ambari.properties配置文件
You must make a safe copy of the Ambari Server configuration file found at /etc/ambari-server/conf/ambari.properties.
三、停止服务、下载新的ambari.repo
- 关闭Ambari Metrics
If you are running Ambari Metrics service in your cluster, stop the service. From Ambari Web, browse to Services > Ambari Metrics and select Stop from the Service Actions menu.
- 停止ambari-server
Stop the Ambari Server. On the host running Ambari Server:
ambari-server stop
- 停止ambari-agent
Stop all Ambari Agents. On each host in your cluster running an Ambari Agent:
ambari-agent stop
- 获取新的ambari.repo
Fetch the new Ambari repo and replace the old repository file with the new repository file on all hosts in your cluster.
wget -nv http://public-repo-1.hortonworks.com/ambari/centos6/2.x/updates/2.4.0.1/ambari.repo -O /etc/yum.repos.d/ambari.repo
四、升级操作
- Upgrade Ambari Server. On the host running Ambari Server:
yum clean all
yum info ambari-server
- 在ambari节点更新ambari-server
In the info output, visually validate that there is an available version containing "2.4"
yum upgrade ambari-server
显示如下成功:
Updated:
ambari-server.x86_64 0:2.4.0.1-1
Complete!
- 在所有节点更新ambari-agent
Upgrade all Ambari Agents. On each host in your cluster running an Ambari Agent:
yum upgrade ambari-agent
显示如下成功:
Updated:
ambari-agent.x86_64 0:2.4.0.1-1
Complete!
- 查看ambari-agent
After the upgrade process completes, check each host to make sure the new files have been installed:
rpm -qa | grep ambari-agent
- 升级ambari-server
Upgrade Ambari Server database schema. On the host running Ambari Server:
ambari-server upgrade
[[email protected] yum.repos.d]# ambari-server upgrade
Using python /usr/bin/python
Upgrading ambari-server
Updating properties in ambari.properties ...
WARNING: Can not find ambari.properties.rpmsave file from previous version, skipping import of settings
INFO: Can not find ambari-env.sh.rpmsave file from previous version, skipping restore of environment settings. ambari-env.sh may not include any user customization.
Fixing database objects owner
Ambari Server configured for Embedded Postgres. Confirm you have made a backup of the Ambari Server database [y/n] (y)?
Upgrading database schema
Adjusting ambari-server permissions and ownership...
Ambari Server 'upgrade' completed successfully.
- 启动ambari-server
Start the Ambari Server. On the host running Ambari Server:
ambari-server start
[[email protected] yum.repos.d]# ambari-server start
Using python /usr/bin/python
Starting ambari-server
Ambari Server running with administrator privileges.
Organizing resource files at /var/lib/ambari-server/resources...
Ambari database consistency check started...
No errors were found.
Ambari database consistency check finished
Server PID at: /var/run/ambari-server/ambari-server.pid
Server out at: /var/log/ambari-server/ambari-server.out
Server log at: /var/log/ambari-server/ambari-server.log
Waiting for server start....................
Ambari Server 'start' completed successfully.
- 所有节点启动ambari-agent
Start all Ambari Agents. On each host in your cluster running an Ambari Agent:
ambari-agent start
- 登录ambari管理界面,查看版本,升级成功。
打开管理界面后出现图中内容,使用’ctrl+shift+R’刷新下就好了。
-
五、增加新版本HDP
- 浏览Ambari Web > Admin > Stack and Versions.
点击Versions标签,你将看到已经安装的HDP版本
如果看不到已经安装(Current)的版本, 说明客户端没有更新完。
Admin > Manager Ambari > 左侧Versions
点击右上角的按钮Register Version,添加新的hdp版本。
- 点击Install Packages就能够将hadoop升级到该HDP版本了。
- 安装后点击upgrade,有两种升级模式,一种是保持服务运行升级,另一种是停止服务升级,后者升级更快些
- 点击Checks查看警告信息,需要检查TEZ服务,进入TEZ服务,选择“”run service check“”
- 提示是否升级
- 选择i have performed the clients will retry on their above. 之后proceed
- 开始升级,我选择的是停止服务升级,过程中会自动stop服务,有时候需要retry
- 最后确认是否完成升级,升级后无法回退到旧版本。
- HDP2.5已经为当前版本
- 在添加新服务的时候已经是新版本组件了
- 看了下hdfs中的数据还在
总结:
对于生产环境Hadoop集群升级,绝对是个重量级工作,一定要有敬畏之心,以上升级步骤虽然看着不复杂,也很顺利的完成,我是在测试环境上进行的,没有一点心理负担,
如果是生产环境,不仅需要停止服务,如果在过程中出现问题,后果肯定无法想象,新版本组件也需要在升级前进行测试,业务是否可以运行正常,需要大量的测试实践工作,建议如果真要升级hadoop集群,还是考虑异地备份重要数据,避免数据丢失,比起数据丢失的风险,多买几台服务器进行数据备份,不算什么的,总之不到万不得已,轻易不要升级集群。