[关闭]
@zhangyy 2021-06-22T16:23:31.000000Z 字数 7047 阅读 181

Ambari2.7.4+HDP3.1.4安装 Centos7离线安装

大数据平台构建

  • 一: 关于HDP的介绍
  • 二: 系统环境介绍
  • 三: 系统环境初始化
  • 四: 安装HDP3.1.4平台
  • 五: 启用NameNode HA 与 YARN HA

一: 关于HDP的介绍

1.1 ambari的介绍

  1. Ambari是一种基于Web的工具,支持Apache Hadoop集群的创建 、管理和监控。
  2. Ambari已支持大多数Hadoop组件,包括HDFSMapReduceHivePig HbaseZookeeperSqoopHcatalog等。Apache Ambari 支持HDFSMapReduceHivePigHbaseZookeeprSqoopHcatalog等的集中管理。也是5个顶级hadoop管理工具之一。
  3. Ambari 自身也是一个分布式架构的软件,主要由两部分组成:Ambari Server Ambari Agent。简单来说,用户通过 Ambari Server 通知 Ambari Agent 安装对应的软件;Agent 会定时地发送各个机器每个软件模块的状态给 Ambari Server,最终这些状态信息会呈现在 Ambari GUI,方便用户了解到集群的各种状态,并进行相应的维护。

1.2 hdp的介绍

  1. HDPhortonworks的软件栈,里面包含了hadoop生态系统的所有软件项目,比如HBase,Zookeeper,Hive,Pig等等。

1.3 HDP-UTILS

  1. HDP-UTILS是工具类库。

二:系统环境安装介绍

2.1 操作系统与环境

  1. 2.1.1:系统主机名
  2. 系统: Centos7.8 X64
  3. ---
  4. 192.168.100.11 node01.flyfish
  5. 192.168.100.12 node02.flyfish
  6. 192.168.100.13 node03.flyfish
  7. 192.168.100.14 node04.flyfish
  8. 192.168.100.15 node05.flyfish
  9. 192.168.100.16 node06.flyfish
  10. 192.168.100.17 node07.flyfish
  11. 本次安装采用前4台虚拟主机

2.2 系统包下载地址

  1. Ambari在线安装特别慢,所以使用离线安装,建议使用迅雷下载
  2. 参照文档:
  3. https://docs.cloudera.com/HDPDocuments/Ambari-2.7.4.0/bk_ambari-installation/content/hdp_314_repositories.html
  4. ambari:
  5. http://public-repo-1.hortonworks.com/ambari/centos7/2.x/updates/2.7.4.0/ambari-2.7.4.0-centos7.tar.gz
  6. HDP:
  7. http://public-repo-1.hortonworks.com/HDP/centos7/3.x/updates/3.1.4.0/HDP-3.1.4.0-centos7-rpm.tar.gz
  8. HDP-UTILS:
  9. http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.22/repos/centos7/HDP-UTILS-1.1.0.22-centos7.tar.gz
  10. HDP-GPL
  11. http://public-repo-1.hortonworks.com/HDP-GPL/centos7/3.x/updates/3.1.4.0/HDP-GPL-3.1.4.0-centos7-gpl.tar.gz

三:系统环境初始化

3.1:无密钥登录配置

  1. root用户无密钥认证
  2. ssh-keygen ---一直敲回车到最后
  3. cat id_rsa.pub >> authorized_keys
  4. 将所有的公钥导入authorized_keys 分发到 所有的 机器的.ssh/ 下面
  5. 然后测试

image_1ec7t75c11kn4n3jpbf2913gmp.png-80.6kB

3.2: 关闭 firewalld,iptables 与 selinux

  1. yum install -y firewall* iptable*
  2. (1) 关闭firewalld
  3. systemctl stop firewalld.service
  4. systemctl disable firewalld.service
  5. firewall-cmd --state
  6. (2) 关闭iptables
  7. iptables -F
  8. systemctl stop iptables.service
  9. service iptables save
  10. systemctl disable iptables.service
  11. (3) 禁用 selinux
  12. sed -i '/SELINUX/s/enforcing/disabled/' /etc/selinux/config
  13. setenforce 0
  14. getenforce 0
  15. sestatus
  16. 重启机器
  17. reboot

image_1ec7t8565u2i16lh1vp71fdt1gem16.png-103.4kB

