镜像 | 下载地址 |
---|---|
jdk-8u162-linux-x64 | https://download.csdn.net/download/qq_44697847/16840098 |
mysql | https://www.mysql.com/downloads/ |
ambari-2.7.4.0-centos7.tar.gz | https://download.csdn.net/download/qq_44697847/16845882 |
HDP-3.1.4.0-centos7-rpm.tar.gz | https://download.csdn.net/download/qq_44697847/16846206 |
HDP-GPL-3.1.4.0-centos7-gpl.tar.gz | https://download.csdn.net/download/qq_44697847/16846358 |
HDP-UTILS-1.1.0.22-centos7.tar.gz | https://download.csdn.net/download/qq_44697847/16846735 |
Vmware | https://www.vmware.com |
xshell+xfdp | https://download.csdn.net/download/qq_44697847/16839001 |
CentOS-7-x86_64 | https://download.csdn.net/download/qq_44697847/16838216 |
主机 | 名称 | 系统 | IP地址 | 内存 | 磁盘 |
---|---|---|---|---|---|
Centos1 | Master | Centos7 | 192.168.238.1(NAT) | 4G | 60G |
Centos2 | Node1 | Centos7 | 192.168.238.2(NAT) | 2G | 60G |
Centos3 | Node2 | Centos7 | 192.168.238.3(NAT) | 2G | 60G |
hostnamectl set-hostname master #master节点-192.168.238.1 hostnamectl set-hostname node1 #node1节点-192.168.238.2 hostnamectl set-hostname node2 #node2节点-192.168.238.3
需要在master node1 node2 三个节点上的hosts文件上都进行以下操作!
vi /etc/hosts #添加上以下内容 192.168.238.1 master 192.168.238.2 node1 192.168.238.3 node2
在后续的操作中,需要将防火墙关闭。所有节点都需要进行以下操作
systemctl status firewalld #查看firewall服务状态 ```![查看防火墙状态](https://www.www.zyiz.net/i/ll/?i=20210422201827621.png?,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzQ0Njk3ODQ3,size_16,color_FFFFFF,t_70#pic_center) ```shell systemctl stop firewalld && systemctl disable firewalld # 关闭防火墙
# 关闭selinux setenforce 0 vi /etc/selinux/config SELINUX=disabled
现将JDK包放到相应目录下之后解压/etc/lib/jvm下面
#保证当前目录下存在 jdk-8u162-linux-x64.tar.gz mkdir -p /usr/lib/jvm tar -zxvf jdk-8u162-linux-x64.tar.gz -C /usr/lib/jvm
# 配置环境变量 vi /etc/profile export JAVA_HOME=/opt/jdk1.8.0_171/ export PATH=$PATH:$JAVA_HOME/bin
#刷新环境变量 source /ect/profile
# master ssh-keygen ssh-copy-id hdp-1 ssh-copy-id hdp-2 ssh-copy-id hdp-3
# node1 ssh-keygen ssh-copy-id hdp-1 ssh-copy-id hdp-2 ssh-copy-id hdp-3
# node2 ssh-keygen ssh-copy-id hdp-1 ssh-copy-id hdp-2 ssh-copy-id hdp-3
**注意:**需要提前在node1 ,node2上创建jvm文件夹,保证 /usr/lib/jvm/路径存在
也可以手动在node1 node2两个节点上重复以上步骤安装jdk
scp -r /usr/lib/jvm/ node1:/usr/lib/jvm/ scp -r /usr/lib/jvm/ node2:/usr/lib/jvm/ scp /etc/profile/ node1:/usr/lib/jvm/ scp /etc/profile/ node2:/usr/lib/jvm/
最后不要忘记在node1 node2上执行下列代码 使环境变量生效
source /ect/profile
#分别在master node1 node2上面输入java -version检查是否安装成功 java -version
#安装 yum install -y ntp #修改ntp.conf vi /etc/ntp.conf server 127.127.1.0 fudge 127.127.1.0 stratum 10 systemctl start ntpd systemctl enbale ntpd #hdp-2 yum install -y ntpdate ntpdate hdp-1 #hdp-3 yum install -y ntpdate ntpdate hdp-1
yum install -y httpd yum start httpd yum enable http
echo never > /sys/kernel/mm/transparent_hugepage/enabled echo never > /sys/kernel/mm/transparent_hugepage/defrag
在/var/www/html 下面创建 ambari,hdp,hdp_util ,hdp_gpl三个文件夹
**这里推荐使用xfdp将之恶几个文件放入到虚拟节点上面。**基于Centos7安装Ambari+HDP.md
再将 ambari-2.7.4.0-centos7.tar.gz,HDP-3.1.4.0-centos7-rpm.tar.gz,HDP-UTILS-1.1.0.22-centos7.tar.gz ,HDP-GPL-3.1.4.0-centos7-gpl.tar.gz 放入到 /var/www/html路径下
tar -zxvf ambari-2.7.0.0-centos7.tar.gz -C /var/www/html/ambari/ tar -zxvf HDP-3.0.0.0-centos7-rpm.tar.gz -C /var/www/html/hdp tar -zxvf HDP-UTILS-1.1.0.22-centos7.tar.gz -C /var/www/html/hdp_util/ tar -zxvf HDP-GPL-3.1.4.0-centos7-gpl.tar.gz -C /var/www/html/hdp_gpl
这里我们对yum源进行配置
cd /etc/yum.repos.d
vi ambari.repo [ambari] name=ambari baseurl=http://192.168.238.1/ambari/ambari/centos7/2.7.0.0-897/ gpgcheck=0
注意文件中的baseurl是你自己电脑的实际位置,你可查看解压之后的文件位置,查看里买呢目录,这里推荐使用xfdp去查看
vi hdp.repo [HDP-3.1] name=HDP-3.1 baseurl=http://192.168.238.1/hdp/HDP/centos7/3.1.4.0-315/ gpgcheck=0 [HDP-UTILS-1.1.0.22] name=HDP-UTILS-1.1.0.22 baseurl=http://192.168.238.1/hdp-utils/HDP-UTILS/centos7/1.1.0.22/ gpgcheck=0 [HDP-3.1-GPL] name=HDP-3.1-GPL baseurl=http://192.168.238.1/hdp-gpl/HDP-GPL/centos7/3.1.4.0-315/ gpgcheck=0
# 验证 yum repolist
成功之后将配置的yum源发送给node1与node2
#成功之后将配置的yum源发送给node1 scp /etc/yum.repos.d/ambari.repo node1:/etc/yum.repos.d/ scp /etc/yum.repos.d/hdp.repo node2:/etc/yum.repos.d/
#将配置的yum源发送给node2 scp /etc/yum.repos.d/ambari.repo node1:/etc/yum.repos.d/ scp /etc/yum.repos.d/hdp.repo node2:/etc/yum.repos.d/
浏览器输入 http://192.168.238.1/ambari/
http://192.168.238.1/ambari/
数据库使用MariaDB作为元数据储存的库,在master上安装
# 安装 yum install -y mariadb-server # 启动 开机自启 systemctl start mariadb && systemctl enable mariadb # 初始化 mysql_secure_installation
在初始化过程中,我们需要对数据进行配置一下是配置选项
Set root password? [Y/n] Y Remove anonymous users? [Y/n] Y Disallow root login remotely? [Y/n] n Remove test database and access to it? [Y/n] Y Reload privilege tables now? [Y/n] Y
yum install -y ambari-server
#登陆 mysql -uroot -proot # 创建amabri数据库 create database ambari; #授权 grant all on ambari.* to ambari@'%' identified by '数据库密码'; grant all on ambari.* to ambari@localhost identified by '数据库密码'; # 使用ambari-server提供的sql脚本创建相关的表 use ambari; source /var/lib/ambari-server/resources/Ambari-DDL-MySQL-CREATE.sql
下载连接:java/mysql-connector-java.jar
mkdir -p /usr/share/java mv mysql-connector-java-*.jar /usr/share/java/mysql-connector-java.jar
ambari-server setup
配置信息
OK to continue [y/n] (y)? y Customize user account for ambari-server daemon [y/n] (n)? y Checking JDK... [1] Oracle JDK 1.8 + Java Cryptography Extension (JCE) Policy Files 8 [2] Custom JDK ============================================================================== Enter choice (1): 2 Enable Ambari Server to download and install GPL Licensed LZO packages [y/n] (n)? n Enter advanced database configuration [y/n] (n)? y 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):master Port (3306): 3306 #后面的几个问题直接按 enter键
#启动ambari-server ambari-server start
# 安装 yum install -y ambari-agent # 配置 vi /etc/ambari-agent/conf/ambari-agent.ini [server] hostname=hdp-1 #启动 amabri-agent start
http://192.168.238.3:8080
出现登录界面,默认管理员账户登录,账户:admin 密码:admin
ambari的安装到这就结束了,但是这只是一个安装,后续可以更具你自己的需要,来使用ambari的web页面去安装一下组件,笔记hpd ,hbase, hive等等