Hadoop是一个开发和运行处理大规模数据的软件平台,是Apache的一个用java语言实现开源软件框架,实现在大量计算机组成的集群中对海量数据进行分布式计算。Hadoop框架中最核心设计就是:MapReduce和HDFS。MapReduce提供了对数据的分布式计算,HDFS提供了海量数据的分布式存储。
在Hadoop家族中,收入了20多个用于计算、分析、存储、监控、管理等组件和工具,这些家族成员极大的丰富了Hadoop的各方面的功能。
下面简单的列举几个常见的组件:
Ambari 跟 Hadoop 等开源软件一样,也是 Apache Software Foundation 中的一个项目,并且是顶级项目。目前最新的发布版本是 2.6.0。Ambari 是用来创建、管理、监视 Hadoop 的集群,但是这里的 Hadoop 是广义,指的是 Hadoop 整个生态圈(例如 Hive,Hbase,Sqoop,Zookeeper 等),而并不仅是特指 Hadoop。用一句话来说,Ambari 就是为了让 Hadoop 以及相关的大数据软件更容易使用的一个工具。
Ambari提供了对Hadoop更加方便快捷的管理功能,主要包含:
在使用Ambari安装部署Hadoop时,需要对下载镜像源,配置本地环境。
软件包 Hadoop 软件镜像压缩包,Ambari镜像压缩包,版本2.6
1、在node-1上配置hadoop所有组件的yum源。安装httpd:
[root@node-1 ~]# yum install httpd -y
2、在官方下载镜像文件,此文件大概7G,可以使用p2p工具下载,其中包含两个repo文件和4个压缩包:
wget http://public-repo-1.hortonworks.com/ambari/centos7/2.x/updates/2.6.1.0/ambari.repo
wget http://public-repo-1.hortonworks.com/HDP/centos7/2.x/updates/2.6.4.0/hdp.repo
wget http://public-repo-1.hortonworks.com/ambari/centos7/2.x/updates/2.6.1.0/ambari-2.6.1.0-centos7.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
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
3、将对应的tar包解压到httpd的文件目录:
[root@node-1 html]# tar xf ambari-2.6.1.0-centos7.tar.gz
[root@node-1 html]# tar xf HDP-2.6.4.0-centos7-rpm.tar.gz
[root@node-1 html]# tar xf HDP-GPL-2.6.4.0-centos7-rpm.tar.gz
[root@node-1 html]# mkdir HDP-UTILS
[root@node-1 html]# tar xf HDP-UTILS-1.1.0.22-centos7.tar.gz -C HDP-UTILS/
4、配置基础源,创建hadoop的repo文件,修改repo文件源路径:
# ambari 源
vim /etc/yum.repo.d/ambari.repo
[ambari-2.6.1.0]
name=ambari Version - ambari-2.6.1.0
baseurl=http://192.168.10.11/ambari/centos7/2.6.1.0-143
gpgcheck=1
gpgkey=http://192.168.10.11/ambari/centos7/2.6.1.0-143/RPM-GPG-KEY/RPM-GPG-KEY-Jenkins
enabled=1
priority=1
# HDP源:
vim /etc/yum.repo.d/hdp.repo
#VERSION_NUMBER=2.6.4.0-91
[HDP-2.6.4.0]
name=HDP Version - HDP-2.6.4.0
baseurl=http://192.168.10.11/HDP/centos7/2.6.4.0-91
gpgcheck=1
gpgkey=http://192.168.10.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.10.11/HDP-UTILS/
gpgcheck=1
gpgkey=http://192.168.10.11/HDP-UTILS/RPM-GPG-KEY/RPM-GPG-KEY-Jenkins
enabled=1
priority=1
[HDP-GPL-2.6.4.0]
name=HDP-GPL Version - HDP-GPL-2.6.4.0
baseurl=http://192.168.10.11/HDP-GPL/centos7/2.6.4.0-91
gpgcheck=1
gpgkey=http://192.168.10.11/HDP-GPL/centos7/2.6.4.0-91/RPM-GPG-KEY/RPM-GPG-KEY-Jenkins
enabled=1
priority=1
启动httpd。
5、将本地源的repo配置拷贝到其它节点,并创建缓存:
[root@node-1 ~]# scp /etc/yum.repos.d/ambari.repo 192.168.10.12:/etc/yum.repos.d/
[root@node-1 ~]# scp /etc/yum.repos.d/ambari.repo 192.168.10.13:/etc/yum.repos.d/
[root@node-1 ~]# scp /etc/yum.repos.d/hdp.repo 192.168.10.12:/etc/yum.repos.d/
[root@node-1 ~]# scp /etc/yum.repos.d/hdp.repo 192.168.10.13:/etc/yum.repos.d/
在各个节点创建缓存:
# yum clean all
# yum makecache fast
1、各个节点安装java-1.8.0-openjdk:
yum install java-1.8.0-openjdk -y
2、解析主机名:
echo "192.168.10.11 node-1" >> /etc/hosts
echo "192.168.10.12 node-2" >> /etc/hosts
echo "192.168.10.13 node-3" >> /etc/hosts
3、创建主机信任关系,主要是master节点到slave节点:
[root@node-1 ~]# ssh-keygen -t rsa
[root@node-1 ~]# cp id_rsa.pub /root/.ssh/authorized_keys
[root@node-1 ~]# scp id_rsa.pub 192.168.10.12:/root/.ssh/authorized_keys
[root@node-1 ~]# scp id_rsa.pub 192.168.10.13:/root/.ssh/authorized_keys
4、安装配置数据库:
yum install mariadb-server -y
systemctl start mariadb
mysql_secure_installation
# 创建数据库:
MariaDB [(none)]> create database ambari default character set utf8;
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> grant all on ambari.* to ambari@localhost identified by 'bigdata';
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> grant all on ambari.* to ambari@'%' identified by 'bigdata';
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> create database hive default character set utf8;
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> grant all on hive.* to hive@localhost identified by 'hive';
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> grant all on hive.* to hive@'%' identified by 'hive';
1、在node-1上安装ambari-server,并启动配置向导:
[root@node-1 ~]# yum install ambari-server -y
[root@node-1 ~]# ambari-server setup
提示: 如果安装配置用户时,出现如下报错:
ERROR: Unexpected error 'getpwuid(): uid not found: 1001',可以查看ambari.repo文件的权限,修改为默认的root 644权限即可。
2、按照配置向导信息,配置用户,java_home:
[root@node-1 ~]# 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):ambari
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/lib/jvm/java-1.8.0-openjdk-1.8.0.161-0.b14.el7_4.x86_64/jre # 填写java_home
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)? n
Completing setup...
Configuring database...
Enter advanced database configuration [y/n] (n)? y
Configuring database...
==============================================================================
Choose one of the following options:
[1] - PostgreSQL (Embedded)
[2] - Oracle
[3] - MySQL / MariaDB
[4] - PostgreSQL
[5] - Microsoft SQL Server (Tech Preview)
[6] - SQL Anywhere
[7] - BDB
==============================================================================
Enter choice (1): 3
Hostname (localhost):
Port (3306):
Database name (ambari):
Username (ambari):
Enter Database Password (bigdata):
Configuring ambari database...
WARNING: Before starting Ambari Server, you must copy the MySQL JDBC driver JAR file to /usr/share/java and set property "server.jdbc.driver.path=[path/to/custom_jdbc_driver]" in ambari.properties.
Press <enter> to continue.
3、到上面一步时,根据提示上传mysql的 jdbc驱动,并修改配置文件,指定jdbc驱动文件位置:
[root@node-1 ~]# cd /usr/share/java
[root@node-1 java]# ll
total 3388
-rw-r--r-- 1 root root 3467861 Jan 22 16:16 mysql-connector-java-5.1.45.tar.gz
[root@node-1 java]# tar xf mysql-connector-java-5.1.45.tar.gz
[root@node-1 java]# mv mysql-connector-java-5.1.45/mysql-connector-java-5.1.45-bin.jar ./
修改配置文件:
vim /etc/ambari-server/conf/ambari.properties
server.jdbc.driver.path=/usr/share/java/mysql-connector-java-5.1.45-bin.jar
配置完成后继续,会出现如下提示:
Press <enter> to continue.
Configuring remote database connection properties...
WARNING: Before starting Ambari Server, you must run the following DDL against the database to create the schema: /var/lib/ambari-server/resources/Ambari-DDL-MySQL-CREATE.sql
Proceed with configuring remote database connection properties [y/n] (y)?
4、出现上述提示时,根据信息导入数据库:
[root@node-1 ~]# mysql -uroot -p ambari < /var/lib/ambari-server/resources/Ambari-DDL-MySQL-CREATE.sql
5、启动服务:
[root@node-1 ~]# ambari-server start
6、服务启动成功后,会监听8080端口,使用浏览器登录,账号密码admin/admin正常登录,则安装完成。
使用ambari的web界面课完成对集群的所有管理操作,创建一个实例集群。
选择本地源,移除不必要的版本:
添加主机节点,上传id_rsa文件:
安装成功后,会显示如下界面:
选择需要安装的服务:
根据需要选择服务配置:
在后续的配置中,会提示配置账户密码,数据库等信息,根据提示配置即可。
参考文档:
https://baike.baidu.com/item/Ambari
https://baike.baidu.com/item/Hadoop/3526507?fr=aladdin
http://blog.fens.me/hadoop-family-roadmap/
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。