3.3 所有机器更改centos7.5x64的文件句柄数

  1. vim /etc/security/limits.conf
  2. ---
  3. * soft nofile 65535
  4. * hard nofile 1029345
  5. * soft nproc unlimited
  6. * hard nproc unlimited
  7. * soft memlock unlimited
  8. * hard memlock unlimited
  9. ---

image_1ec7t8uhg105r131h1hjnfh01rm71j.png-59kB

3.4 生产环境配置chrony 时间同步服务器

  1. 所有机器 yum install chrony*
  2. 1. node01.flyfish:
  3. vim /etc/chrony.conf 增加
  4. ----
  5. 注释掉相关默认的server:
  6. 所有节点均同步阿里云时间服务器
  7. server ntp1.aliyun.com iburst
  8. service chronyd start
  9. chkconfig chronyd on

image_1ec7tc1201dlj1s7bftbnu1gn02d.png-106.2kB

image_1ec7tbhi41t61oi08sdf1cpj20.png-113.3kB


3.6 安装jdk1.8.

  1. rpm -ivh jdk-8u162-linux-x64.rpm
  2. ---
  3. export JAVA_HOME=/usr/java/jdk1.8.0_162
  4. export CLASSPATH=.:$JAVA_HOME/jre/lib:$JAVA_HOME/lib:$JAVA_HOME/lib/tools.jar
  5. PATH=$PATH:$HOME/bin:$JAVA_HOME/bin
  6. ---
  7. source /etc/profile
  8. java -version

image_1ec7th44r1mug1clm1ild15bvt629.png-37.8kB

image_1ec7thugo1bu8r5612gu1am7dvep.png-59.1kB


3.7 设置swap

  1. sh ssh_do_all.sh node.list "echo vm.swappiness = 10 >> /etc/sysctl.conf"
  2. sh ssh_do_all.sh node.list "sysctl -p |grep vm.swappiness"

image_1efqmiptsrh61l5n13ne1vpm1mnj9.png-82.8kB

3.8 设置透明大页面

  1. sh ssh_do_all.sh node.list "echo never > /sys/kernel/mm/transparent_hugepage/defrag"
  2. sh ssh_do_all.sh node.list "echo never > /sys/kernel/mm/transparent_hugepage/enabled"

  1. 设置开机自关闭
  2. 将如下脚本添加到/etc/rc.local文件中
  3. if test -f /sys/kernel/mm/transparent_hugepage/enabled; then echo never > /sys/kernel/mm/transparent_hugepage/enabled fi if test -f /sys/kernel/mm/transparent_hugepage/defrag; then echo never > /sys/kernel/mm/transparent_hugepage/defrag fi

四: 安装 hdp3.1.4

4.1 : 配置ambari所需安装源

  1. 安装httpd
  2. yum install -y httpd
  3. service httpd start
  4. chkconfig httpd on
  5. cd /var/www/html/
  6. 1. ambari yum
  7. cd /root/software
  8. tar -zxvf ambari-2.7.4.0-centos7.tar
  9. mv ambari /var/www/html/

image_1efqn24gg1jjpe591hrchvu16g1m.png-271.1kB

image_1efqn2htd3lv1ahh1kc91t0tkk913.png-30.2kB


  1. cd /var/www/html/ambari/centos7/2.7.4.0-118
  2. cp -p ambari.repo /etc/yum.repos.d/
  3. cd /etc/yum.repos.d
  4. vim ambari.repo
  5. ----
  6. #VERSION_NUMBER=2.7.4.0-118
  7. [ambari-2.7.4.0]
  8. #json.url = http://public-repo-1.hortonworks.com/HDP/hdp_urlinfo.json
  9. name=ambari Version - ambari-2.7.4.0
  10. baseurl=http://192.168.100.11/ambari/centos7/2.7.4.0-118
  11. gpgcheck=0
  12. enabled=1
  13. priority=1
  14. ----

image_1ec7ubh9t1d181mvn11gv17i31fguc.png-175.1kB

