@zhangyy
2021-06-22T16:23:31.000000Z
字数 7047
阅读 176
大数据平台构建
- 一: 关于HDP的介绍
- 二: 系统环境介绍
- 三: 系统环境初始化
- 四: 安装HDP3.1.4平台
- 五: 启用NameNode HA 与 YARN HA
Ambari是一种基于Web的工具,支持Apache Hadoop集群的创建 、管理和监控。
Ambari已支持大多数Hadoop组件,包括HDFS、MapReduce、Hive、Pig、 Hbase、Zookeeper、Sqoop和Hcatalog等。Apache Ambari 支持HDFS、MapReduce、Hive、Pig、Hbase、Zookeepr、Sqoop和Hcatalog等的集中管理。也是5个顶级hadoop管理工具之一。
Ambari 自身也是一个分布式架构的软件,主要由两部分组成:Ambari Server 和 Ambari Agent。简单来说,用户通过 Ambari Server 通知 Ambari Agent 安装对应的软件;Agent 会定时地发送各个机器每个软件模块的状态给 Ambari Server,最终这些状态信息会呈现在 Ambari 的 GUI,方便用户了解到集群的各种状态,并进行相应的维护。
HDP是hortonworks的软件栈,里面包含了hadoop生态系统的所有软件项目,比如HBase,Zookeeper,Hive,Pig等等。
HDP-UTILS是工具类库。
2.1.1:系统主机名
系统: Centos7.8 X64
---
192.168.100.11 node01.flyfish
192.168.100.12 node02.flyfish
192.168.100.13 node03.flyfish
192.168.100.14 node04.flyfish
192.168.100.15 node05.flyfish
192.168.100.16 node06.flyfish
192.168.100.17 node07.flyfish
本次安装采用前4台虚拟主机
Ambari在线安装特别慢,所以使用离线安装,建议使用迅雷下载
参照文档:
https://docs.cloudera.com/HDPDocuments/Ambari-2.7.4.0/bk_ambari-installation/content/hdp_314_repositories.html
ambari:
http://public-repo-1.hortonworks.com/ambari/centos7/2.x/updates/2.7.4.0/ambari-2.7.4.0-centos7.tar.gz
HDP:
http://public-repo-1.hortonworks.com/HDP/centos7/3.x/updates/3.1.4.0/HDP-3.1.4.0-centos7-rpm.tar.gz
HDP-UTILS:
http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.22/repos/centos7/HDP-UTILS-1.1.0.22-centos7.tar.gz
HDP-GPL:
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
做root用户无密钥认证
ssh-keygen ---一直敲回车到最后
cat id_rsa.pub >> authorized_keys
将所有的公钥导入authorized_keys 分发到 所有的 机器的.ssh/ 下面
然后测试
yum install -y firewall* iptable*
(1) 关闭firewalld
systemctl stop firewalld.service
systemctl disable firewalld.service
firewall-cmd --state
(2) 关闭iptables
iptables -F
systemctl stop iptables.service
service iptables save
systemctl disable iptables.service
(3) 禁用 selinux
sed -i '/SELINUX/s/enforcing/disabled/' /etc/selinux/config
setenforce 0
getenforce 0
sestatus
重启机器
reboot
vim /etc/security/limits.conf
---
* soft nofile 65535
* hard nofile 1029345
* soft nproc unlimited
* hard nproc unlimited
* soft memlock unlimited
* hard memlock unlimited
---
所有机器 yum install chrony*
1. node01.flyfish:
vim /etc/chrony.conf 增加
----
注释掉相关默认的server:
所有节点均同步阿里云时间服务器
server ntp1.aliyun.com iburst
service chronyd start
chkconfig chronyd on
rpm -ivh jdk-8u162-linux-x64.rpm
---
export JAVA_HOME=/usr/java/jdk1.8.0_162
export CLASSPATH=.:$JAVA_HOME/jre/lib:$JAVA_HOME/lib:$JAVA_HOME/lib/tools.jar
PATH=$PATH:$HOME/bin:$JAVA_HOME/bin
---
source /etc/profile
java -version
sh ssh_do_all.sh node.list "echo vm.swappiness = 10 >> /etc/sysctl.conf"
sh ssh_do_all.sh node.list "sysctl -p |grep vm.swappiness"
sh ssh_do_all.sh node.list "echo never > /sys/kernel/mm/transparent_hugepage/defrag"
sh ssh_do_all.sh node.list "echo never > /sys/kernel/mm/transparent_hugepage/enabled"
设置开机自关闭
将如下脚本添加到/etc/rc.local文件中
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
安装httpd
yum install -y httpd
service httpd start
chkconfig httpd on
cd /var/www/html/
1. ambari 的 yum源
cd /root/software
tar -zxvf ambari-2.7.4.0-centos7.tar
mv ambari /var/www/html/
cd /var/www/html/ambari/centos7/2.7.4.0-118
cp -p ambari.repo /etc/yum.repos.d/
cd /etc/yum.repos.d
vim ambari.repo
----
#VERSION_NUMBER=2.7.4.0-118
[ambari-2.7.4.0]
#json.url = http://public-repo-1.hortonworks.com/HDP/hdp_urlinfo.json
name=ambari Version - ambari-2.7.4.0
baseurl=http://192.168.100.11/ambari/centos7/2.7.4.0-118
gpgcheck=0
enabled=1
priority=1
----
cd /root/software
tar -zxvf HDP-3.1.4.0-centos7-rpm.tar.gz
mv HDP /var/www/html/
cd /var/www/html/HDP/centos7/3.1.4.0-315
cp -p hdp.repo /etc/yum.repos.d/
cd /root/software
tar -zxvf HDP-UTILS-1.1.0.22-centos7.tar.gz
mv HDP-UTILS /var/www/html/
cd /etc/yum.repos.d/
vim hdp.repo
---
#VERSION_NUMBER=3.1.4.0-315
[HDP-3.1.4.0]
name=HDP Version - HDP-3.1.4.0
baseurl=http://192.168.100.11/HDP/centos7/3.1.4.0-315
gpgcheck=0
enabled=1
priority=1
[HDP-UTILS-1.1.0.22]
name=HDP-UTILS Version - HDP-UTILS-1.1.0.22
baseurl=http://192.168.100.11/HDP-UTILS/centos7/1.1.0.22
gpgcheck=0
enabled=1
priority=1
---
----
tar -zxvf HDP-GPL-3.1.4.0-centos7-gpl.tar.gz
mv HDP-GPL /var/www/html/
cd /var/www/html/HDP-GPL/centos7/3.1.4.0-315
cp -p hdp.gpl.repo /etc/yum.repos.d/
cd /etc/yum.repos.d/
vim hdp.gpl.repo
----
#VERSION_NUMBER=3.1.4.0-315
[HDP-GPL-3.1.4.0]
name=HDP-GPL Version - HDP-GPL-3.1.4.0
baseurl=http://192.168.100.11/HDP-GPL/centos7/3.1.4.0-315
gpgcheck=0
enabled=1
priority=1
---
cd /etc/yum.repos.d/
scp ambari.repo hdp.repo hdp.gpl.repo node02.flyfish:/etc/yum.repos.d/
scp ambari.repo hdp.repo hdp.gpl.repo node03.flyfish:/etc/yum.repos.d/
scp ambari.repo hdp.repo hdp.gpl.repo node04.flyfish:/etc/yum.repos.d/
yum clean all
yum makecache fast
yum install -y mariadb-server
systemctl start mariadb
systemctl enable mariadb
设置密码为:flyfish225.com
mysql -uroot -pflyfish225.com
ambari 数据库:
create database ambari default character set utf8;
grant all privileges on ambari.* to 'ambari'@'%' identified by 'Ambari123' with grant option;
grant all privileges on ambari.* to 'ambari'@'node01.flyfish' identified by 'Ambari123' with grant option;
flush privileges;
use mysql;
UPDATE user SET PASSWORD=PASSWORD('Ambari123') where USER='ambari';
flush privileges;
hive 数据库:
create database hive character set utf8 ;
CREATE USER 'hive'@'%'IDENTIFIED BY 'Hive-123';
GRANT ALL PRIVILEGES ON *.* TO 'hive'@'%';
FLUSH PRIVILEGES;
oozie 数据库:
create database oozie character set utf8 ;
CREATE USER 'oozie'@'%'IDENTIFIED BY 'Oozie-123';
GRANT ALL PRIVILEGES ON *.* TO 'oozie'@'%';
FLUSH PRIVILEGES;
拷贝jdbc 到 java的目录
mkdir /usr/share/java
mv mysql-connector-java-5.1.49-bin.jar /usr/share/java/
cd /usr/share/java/
mv mysql-connector-java-5.1.49-bin.jar mysql-connector-java.jar
chmod 777 mysql-connector-java.jar
yum install -y ambari-server
vim /etc/ambari-server/conf/ambari.properties
----
增加:
server.jdbc.driver.path=/usr/share/java/mysql-connector-java.jar
---
ambari-server setup --jdbc-db=mysql --jdbc-driver=/usr/share/java/mysql-connector-java.jar
ambari-server setup
mysql -uroot -pflyfish225.com
use ambari
source /var/lib/ambari-server/resources/Ambari-DDL-MySQL-CREATE.sql
ambari-server start
http://192.168.100.11:8080
用户名:admin
密码: admin
选择了hdfs、yarn、zookeeper三个服务,仅供参考:
这一步分发要等很长的一段时间
---
拿掉:ambari卸载smartsence
smartsense是hortonworks一个商业的组件功能,作用是监控集群,并提供建议,建议是不用
第一步,确定SmartSence服务均已关闭:
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
第二步,卸载SmartSense组件:
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
第三步,从Ambari中卸载掉SmartSense服务:
curl -u admin:admin -H 'X-Requested-By: ambari' -X DELETE http://ip地址:8080/api/v1/clusters/集群名称/services/SMARTSENSE
第四步,重起Ambari使更改生效:
ambari-server restart