https://www.yp14.cn/2016/12/09/Centos7-2%E5%AE%89%E8%A3%85Ambari2-4-2-HDP2-5-3%E
6%90%AD%E5%BB%BAHadoop%E9%9B%86%E7%BE%A4/
http://blog.csdn.net/lusyoe/article/details/69484160
Centos7.2 安装 Ambari2.4.2+HDP2.5.3 搭建
Hadoop 集群
DataBase
OPS
一、官方链接
1
2
3
4
5
6
7
8
9
1
0
1
1
1
2
1
3
1
4
1
5
1
6
1
官方搭建文档:
https://docs.hortonworks.com/HDPDocuments/Ambari-2.4.2.0/bk_ambari-installation/c
ontent/ch_Getting_Ready.html
离线搭建 yum 源,包下载列表:
https://docs.hortonworks.com/HDPDocuments/Ambari-2.4.2.0/bk_ambari-installation/c
ontent/hdp_25_repositories.html
适合系统:RedHat 7 CentOS 7 Oracle Linux 7
Ambari 2.4.2.0
Base URL
http://public-repo-1.hortonworks.com/ambari/centos7/2.x/updates/2.4.2.0
Repo File
http://public-repo-1.hortonworks.com/ambari/centos7/2.x/updates/2.4.2.0/amb
ari.repo
Tarball md5 | asc
http://public-repo-1.hortonworks.com/ambari/centos7/2.x/updates/2.4.2.0/amb
ari-2.4.2.0-centos7.tar.gz
HDP-2.5.3.0
HDP
Version Definition File (VDF)
http://public-repo-1.hortonworks.com/HDP/centos7/2.x/updates/2.5.3.0/HDP-
2.5.3.0-37.xml
Base URL
7
1
8
1
9
http://public-repo-1.hortonworks.com/HDP/centos7/2.x/updates/2.5.3.0
Repo File
http://public-repo-1.hortonworks.com/HDP/centos7/2.x/updates/2.5.3.0/hdp.r
epo
Tarball md5 | asc
http://public-repo-1.hortonworks.com/HDP/centos7/2.x/updates/2.5.3.0/HDP-
2.5.3.0-centos7-rpm.tar.gz
HDP-UTILS
Base URL
1.1.0.21
http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.21/repos/centos7
Tarball md5 | asc
http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.21/repos/centos7/H
DP-UTILS-1.1.0.21-centos7.tar.gz
二、 环境准备
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
1、主机
172.19.80.2 SY-001.hadoop
172.19.80.3 SY-002.hadoop
172.19.80.4 SY-003.hadoop
172.19.80.5 ambari-mysql
2、安装基础环境 (在主机 SY-001.hadoop,SY-002.hadoop,SY-003.hadoop 部署)
(1)安装基本包
$ yum install openssh wget vim openssh-clients openssl gcc openssh-server
mysql-connector-odbc -y
$ systemctl enable sshd && systemctl start sshd
(2)安装 mysql jdbc 驱动
$ yum install mysql-connector-java -y
(3)安装 JDK
版本要求:
Oracle JDK 1.8 64-bit (minimum JDK 1.8.0_77) (default)
Oracle JDK 1.7 64-bit (minimum JDK 1.7_67)
OpenJDK 8 64-bit (not supported on SLES)
OpenJDK 7 64-bit (not supported on SLES)
$ mkdir /usr/local/src/Ambari/
$ wget
http://download.oracle.com/otn-pub/java/jdk/8u112-b15/jdk-8u112-linux-x64.tar.gz?A
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
uthParam=1480914946_a78f7ba2e70d2f0abed0b0af73c74214
$ mkdir -p /opt/java/ && tar xf jdk-8u112-linux-x64.tar.gz -C /opt/java
$ vim /etc/profile
添加下面内容:
export JAVA_HOME=/opt/java/jdk1.8.0_112
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
PATH=$PATH:$HOME/bin:$JAVA_HOME/bin
$ source /etc/profile
(4)配置 SSH 免密码登录
主节点里 root 用户登录执行如下步骤
$ ssh-keygen
$ cd ~/.ssh/
$ cat id_rsa.pub >> authorized_keys
$ chmod 600 ~/.ssh/authorized_keys
把各个主机上公钥 id_rsa.pub 文件内容放到各个主机 authorized_keys 中
(5)开启 NTP 服务
$ yum -y install ntp
$ systemctl is-enabled ntpd
$ systemctl enable ntpd
$ systemctl start ntpd
(6)检查 DNS 和 NSCD
ambari 在安装时需要配置全域名,所以需要检查 DNS。为了减轻 DNS 的负担, 建
议在节点里用 Name Service Caching Daemon (NSCD)
$ cat /etc/hosts
172.19.80.2 SY-001.hadoop
172.19.80.3 SY-002.hadoop
172.19.80.4 SY-003.hadoop
172.19.80.5 ambari-mysql
(7)每台节点里配置 FQDN,如下以主节点为例
$ cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=SY-001.hadoop
(8)关闭防火墙和 SELinux
$ systemctl disable firewalld
$ systemctl stop firewalld
临时关闭,不用重启机器:
$ setenforce 0
修改配置文件让机器重启也生效:
$ cat /etc/sysconfig/selinux
SELINUX=disabled
三、搭建数据库(在主机 ambari-mysql 上部署)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
Ambari 安装会将安装等信息写入数据库,建议使用自己安装的 Mysql 数据库,也
可以不安装而使用默认数据库 PostgreSQL
版本要求:
- PostgreSQL 8
- PostgreSQL 9.1.13+,9.3, 9.4***
- MariaDB 10*
- MySQL 5.6
- Oracle 11gr2
- Oracle 12c**
按你系统来选择源:http://downloads.mariadb.org/mariadb/repositories/
Here is your custom MariaDB YUM repository entry for CentOS. Copy and paste it
into a file under /etc/yum.repos.d/ (we suggest naming the file MariaDB.repo or
something similar).
# MariaDB 10.1 CentOS repository list - created 2016-12-09 06:03 UTC
# http://downloads.mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.1/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
After the file is in place, install MariaDB with:
$ sudo yum install MariaDB-server MariaDB-client
If you haven't already accepted the MariaDB GPG key, you will be prompted to do so.
See "Installing MariaDB with yum" for detailed information.
安装完成后创建 ambari 数据库及用户,登录 root 用户执行下面语句:
create database ambari character set utf8 ;
CREATE USER 'ambari'@'%'IDENTIFIED BY 'Ambari-123';
GRANT ALL PRIVILEGES ON *.* TO 'ambari'@'%';
FLUSH PRIVILEGES;
36
37
38
39
40
41
42
43
如果要安装 Hive,再创建 Hive 数据库和用户 再执行下面的语句:
create database hive character set utf8 ;
CREATE USER 'hive'@'%'IDENTIFIED BY 'Hive-123';
GRANT ALL PRIVILEGES ON *.* TO 'hive'@'%';
FLUSH PRIVILEGES;
如果要安装 Oozie,再创建 Oozie 数据库和用户 再执行下面的语句:
create database oozie character set utf8 ;
CREATE USER 'oozie'@'%'IDENTIFIED BY 'Oozie-123';
GRANT ALL PRIVILEGES ON *.* TO 'oozie'@'%';
FLUSH PRIVILEGES;
四、制作本地源 (在 SY-001.hadoop 部署)
下载 Ambari HDP HDP-UTILS 源包(文件很大,需要很长下载时间,请耐心等
1
2
待。。。)
3
$ cd /usr/local/src/Ambari/
4
$ wget
5
http://public-repo-1.hortonworks.com/ambari/centos7/2.x/updates/2.4.2.0/ambari-2.4.2.
6
0-centos7.tar.gz
7
$ wget
8
http://public-repo-1.hortonworks.com/HDP/centos7/2.x/updates/2.5.3.0/HDP-2.5.3.0-ce
9
ntos7-rpm.tar.gz
1
$ wget
0
http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.21/repos/centos7/HDP-UTILS
1
-1.1.0.21-centos7.tar.gz
1
1
安装本地源制作相关工具
2
$ yum install yum-utils createrepo -y
1
安装 httpd 服务
3
1
$ yum install httpd -y
4
$ systemctl enable httpd && systemctl start httpd
1
$ cd /var/www/html/ && mkdir ambari
5
$ cd /usr/local/src/Ambari/
1
$ tar xf ambari-2.4.2.0-centos7.tar.gz -C /var/www/html/ambari/
6
$ tar xf HDP-2.5.3.0-centos7-rpm.tar.gz -C /var/www/html/ambari/
1
$ tar xf HDP-UTILS-1.1.0.21-centos7.tar.gz -C /var/www/html/ambari/
7
验证 httd 网站是否可用,可以使用 links 命令或者浏览器直接访问下面的地址:
1
8
$ links http://172.19.80.2/ambari/
1
结果是看到刚才解压的目录
9
配置 ambari、HDP、HDP-UTILS 的本地源
2
首先下载上面资源列表中的相应 repo 文件,修改其中的 URL 为本地的地址,相关
0
2
配置如下:
1
$ cd /etc/yum.repos.d/
2
$ cat ambari.repo
2
#VERSION_NUMBER=2.4.2.0-136
2
[Updates-ambari-2.4.2.0]
3
name=ambari-2.4.2.0 - Updates
2
baseurl=http://172.19.80.2/ambari/AMBARI-2.4.2.0/centos7/2.4.2.0-136
4
gpgcheck=1
2
gpgkey=http://172.19.80.2/ambari/AMBARI-2.4.2.0/centos7/2.4.2.0-136/RPM-GPG-K
5
EY/RPM-GPG-KEY-Jenkins
2
enabled=1
6
priority=1
2
7
$ cat hdp.repo
2
#VERSION_NUMBER=2.5.3.0
8
[HDP-2.5.3.0]
2
name=HDP Version - HDP-2.5.3.0
9
baseurl=http://172.19.80.2/ambari/HDP/centos7/2.x/updates/2.5.3.0
3
gpgcheck=1
0
gpgkey=http://172.19.80.2/ambari/HDP/centos7/2.x/updates/2.5.3.0/RPM-GPG-KEY/R
3
PM-GPG-KEY-Jenkins
1
enabled=1
3
priority=1
2
3
[HDP-UTILS-1.1.0.21]
3
name=HDP Utils Version - HDP-UTILS-1.1.0.21
3
baseurl=http://172.19.80.2/ambari/HDP-UTILS-1.1.0.21/repos/centos7
4
gpgcheck=1
3
gpgkey=http://172.19.80.2/ambari/HDP/centos7/2.x/updates/2.5.0.0/RPM-GPG-KEY/R
5
PM-GPG-KEY-Jenkins
3
enabled=1
6
priority=1
3
7
$ yum clean all
3
$ yum makecache
8
$ yum repolist
3
9
4
0
4
1
4
2
4
3
4
4
4
5
4
6
4
7
4
8
4
9
5
0
5
1
5
2
5
3
5
4
5
5
5
6
五、安装 Ambari (在 SY-001.hadoop 部署)
1
2
3
4
安装 Ambari
$ yum install ambari-server -y
配置 Ambari
5
6
7
8
9
1
0
1
1
1
2
1
3
1
4
1
5
1
6
1
7
1
8
1
9
2
0
2
1
2
2
2
3
2
4
2
5
2
6
2
7
$ ambari-server setup
下面是配置执行流程,按照提示操作
(1) 提示是否自定义设置。输入:y
Customize user account for ambari-server daemon [y/n] (n)? y
(2)ambari-server 账号。输入:ambari
Enter user account for ambari-server daemon (root):ambari
Adjusting ambari-server permissions and ownership...
(3)设置 JDK。输入:3
Checking JDK...
Do you want to change Oracle JDK [y/n] (n)? y
[] Oracle JDK 1.8 + Java Cryptography Extension (JCE) Policy Files 8
[] Oracle JDK 1.7 + Java Cryptography Extension (JCE) Policy Files 7
[] Custom JDK
==============================================================
================
Enter choice (1): 3
(4)如果上面选择 3 自定义 JDK,则需要设置 JAVA_HOME。输入:
/opt/java/jdk1.8.0_112
WARNING: JDK must be installed on all hosts and JAVA_HOME must be valid on all
hosts.
WARNING: JCE Policy files are required for configuring Kerberos security. If you
plan to use Kerberos,please make sure JCE Unlimited Strength Jurisdiction Policy Files
are valid on all hosts.
Path to JAVA_HOME: /opt/java/jdk1.8.0_112
Validating JDK on Ambari Server...done.
Completing setup...
(5)数据库配置。选择:y
Configuring database...
Enter advanced database configuration [y/n] (n)? y
(6)选择数据库类型。输入:3
Configuring database...
==============================================================
================
Choose one of the following options:
[1] - PostgreSQL (Embedded)