4.2 配置hdp和hdp-utils 的源

  1. cd /root/software
  2. tar -zxvf HDP-3.1.4.0-centos7-rpm.tar.gz
  3. mv HDP /var/www/html/
  4. cd /var/www/html/HDP/centos7/3.1.4.0-315
  5. cp -p hdp.repo /etc/yum.repos.d/
  6. cd /root/software
  7. tar -zxvf HDP-UTILS-1.1.0.22-centos7.tar.gz
  8. mv HDP-UTILS /var/www/html/
  9. cd /etc/yum.repos.d/
  10. vim hdp.repo
  11. ---
  12. #VERSION_NUMBER=3.1.4.0-315
  13. [HDP-3.1.4.0]
  14. name=HDP Version - HDP-3.1.4.0
  15. baseurl=http://192.168.100.11/HDP/centos7/3.1.4.0-315
  16. gpgcheck=0
  17. enabled=1
  18. priority=1
  19. [HDP-UTILS-1.1.0.22]
  20. name=HDP-UTILS Version - HDP-UTILS-1.1.0.22
  21. baseurl=http://192.168.100.11/HDP-UTILS/centos7/1.1.0.22
  22. gpgcheck=0
  23. enabled=1
  24. priority=1
  25. ---
  26. ----
  27. tar -zxvf HDP-GPL-3.1.4.0-centos7-gpl.tar.gz
  28. mv HDP-GPL /var/www/html/
  29. cd /var/www/html/HDP-GPL/centos7/3.1.4.0-315
  30. cp -p hdp.gpl.repo /etc/yum.repos.d/
  31. cd /etc/yum.repos.d/
  32. vim hdp.gpl.repo
  33. ----
  34. #VERSION_NUMBER=3.1.4.0-315
  35. [HDP-GPL-3.1.4.0]
  36. name=HDP-GPL Version - HDP-GPL-3.1.4.0
  37. baseurl=http://192.168.100.11/HDP-GPL/centos7/3.1.4.0-315
  38. gpgcheck=0
  39. enabled=1
  40. priority=1
  41. ---
  42. cd /etc/yum.repos.d/
  43. scp ambari.repo hdp.repo hdp.gpl.repo node02.flyfish:/etc/yum.repos.d/
  44. scp ambari.repo hdp.repo hdp.gpl.repo node03.flyfish:/etc/yum.repos.d/
  45. scp ambari.repo hdp.repo hdp.gpl.repo node04.flyfish:/etc/yum.repos.d/
  46. yum clean all
  47. yum makecache fast

image_1ec7vo68h1os1g8515k84saillp.png-177.5kB

image_1ec7voiooohnofb1djciu61pa316.png-174.6kB

image_1ec7vp1q1192p919ol1287fr71m.png-166.2kB

image_1efqoh16g178d5751gsqt2p12ge1g.png-214.5kB


4.3 安装mariadb-server 数据库

  1. yum install -y mariadb-server
  2. systemctl start mariadb
  3. systemctl enable mariadb
  4. 设置密码为:flyfish225.com

image_1efqoka15sds18acv301ncv77n2a.png-273.9kB

image_1efqojp26m37otkrgo1udtofd1t.png-126.5kB

image_1efqolsuupe6p29ruc1r9uiej2n.png-200kB

image_1efqomco9ff613m919uj1tfh21734.png-131.4kB


  1. mysql -uroot -pflyfish225.com
  2. ambari 数据库:
  3. create database ambari default character set utf8;
  4. grant all privileges on ambari.* to 'ambari'@'%' identified by 'Ambari123' with grant option;
  5. grant all privileges on ambari.* to 'ambari'@'node01.flyfish' identified by 'Ambari123' with grant option;
  6. flush privileges;
  7. use mysql;
  8. UPDATE user SET PASSWORD=PASSWORD('Ambari123') where USER='ambari';
  9. flush privileges;
  10. hive 数据库:
  11. create database hive character set utf8 ;
  12. CREATE USER 'hive'@'%'IDENTIFIED BY 'Hive-123';
  13. GRANT ALL PRIVILEGES ON *.* TO 'hive'@'%';
  14. FLUSH PRIVILEGES;
  15. oozie 数据库:
  16. create database oozie character set utf8 ;
  17. CREATE USER 'oozie'@'%'IDENTIFIED BY 'Oozie-123';
  18. GRANT ALL PRIVILEGES ON *.* TO 'oozie'@'%';
  19. FLUSH PRIVILEGES;

image_1ec800j5h4u0vuc4j4i3e1716.png-150.1kB

image_1ec8010ah1jpt1jf515emp86v1r1j.png-123.5kB

4.3 安装jdbc

  1. 拷贝jdbc java的目录
  2. mkdir /usr/share/java
  3. mv mysql-connector-java-5.1.49-bin.jar /usr/share/java/
  4. cd /usr/share/java/
  5. mv mysql-connector-java-5.1.49-bin.jar mysql-connector-java.jar
  6. chmod 777 mysql-connector-java.jar

image_1efqor75n1srg1brjnmh50j1r1v3h.png-206.6kB

