Ambari的安装教程

ambari

2016-11-04

2441

2

一、准备工作

1、基本工具

安装ambari需要装一些基本工具:yum,rpm,scp,curl,wget,pdsh。前几个一般系统都自带了,pdsh需要自己装。

yum install pdsh 

2、配置host

vi  /etc/hosts
172.*.*.159 ambari ambari-server.hdp
172.*.*.160 node1 node1.hdp
172.*.*.161 node2 node2.hdp
172.*.*.162 node3 node3.hdp
172.*.*.163 node4 node4.hdp

3、配置ssh免登陆

选定ambari-server.hdp作为ambari server,需要配置该节点到其它节点的ssh免登录

cd ~  
ssh-keygen 

一直按回车,会生成默认的公钥和私钥

.ssh/id_rsa 
.ssh/id_rsa.pub  

执行

chmod 700 ~/.ssh 
cat id_rsa.pub >> .ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys  

配置其他机器的免登录

scp ~/.ssh/authorized_keys node1:/root/.ssh/  
scp ~/.ssh/authorized_keys node2:/root/.ssh/
scp ~/.ssh/authorized_keys node3:/root/.ssh/
scp ~/.ssh/authorized_keys node4:/root/.ssh/

将私钥从master上下载下来,配置ambari agent时会用到

.ssh/id_rsa 

开启ntp服务,所有机器都要开启

yum  install ntp
systemctl is-enabled ntpd
systemctl enable ntpd
systemctl start ntpd

4、关闭防火墙

所有节点都要设置

Centos 7 命令

systemctl disable firewalld
systemctl stop firewalld 

Centos 6 命令

chkconfig iptables off
/etc/init.d/iptables stop

5、关闭SELinux

所有节点都要设置

查看SELinux状态:

sestatus

如果SELinux status参数为enabled即为开启状态 
SELinux status: enabled

临时关闭,不用重启机器:

setenforce 0

修改配置文件需要重启机器:

vi /etc/sysconfig/selinux
SELINUX=disabled

二、在线安装Ambari Server

添加yum资源库

wget http://public-repo-1.hortonworks.com/ambari/centos7/2.x/updates/2.4.1.0/ambari.repo
-O /etc/yum.repos.d/ambari.repo  
yum repolist
yum install ambari-server

##指定JAVA_HOME执行  ambari-server setup -j /usr/java/default  
##不指定JAVA_HOME执行 ambari-server setup

如果不制定JAVA_HOME会提示在线安装jdk,
接着会提示配置用的数据库,可以选择Oracle或postgresql,选择n会按默认配置
数据库类型:postgresql
数据库:ambari
用户名:ambari
密码:bigdata
如果提示Oracle JDK license,yes
等待安装完成
启动Ambari Server

 

ambari-server start  

然后访问:http://ambari:8080
不出意外的话就安装完成了
用户名/密码:admin/admin

三、离线安装ambari

生产中的hadoop集群机器都很多,而且基本都不允许连接公网,为方便快速部署,非常有必要建立一个本地Repository,下面详细介绍建立过程。

安装 Apache HTTP 服务器

安装HTTP 服务器,允许 http 服务通过防火墙(永久)

yum install httpd
firewall-cmd --add-service=http 
firewall-cmd --permanent --add-service=http

添加 Apache 服务到系统层使其随系统自动启动

systemctl start httpd.service
systemctl enable httpd.service

安装本地源制作相关工具

yum install yum-utils createrepo

下载安装资源

下载 Ambari 2.2.2 , HDP 2.4.2 的安装资源,本次安装是在Centos 7 上,只列出centos7的资源,其他系统的请现在对用系统的资源

Ambari 2.2.2 下载资源

OS Format URL
CentOS 7 Base URL http://public-repo-1.hortonworks.com/ambari/centos7/2.x/updates/2.2.2.0
CentOS 7 Repo File http://public-repo-1.hortonworks.com/ambari/centos6/2.x/updates/2.2.2.0/ambari.repo
CentOS 7 Tarball md5 asc http://public-repo-1.hortonworks.com/ambari/centos7/2.x/updates/2.2.2.0/ambari-2.2.2.0-centos7.tar.gz

