使用Ambari部署Hadoop集群

部署环境

主机名 IP 操作系统
node1.wanglibing.com 192.168.0.11 CentOS7
node2.wanglibing.com 192.168.0.12 CentOS7

部署步骤

先决条件

配置项 说明
关闭防火墙 全部
关闭Selinux 全部
设置NTP 全部
安装JDK ambari-server
配置ip 全部
配置hostname 全部

配置yum server

安装http server

1
2
3
$ yum install -y httpd
$ systemctl start httpd
$ systemctl enable httpd

默认web目录:/var/www/html

配置源方法1(添加rpm包到repository中)

1
2
3
4
5
6
7
8
$ cd /usr/local/
$ wget http://public-repo-1.hortonworks.com/ambari/centos7/2.x/updates/2.6.1.5/ambari-2.6.1.5-centos7.tar.gz
$ wget http://public-repo-1.hortonworks.com/HDP/centos7/2.x/updates/2.6.4.0/HDP-2.6.4.0-centos7-rpm.tar.gz
$ wget http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.22/repos/centos7/HDP-UTILS-1.1.0.22-centos7.tar.gz
$ wget http://public-repo-1.hortonworks.com/HDP-GPL/centos7/2.x/updates/2.6.4.0/HDP-GPL-2.6.4.0-centos7-rpm.tar.gz
$ tar zxvf ambari-2.6.1.5-centos7.tar.gz -C /var/www/html/
$ tar zxvf HDP-2.6.4.0-centos7-rpm.tar.gz -C /var/www/html/
$ tar zxvf HDP-UTILS-1.1.0.22-centos7.tar.gz -C /var/www/html/

安装ambari-server

安装jdk

步骤略

配置免密登陆

1
2
3
$ ssh-keygen
$ cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
$ scp -p ~/.ssh/id_rsa.pub root@192.168.0.11:/root/.ssh/authorized_keys

配置公共源

1
2
3
4
$ cd /etc/yum.repos.d/
# 配置ambari源
$ wget -nv http://public-repo-1.hortonworks.com/ambari/centos7/2.x/updates/2.6.1.5/ambari.repo
$ wget -nv http://public-repo-1.hortonworks.com/HDP/centos7/2.x/updates/2.6.4.0/hdp.repo

配置本地源

在配置公共源的基础上修改:

  • ambari.repo
  • hdp.repo

ambari.repo

1
2
3
4
5
6
7
8
#VERSION_NUMBER=2.6.1.5-3
[ambari-2.6.1.5]
name=ambari Version - ambari-2.6.1.5
baseurl=http://192.168.0.11/ambari/centos7/2.6.1.5-3
gpgcheck=1
gpgkey=http://192.168.0.11/ambari/centos7/2.6.1.5-3/RPM-GPG-KEY/RPM-GPG-KEY-Jenkins
enabled=1
priority=1

hdp.repo

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#VERSION_NUMBER=2.6.4.0-91
[HDP-2.6.4.0]
name=HDP Version - HDP-2.6.4.0
baseurl=http://192.168.0.11/HDP/centos7/2.6.4.0-91
gpgcheck=1
gpgkey=http://192.168.0.11/HDP/centos7/2.6.4.0-91/RPM-GPG-KEY/RPM-GPG-KEY-Jenkins
enabled=1
priority=1


[HDP-UTILS-1.1.0.22]
name=HDP-UTILS Version - HDP-UTILS-1.1.0.22
baseurl=http://192.168.0.11/HDP-UTILS/centos7/1.1.0.22
gpgcheck=1
gpgkey=http://192.168.0.11/HDP-UTILS/centos7/1.1.0.22/RPM-GPG-KEY/RPM-GPG-KEY-Jenkins
enabled=1
priority=1

检查源列表

1
$ yum repolist

安装ambari-server

1
$ yum install -y ambari-server

配置ambari-server

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
36
37
38
39
40
41
42
43
44
45
46
$ ambari-server setup
Using python /usr/bin/python
Setup ambari-server
Checking SELinux...
SELinux status is 'disabled'
Customize user account for ambari-server daemon [y/n] (n)? y
Enter user account for ambari-server daemon (root):
Adjusting ambari-server permissions and ownership...
Checking firewall status...
Checking JDK...
[1] Oracle JDK 1.8 + Java Cryptography Extension (JCE) Policy Files 8
[2] Oracle JDK 1.7 + Java Cryptography Extension (JCE) Policy Files 7
[3] Custom JDK
==============================================================================
Enter choice (1): 3
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: /usr/java/jdk1.8.0_131
Validating JDK on Ambari Server...done.
Checking GPL software agreement...
GPL License for LZO: https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html
Enable Ambari Server to download and install GPL Licensed LZO packages [y/n] (n)?
Completing setup...
Configuring database...
Enter advanced database configuration [y/n] (n)?
Configuring database...
Default properties detected. Using built-in database.
Configuring ambari database...
Checking PostgreSQL...
Running initdb: This may take up to a minute.
Initializing database ... OK


About to start PostgreSQL
Configuring local database...
Configuring PostgreSQL...
Restarting PostgreSQL
Creating schema and user...
done.
Creating tables...
done.
Extracting system views...
ambari-admin-2.6.1.5.3.jar
...........
Adjusting ambari-server permissions and ownership...
Ambari Server 'setup' completed successfully.

启动ambari-server

1
$ ambari-server start

访问ambari server

参数
URL http://192.168.0.12:8080/
用户名 admin
密码 admin

安装Hadoop集群

Get Start

1.png
1.png

Select Version

OS Name Base URL
redhat7 HDP-2.6 http://192.168.0.11/HDP/centos7/2.6.4.0-91
redhat7 HDP-2.6-GPL http://public-repo-1.hortonworks.com/HDP-GPL/centos7/2.x/updates/2.6.5.0
redhat7 HDP-UTILS-1.1.0.22 http://192.168.0.11/HDP-UTILS/centos7/1.1.0.22

Install Options

3.1.png 3.2.png

Confirm Hosts

4.png
4.png

Choose Services

5.png
5.png

Assign Masters

6.png
6.png

Assign Slaves and Clients

7.png
7.png

Customize Services

8.png
8.png

Review

9.png
9.png

Install,Start and Test

10.png
10.png

Summary

11.png
11.png

重新安装

在执行ambari-server setup时出现错误或者感觉里面的选项错误时要重新执行时先执行

1
$ ambari-server reset

后再执行

1
$ ambari-server setup

参考

坚持原创技术分享,您的支持将鼓励我继续创作!
0%