4.4 安装ambari

  1. yum install -y ambari-server

image_1ec80lj431rn31sha077on1c743n.png-258.9kB

  1. vim /etc/ambari-server/conf/ambari.properties
  2. ----
  3. 增加:
  4. server.jdbc.driver.path=/usr/share/java/mysql-connector-java.jar
  5. ---
  6. ambari-server setup --jdbc-db=mysql --jdbc-driver=/usr/share/java/mysql-connector-java.jar

image_1ec80o23d1o0onec16dt1lo419g24h.png-101.6kB

  1. ambari-server setup

image_1ec8135c5b321oqdb11fgf6cf4u.png-242.5kB

image_1ec8144k0gn5p2714n91sdjeu25b.png-240.7kB

image_1ec815j1i12br5bpteh1itlr4s65.png-114.7kB


  1. mysql -uroot -pflyfish225.com
  2. use ambari
  3. source /var/lib/ambari-server/resources/Ambari-DDL-MySQL-CREATE.sql

image_1ec814t0k167c12o612l57cj3af5o.png-146.7kB

4.5 启动ambari

  1. ambari-server start

image_1ec818bven3bgigtuc16ijq8d6i.png-139.2kB

image_1ec819aigamqinj1chk1nnlglq6v.png-43kB

4.6 打开ambari的web

  1. http://192.168.100.11:8080
  2. 用户名:admin
  3. 密码: admin

image_1ec81apfr13br1chr95kbj1ve77c.png-119.8kB


image_1ec81bji81kpng3cs4310jg4c27p.png-243.7kB

image_1ec81d0a08csls2boq1dtchqb8i.png-209.3kB

image_1ec81hslg1ljr4fnv9318j818cb8v.png-212.4kB

image_1efqrd3mauqh14551ba0ntp1pp89.png-293.6kB

image_1efqrfk0517ts5el1irngsg1pi8m.png-442.5kB

image_1efqrg73d1qc81n4d1ma21qbm5n713.png-311kB

image_1efqri75cq321g8c17ici1i1n881g.png-339.3kB


  1. 选择了hdfsyarnzookeeper三个服务,仅供参考:

image_1efr1ff4l22a1njb75fqj31k3d5v.png-538.4kB

image_1efr1esgl1ujbklr1spu1lek7035i.png-342.2kB

image_1efr1gvis1s7914s4rdrrbqao6c.png-355.2kB

image_1efr1ho2p8vb1m4iiobv2f64n6p.png-245.1kB

image_1efr1ihai1j9ntc718jmubm1puj76.png-287.9kB

image_1efr1j59510r61dh64n81gedma97j.png-316.6kB

image_1efr1jkqb19ei1p1516fh145v1n6p80.png-400.6kB

  1. 这一步分发要等很长的一段时间

image_1efr1keai11s0joa1lsi1q771fnu8d.png-325.4kB

image_1efr35m76vb41b9j1hmmqg71th38q.png-328.3kB

image_1efr36565pdr1m3amvmpusfg97.png-350.8kB

image_1efrpj80d1huke6r11ok14hronh9.png-571.3kB

  1. ---
  2. 拿掉:ambari卸载smartsence
  3. smartsensehortonworks一个商业的组件功能,作用是监控集群,并提供建议,建议是不用
  4. 第一步,确定SmartSence服务均已关闭:
  5. curl -u admin:admin -i -H 'X-Requested-By: ambari' -X PUT -d '{"RequestInfo": {"context" :"Stop SmartSense via REST"}, "Body": {"ServiceInfo": {"state": "INSTALLED"}}}' http://ip地址:8080/api/v1/clusters/集群名称/services/SMARTSENSE
  6. 第二步,卸载SmartSense组件:
  7. curl -u admin:admin -i -H 'X-Requested-By: ambari' -X POST -d '{"RequestInfo": {"context" :"Uninstall SmartSense via REST", "command":"Uninstall"}, "Requests/resource_filters":[{"hosts":"comma separated host names", "service_name":"SMARTSENSE", "component_name":"HST_AGENT"}]}' http://ip地址:8080/api/v1/clusters/集群名称/requests
  8. 第三步,从Ambari中卸载掉SmartSense服务:
  9. curl -u admin:admin -H 'X-Requested-By: ambari' -X DELETE http://ip地址:8080/api/v1/clusters/集群名称/services/SMARTSENSE
  10. 第四步,重起Ambari使更改生效:
  11. ambari-server restart

添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注