HDP 2.4.2 下载资源

OS Repository Name Format URL
CentOS 7 HDP Base URL http://public-repo-1.hortonworks.com/HDP/centos7/2.x/updates/2.4.2.0
CentOS 7 HDP Repo File http://public-repo-1.hortonworks.com/HDP/centos7/2.x/updates/2.4.2.0/hdp.repo
CentOS 7 HDP Tarball md5 asc http://public-repo-1.hortonworks.com/HDP/centos7/2.x/updates/2.4.2.0/HDP-2.4.2.0-centos7-rpm.tar.gz
CentOS 7 HDP-UTILS Base URL http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.20/repos/centos7
CentOS 7 HDP-UTILS Repo File http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.20/repos/centos7/HDP-UTILS-1.1.0.20-centos7.tar.gz

下载上面列表的中的压缩包, 
需要下载的压缩包如下:

Ambari 2.2.2
http://public-repo-1.hortonworks.com/HDP/centos7/2.x/updates/2.4.0.0/HDP-2.4.0.0-centos7-rpm.tar.gz 
HDP 2.4.2
http://public-repo-1.hortonworks.com/ambari/centos7/2.x/updates/2.2.2.0/ambari-2.2.2.0-centos7.tar.gz
HDP-UTILS 1.1.0
http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.20/repos/centos7/HDP-UTILS-1.1.0.20-centos7.tar.gz

在httpd网站根目录,默认是即/var/www/html/,创建目录ambari, 
并且将下载的压缩包解压到/var/www/html/ambari目录

cd /var/www/html/
mkdir ambari
cd /var/www/html/ambari/
tar -zxvf ambari-2.2.2.0-centos7.tar.gz
tar -zxvf HDP-2.4.2.0-centos7-rpm.tar.gz
tar -zxvf HDP-UTILS-1.1.0.20-centos7.tar.gz

验证httd网站是否可用,可以使用links 命令或者浏览器直接访问下面的地址:

links http://172.16.38.159/ambari/

结果如下: 
image

 配置ambari、HDP、HDP-UTILS的本地源

首先下载上面资源列表中的相应repo文件,修改其中的URL为本地的地址,相关配置如下:

ambari.repo

#VERSION_NUMBER=2.2.2.0-460
[Updates-ambari-2.2.2.0]
name=ambari-2.2.2.0 - Updates
baseurl=http://172.16.38.159/ambari/AMBARI-2.2.2.0/centos7/2.2.2.0-460
gpgcheck=1
gpgkey=http://172.16.38.159/ambari/AMBARI-2.2.2.0/centos7/2.2.2.0-460/RPM-GPG-KEY/RPM-GPG-KEY-Jenkins
enabled=1
priority=1

hdp.repo

#VERSION_NUMBER=2.4.2.0-258
[HDP-2.4.2.0]
name=HDP Version - HDP-2.4.2.0
baseurl=http://172.16.38.159/ambari/HDP/centos7/2.x/updates/2.4.2.0
gpgcheck=1
gpgkey=http://172.16.38.159/ambari/HDP/centos7/2.x/updates/2.4.2.0/RPM-GPG-KEY/RPM-GPG-KEY-Jenkins
enabled=1
priority=1

[HDP-UTILS-1.1.0.20]
name=HDP Utils Version - HDP-UTILS-1.1.0.20
baseurl=http://172.16.38.159/ambari/HDP-UTILS-1.1.0.20/repos/centos7
gpgcheck=1
gpgkey=http://172.16.38.159/ambari/HDP/centos7/2.x/updates/2.4.2.0/RPM-GPG-KEY/RPM-GPG-KEY-Jenkins
enabled=1
priority=1
将上面的修改过的源放到/etc/yum.repos.d/下面
yum clean all
yum list update
yum makecache
yum repolist

后面的安装步骤同在线安装一样

个人博客地址:http://julyme.com

博文地址:http://julyme.com/c/Ambari的安装教程

 

转载请注明出处: http://www.julyme.com/20161104/15.html

发表评论

全部评论:2条

网友 2016-11-10

挺详细的

Julyme 2016-11-10

t

Julyme

感觉还行吧。

Julyme的IT技术分享



/sitemap