Hadoop是一個開發和運行處理大規模數據的軟件平臺,是Apache的一個用java語言實現開源軟件框架,實如今大量計算機組成的集羣中對海量數據進行分佈式計算。Hadoop框架中最核心設計就是:MapReduce和HDFS。MapReduce提供了對數據的分佈式計算,HDFS提供了海量數據的分佈式存儲。
在Hadoop家族中,收入了20多個用於計算、分析、存儲、監控、管理等組件和工具,這些家族成員極大的豐富了Hadoop的各方面的功能。html
下面簡單的列舉幾個常見的組件:java
Ambari 跟 Hadoop 等開源軟件同樣,也是 Apache Software Foundation 中的一個項目,而且是頂級項目。目前最新的發佈版本是 2.6.0。Ambari 是用來建立、管理、監視 Hadoop 的集羣,可是這裏的 Hadoop 是廣義,指的是 Hadoop 整個生態圈(例如 Hive,Hbase,Sqoop,Zookeeper 等),而並不只是特指 Hadoop。用一句話來講,Ambari 就是爲了讓 Hadoop 以及相關的大數據軟件更容易使用的一個工具。node
Ambari提供了對Hadoop更加方便快捷的管理功能,主要包含:python
在使用Ambari安裝部署Hadoop時,須要對下載鏡像源,配置本地環境。mysql
軟件包 Hadoop 軟件鏡像壓縮包,Ambari鏡像壓縮包,版本2.6web
一、在node-1上配置hadoop全部組件的yum源。安裝httpd:算法
[root@node-1 ~]# yum install httpd -y
二、在官方下載鏡像文件,此文件大概7G,可使用p2p工具下載,其中包含兩個repo文件和4個壓縮包:sql
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
三、將對應的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/
四、配置基礎源,建立hadoop的repo文件,修改repo文件源路徑:vim
# 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。
五、將本地源的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
一、各個節點安裝java-1.8.0-openjdk:
yum install java-1.8.0-openjdk -y
二、解析主機名:
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
三、建立主機信任關係,主要是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
四、安裝配置數據庫:
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';
一、在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權限便可。
二、按照配置嚮導信息,配置用戶,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.
三、到上面一步時,根據提示上傳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)?
四、出現上述提示時,根據信息導入數據庫:
[root@node-1 ~]# mysql -uroot -p ambari < /var/lib/ambari-server/resources/Ambari-DDL-MySQL-CREATE.sql
五、啓動服務:
[root@node-1 ~]# ambari-server start
六、服務啓動成功後,會監聽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/