三台机器安装好CentOS-7-x86_64-Minimal-1708.iso
下载地址:https://www.centos.org/download/
最好在安装时设置好IP和HOSTNAME
三台机器的IP和HOSTNAME下载如下
主 192.168.31.11 SY-001.hadoop
从 192.168.31.12 SY-002.hadoop
从 192.168.31.13 SY-003.hadoop
每个节点设置host
[root@SY-001 ~]# vi /etc/hosts127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4::1 localhost localhost.localdomain localhost6 localhost6.localdomain6192.168.31.11 SY-001 SY-001.hadoop192.168.31.12 SY-002 SY-002.hadoop192.168.31.13 SY-003 SY-003.hadoop
每个节点关闭DHCP 设置为静态IP
[root@SY-001 ~]# vi /etc/sysconfig/network-scripts/ifcfg-ens33TYPE=EthernetPROXY_METHOD=noneBROWSER_ONLY=noBOOTPROTO=staticDEFROUTE=yesIPV4_FAILURE_FATAL=noIPV6INIT=yesIPV6_AUTOCONF=yesIPV6_DEFROUTE=yesIPV6_FAILURE_FATAL=noIPV6_ADDR_GEN_MODE=stable-privacyNAME=ens33UUID=87a7a287-0360-476a-996c-a60012f7b087DEVICE=ens33ONBOOT=yesIPADDR=192.168.31.11PREFIX=24GATEWAY=192.168.31.1DNS1=192.168.31.1IPV6_PRIVACY=no
2.操作系统环境准备
2.1 配置SSH免密码登录
主节点里root用户登录执行如下步骤
[root@SY-001 ~]# ssh-keygen[root@SY-001 ~]# cd ~/.ssh/[root@SY-001 ~]# cat id_rsa.pub >>authorized_keys[root@SY-001 ~]# chmod 600 ~/.ssh[root@SY-001 ~]# chmod 600 ~/.ssh/authorized_keys
先在从节点登录root执行命令
[root@SY-002 ~]# mkdir ~/.ssh/[root@SY-003 ~]# mkdir ~/.ssh/
分发主节点里配置好的authorized_keys到各从节点
[root@SY-001 ~]# scp /root/.ssh/authorized_keys root@192.168.31.12:/root/.ssh/authorized_keys[root@SY-001 ~]# scp /root/.ssh/authorized_keys root@192.168.31.13:/root/.ssh/authorized_keys
2.2 创建ambari系统用户和用户组
只在主节点操作
添加ambari安装、运行用户和用户组,也可以不创建新用户,直接使用root,我是直接用的root
[root@SY-001 ~]# adduser ambari[root@SY-001 ~]# passwd ambari
2.3 开启NTP服务
所有节点都需要操作
[root@SY-001 ~]# yum install ntp[root@SY-001 ~]# systemctl is-enabled ntpd[root@SY-001 ~]# systemctl enable ntpd[root@SY-001 ~]# systemctl start ntpd
2.4 检查DNS和NSCD
所有节点都要设置
ambari在安装时需要配置全域名,所以需要检查DNS。为了减轻DNS的负担, 建议在节点里用 Name Service Caching Daemon (NSCD)
[root@SY-001 ~]# vi /etc/hosts192.168.131.11 SY-001 SY-001.hadoop192.168.131.12 SY-002 SY-002.hadoop192.168.131.13 SY-003 SY-003.hadoop
每台节点里配置FQDN,如下以主节点为例
[root@SY-001 ~]# vi /etc/sysconfig/networkNETWORKING=yesHOSTNAME=yy
2.5 关闭防火墙
所有节点都要设置
[root@SY-001 ~]# systemctl disable firewalld[root@SY-001 ~]# systemctl stop firewalld
2.6 关闭SELinux
所有节点都要设置
查看SELinux状态:
[root@SY-001 ~]# sestatusSELinux status: enabled[root@SY-001 ~]# sestatusSELinux status: disabled
临时关闭,不用重启机器:
[root@SY-001 ~]# setenforce 0
修改配置文件需要重启机器:
[root@SY-001 ~]# vi /etc/sysconfig/selinuxSELINUX=disabled
制作本地源只需在主节点上进行即可
3.1 相关准备工作
3.1.1安装 Apache HTTP 服务器
安装HTTP 服务器,允许 http 服务通过防火墙(永久)
[root@SY-001 ~]# yum install httpd[root@SY-001 ~]# firewall-cmd --add-service=http[root@SY-001 ~]# firewall-cmd --permanent --add-service=http
添加 Apache 服务到系统层使其随系统自动启动
[root@SY-001 ~]# systemctl start httpd.service[root@SY-001 ~]# systemctl enable httpd.service
3.1.2 安装本地源制作相关工具
[root@SY-001 ~]# yum install yum-utils createrepo
3.2 下载安装资源
下载 Ambari 2.6.0 , HDP 2.6.3 的安装资源,本次安装是在CentOS 7 上,只列出CentOS 7的资源,其他系统的请现在对用系统的资源
Ambari 2.6.0 下载资源
RedHat 7 CentOS 7 Oracle Linux 7 | Base URL | http://public-repo-1.hortonworks.com/ambari/centos7/2.x/updates/2.6.0.0 |
Repo File | http://public-repo-1.hortonworks.com/ambari/centos7/2.x/updates/2.6.0.0/ambari.repo | |
Tarball | http://public-repo-1.hortonworks.com/ambari/centos7/2.x/updates/2.6.0.0/ambari-2.6.0.0-centos7.tar.gz |
HDP 2.6.3 下载资源
RedHat 7 CentOS 7 Oracle Linux 7 | HDP-2.6.3.0 | HDP | Version Definition File (VDF) | http://public-repo-1.hortonworks.com/HDP/centos7/2.x/updates/2.6.3.0/HDP-2.6.3.0-235.xml |
Base URL | http://public-repo-1.hortonworks.com/HDP/centos7/2.x/updates/2.6.3.0 | |||
Repo File | http://public-repo-1.hortonworks.com/HDP/centos7/2.x/updates/2.6.3.0/hdp.repo | |||
Tarball | http://public-repo-1.hortonworks.com/HDP/centos7/2.x/updates/2.6.3.0/HDP-2.6.3.0-centos7-rpm.tar.gz | |||
HDP-UTILS | Base URL | http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.21/repos/centos7 | ||
Tarball | http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.21/repos/centos7/HDP-UTILS-1.1.0.21-centos7.tar.gz |
下载上面列表的中的压缩包,
需要下载的压缩包如下:
Ambari 2.6.0http://public-repo-1.hortonworks.com/ambari/centos7/2.x/updates/2.6.0.0/ambari-2.6.0.0-centos7.tar.gzHDP 2.6.3http://public-repo-1.hortonworks.com/HDP/centos7/2.x/updates/2.6.3.0/HDP-2.6.3.0-centos7-rpm.tar.gzHDP-UTILS 1.1.0.21http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.21/repos/centos7/HDP-UTILS-1.1.0.21-centos7.tar.gz
在httpd网站根目录,默认是即/var/www/html/,创建目录ambari,
并且将下载的压缩包解压到/var/www/html/ambari目录
HDP-UTILS需要先建立一个HDP-UTILS文件夹并将HDP-UTILS-1.1.0.21-centos7.tar.gz放到HDP-UTILS目录下再解压
[root@SY-001 ~]# cd /var/www/html/[root@SY-001 html]# mkdir ambari[root@SY-001 html]# cd /var/www/html/ambari/[root@SY-001 ambari]# wget http://public-repo-1.hortonworks.com/ambari/centos7/2.x/updates/2.6.0.0/ambari-2.6.0.0-centos7.tar.gz[root@SY-001 ambari]# wget http://public-repo-1.hortonworks.com/HDP/centos7/2.x/updates/2.6.3.0/HDP-2.6.3.0-centos7-rpm.tar.gz[root@SY-001 ambari]# wget http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.21/repos/centos7/HDP-UTILS-1.1.0.21-centos7.tar.gz[root@SY-001 ambari]# tar -zxvf ambari-2.6.0.0-centos7.tar.gz[root@SY-001 ambari]# tar -zxvf HDP-2.6.3.0-centos7-rpm.tar.gz[root@SY-001 ambari]# mkdir HDP-UTILS[root@SY-001 ambari]# mv HDP-UTILS-1.1.0.21-centos7.tar.gz /var/www/html/ambari/HDP-UTILS/[root@SY-001 ambari]# tar -zxvf HDP-UTILS-1.1.0.21-centos7.tar.gz
验证httpd网站是否可用,用浏览器直接访问下面的地址,如果能看到目录列表就表示成功:
http://192.168.31.1/ambari/
3.3 配置ambari、HDP、HDP-UTILS的本地源
首先下载上面资源列表中的相应repo文件,修改其中的URL为本地的地址,相关配置如下:
ambari.repo
[root@SY-001 yum.repos.d]# vi ambari.repo #VERSION_NUMBER=2.6.0.0-267[ambari-2.6.0.0]name=ambari Version - ambari-2.6.0.0baseurl=http://192.168.31.11/ambari/ambari/centos7/2.6.0.0-267gpgcheck=1gpgkey=http://192.168.31.11/ambari/ambari/centos7/2.6.0.0-267/RPM-GPG-KEY/RPM-GPG-KEY-Jenkinsenabled=1priority=1
hdp.repo
[root@SY-001 yum.repos.d]# vi hdp.repo #VERSION_NUMBER=2.6.3.0-235[HDP-2.6.3.0]name=HDP Version - HDP-2.6.3.0baseurl=http://localhost/home/rk/apps/ambari/HDP/centos7/2.6.3.0-235gpgcheck=1gpgkey=http://localhost/home/rk/apps/ambari/HDP/centos7/2.6.3.0-235/RPM-GPG-KEY/RPM-GPG-KEY-Jenkinsenabled=1priority=1[HDP-UTILS-1.1.0.21]name=HDP Utils Version - HDP-UTILS-1.1.0.21baseurl=http://localhost/home/rk/apps/ambari/HDP-UTILSgpgcheck=1gpgkey=http://localhost/home/rk/apps/ambari/HDP-UTILS/RPM-GPG-KEY/RPM-GPG-KEY-Jenkinsenabled=1priority=1
将上面的修改过的源放到/etc/yum.repos.d/下面
[root@SY-001 yum.repos.d]# yum clean all[root@SY-001 yum.repos.d]# yum list update[root@SY-001 yum.repos.d]# yum makecache[root@SY-001 yum.repos.d]# yum repolist
3.4 安装Mysql数据库
Ambari安装会将安装等信息写入数据库,建议使用MariaDB数据库,也可以不安装而使用默认数据库PostgreSQL
[root@SY-001 ~]# yum install mariadb-server[root@SY-001 ~]# systemctl start mariadb[root@SY-001 ~]# systemctl enable mariadb
#数据库初始化设置[root&#64;SY-001 ~]# mysql_secure_installation#首先是设置密码&#xff0c;会提示先输入密码Enter current password for root (enter for none):<–初次运行直接回车#设置密码Set root password? [Y/n] <– 是否设置root用户密码&#xff0c;输入y并回车或直接回车New password: <– 设置root用户的密码Re-enter new password: <– 再输入一次你设置的密码#其他配置Remove anonymous users? [Y/n] <– 是否删除匿名用户&#xff0c;回车Disallow root login remotely? [Y/n] <–是否禁止root远程登录,回车,Remove test database and access to it? [Y/n] <– 是否删除test数据库&#xff0c;回车Reload privilege tables now? [Y/n] <– 是否重新加载权限表&#xff0c;回车#初始化MariaDB完成&#xff0c;接下来测试登录&#xff0c;输入密码能正常登陆就完成了[root&#64;SY-001 ~]# mysql -uroot -p
安装完成后创建ambari数据库及用户&#xff0c;登录数据库root用户执行下面语句&#xff1a;
[root&#64;SY-001 ~]# mysql -uroot -pcreate database ambari character set utf8 ;CREATE USER &#39;ambari&#39;&#64;&#39;%&#39;IDENTIFIED BY &#39;ambari&#39;;GRANT ALL PRIVILEGES ON *.* TO &#39;ambari&#39;&#64;&#39;%&#39;;FLUSH PRIVILEGES;
如果要安装Hive&#xff0c;再创建Hive数据库和用户 再执行下面的语句&#xff1a;
create database hive character set utf8 ;CREATE USER &#39;hive&#39;&#64;&#39;%&#39;IDENTIFIED BY &#39;hive&#39;;GRANT ALL PRIVILEGES ON *.* TO &#39;hive&#39;&#64;&#39;%&#39;;FLUSH PRIVILEGES;
如果要安装Oozie&#xff0c;再创建Oozie数据库和用户 再执行下面的语句&#xff1a;
create database oozie character set utf8 ;CREATE USER &#39;oozie&#39;&#64;&#39;%&#39;IDENTIFIED BY &#39;oozie&#39;;GRANT ALL PRIVILEGES ON *.* TO &#39;oozie&#39;&#64;&#39;%&#39;;FLUSH PRIVILEGES;
安装mysql jdbc 驱动
[root&#64;SY-001 ~]# yum install mysql-connector-java
3.5 安装JDK
Java SE Development Kit 8u152下载地址&#xff1a;http://www.oracle.com/technetwork/cn/java/javase/downloads/jdk8-downloads-2133151-zhs.html
下载解压版jdk-8u152-linux-x64.tar.gz&#xff0c;再执行下面命令&#xff1a;
[root&#64;SY-001 ~]# tar -zxvf jdk-8u152-linux-x64.tar.gz -C /opt/java/
[root&#64;SY-001 ~]# vi /etc/profile
export JAVA_HOME&#61;/opt/java/jdk1.8.0_152
export CLASSPATH&#61;.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
PATH&#61;$PATH:$HOME/bin:$JAVA_HOME/bin
source /etc/profile
4.1 安装Ambari2.6.0
4.1.1安装Ambari
[root&#64;SY-001 ~]# yum install ambari-server
4.1.2配置Ambari
[root&#64;SY-001 ~]# ambari-server setup
下面是配置执行流程&#xff0c;按照提示操作
1.检查SELinux是否关闭&#xff0c;如果关闭不用操作
Using python /usr/bin/python
Setup ambari-server
Checking SELinux...
SELinux status is &#39;disabled&#39;
2.提示是否自定义设置。输入&#xff1a;y
Customize user account for ambari-server daemon [y/n] (n)? y
3.ambari-server 账号。输入&#xff1a;ambari
Enter user account for ambari-server daemon (root):ambariAdjusting ambari-server permissions and ownership...
4.检查防火墙&#xff0c;如果关闭则不用操作
Checking firewall status...Redirecting to /bin/systemctl status iptables.service
5.设置JDK。输入&#xff1a;3
Checking JDK...Do you want to change Oracle JDK [y/n] (n)? y[] Oracle JDK 1.8 &#43; Java Cryptography Extension (JCE) Policy Files 8[] Oracle JDK 1.7 &#43; Java Cryptography Extension (JCE) Policy Files 7[] Custom JDK&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;Enter choice (1): 3
6.如果上面选择3自定义JDK,则需要设置JAVA_HOME。输入&#xff1a;/opt/java/jdk1.8.0_152
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: /opt/java/jdk1.8.0_152Validating JDK on Ambari Server...done.Completing setup...
7.数据库配置。选择&#xff1a;y
Configuring database...Enter advanced database configuration [y/n] (n)? y
8.选择数据库类型。输入&#xff1a;3
Configuring database...&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;Choose one of the following options:[1] - PostgreSQL (Embedded)[2] - Oracle[3] - MySQL[4] - PostgreSQL[5] - Microsoft SQL Server (Tech Preview)[6] - SQL Anywhere&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;Enter choice (3): 3
9.设置数据库的具体配置信息&#xff0c;根据实际情况输入&#xff0c;如果和括号内相同&#xff0c;则可以直接回车。
Hostname (localhost):Port (3306):Database name (ambari):Username (ambari):Enter Database Password (Ambari-123):
10.提示必须安装MySQL JDBC&#xff0c;回车结束ambari配置
WARNING: Before starting Ambari Server, you must copy the MySQL JDBC driver JAR file to /usr/share/java.Press
11.将Ambari数据库脚本导入到数据库
如果使用自己定义的数据库&#xff0c;必须在启动Ambari服务之前导入Ambari的sql脚本
#用Ambari用户&#xff08;上面设置的用户&#xff09;登录mysqlmysql -u ambari -puse ambari&#xff1b;source /var/lib/ambari-server/resources/Ambari-DDL-MySQL-CREATE.sql
4.1.3启动Amabri
执行启动命令&#xff0c;启动Ambari服务
[root&#64;SY-001 ~]# ambari-server start
成功启动后在浏览器输入Ambari地址&#xff1a;
http://192.168.31.1:8080/
出现登录界面&#xff0c;默认管理员账户登录&#xff0c; 账户&#xff1a;admin 密码&#xff1a;admin
以下图片用的别人的图片&#xff0c;版本较低&#xff0c;仅供参考
登录成功后出现下面的界面&#xff0c;至此Ambari的安装成功
4.2 安装安装HDP 2.6.3 配置集群
点击上面登录成功页面的Launch Install Wizard 按钮进行集群配置
4.2.1设置集群名称
4.2.2设置HDP 安装源
选择HDP2.6 ,并且设置Advanced Repository Options 的信息&#xff0c;本次使用本地源&#xff0c;所以修改对用系统的安装源为本地源地址。
4.2.3设置集群机器
4.2.4 Host 确认
确认前面配置集群中hosts列表 中的机器是否都可用&#xff0c;也可以移除相关机器&#xff0c;集群中机器Success后进行下一步操作。
4.2.5 选择要安装的服务
4.2.6各个服务Master配置
4.2.6 服务的Slaves 和 Clients节配置
4.2.7 服务的客制化配置
4.2.8 显示配置信息
4.2.9开始安装
安装各个服务&#xff0c;并且完成安装后会启动相关服务&#xff0c;安装过程比较长&#xff0c;如果中途出现错误&#xff0c;请根据具体提示或者log进行操作。
安装过程可以随时查看每个节点的安装进度及日志
全部安装成功界面如下
4.2.10安装完成
1、开启高可用开关
2、设置高可用名称&#xff08;如果hbase是启动的话请关闭在开启HA高可用&#xff09;
3、选择服务安装在那台主机上
4、按照提示操作&#xff0c;最后显示如下表示HA安装成功
5、Hbase高可用会显示如下图