1.安装环境说明
三台机器安装好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
[[email protected] ~]# vi /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.31.11 SY-001 SY-001.hadoop
192.168.31.12 SY-002 SY-002.hadoop
192.168.31.13 SY-003 SY-003.hadoop
2.操作系统环境准备
2.1 配置SSH免密码登录
主节点里root用户登录执行如下步骤
[[email protected] ~]# ssh-keygen
[[email protected] ~]# cd ~/.ssh/
[[email protected] ~]# cat id_rsa.pub >>authorized_keys
[[email protected] ~]# chmod 600 ~/.ssh
[[email protected] ~]# chmod 600 ~/.ssh/authorized_keys
先在从节点登录root执行命令
[[email protected] ~]# mkdir ~/.ssh/
[[email protected] ~]# mkdir ~/.ssh/
分发主节点里配置好的authorized_keys到各从节点
[[email protected] ~]# scp /root/.ssh/authorized_keys root@192.168.31.12:/root/.ssh/authorized_keys
[[email protected] ~]# scp /root/.ssh/authorized_keys root@192.168.31.13:/root/.ssh/authorized_keys
2.2 创建ambari系统用户和用户组
只在主节点操作
添加ambari安装、运行用户和用户组,也可以不创建新用户,直接使用root,我是直接用的root
[[email protected] ~]# adduser ambari
[[email protected] ~]# passwd ambari
2.3 开启NTP服务
所有节点都需要操作
[[email protected] ~]# yum install ntp
[[email protected] ~]# systemctl is-enabled ntpd
[[email protected] ~]# systemctl enable ntpd
[[email protected] ~]# systemctl start ntpd
2.4 检查DNS和NSCD
所有节点都要设置
ambari在安装时需要配置全域名,所以需要检查DNS。为了减轻DNS的负担, 建议在节点里用 Name Service Caching Daemon (NSCD)
[[email protected] ~]# vi /etc/hosts
192.168.131.11 SY-001 SY-001.hadoop
192.168.131.12 SY-002 SY-002.hadoop
192.168.131.13 SY-003 SY-003.hadoop
每台节点里配置FQDN,如下以主节点为例
[[email protected] ~]# vi /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=SY-001.hadoop
2.5 关闭防火墙
所有节点都要设置
[[email protected] ~]# systemctl disable firewalld
[[email protected] ~]# systemctl stop firewalld
2.6 关闭SELinux
所有节点都要设置
查看SELinux状态:
[[email protected] ~]# sestatus
SELinux status: enabled
[[email protected] ~]# sestatus
SELinux status: disabled
临时关闭,不用重启机器:
[[email protected] ~]# setenforce 0
修改配置文件需要重启机器:
[[email protected] ~]# vi /etc/sysconfig/selinux
SELINUX=disabled
3.制作本地源
制作本地源只需在主节点上进行即可
3.1 相关准备工作
3.1.1安装 Apache HTTP 服务器
安装HTTP 服务器,允许 http 服务通过防火墙(永久)
[[email protected] ~]# yum install httpd
[[email protected] ~]# firewall-cmd --add-service=http
[[email protected] ~]# firewall-cmd --permanent --add-service=http
添加 Apache 服务到系统层使其随系统自动启动
[[email protected] ~]# systemctl start httpd.service
[[email protected] ~]# systemctl enable httpd.service
3.1.2 安装本地源制作相关工具
[[email protected] ~]# 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 |
下载上面列表的中的压缩包,
需要下载的压缩包如下:
Ambari2.6.0
http://public-repo-1.hortonworks.com/ambari/centos7/2.x/updates/2.6.0.0/ambari-2.6.0.0-centos7.tar.gz
HDP2.6.3
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-UTILS1.1.0.21
在httpd网站根目录,默认是即/var/www/html/,创建目录ambari,
并且将下载的压缩包解压到/var/www/html/ambari目录
HDP-UTILS需要先建立一个HDP-UTILS文件夹并将HDP-UTILS-1.1.0.21-centos7.tar.gz放到HDP-UTILS目录下再解压
[[email protected] ~]# cd /var/www/html/
[[email protected] html]# mkdir ambari
[[email protected] html]# cd /var/www/html/ambari/
[[email protected] 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
[[email protected] 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
[[email protected] 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
[[email protected] ambari]# tar -zxvf ambari-2.6.0.0-centos7.tar.gz
[[email protected] ambari]# tar -zxvf HDP-2.6.3.0-centos7-rpm.tar.gz
[[email protected] ambari]# mkdir HDP-UTILS
[[email protected] ambari]# mv HDP-UTILS-1.1.0.21-centos7.tar.gz /var/www/html/ambari/HDP-UTILS/
[[email protected] 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
[[email protected] 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.0
baseurl=http://192.168.31.11/ambari/ambari/centos7/2.6.0.0-267
gpgcheck=1
gpgkey=http://192.168.31.11/ambari/ambari/centos7/2.6.0.0-267/RPM-GPG-KEY/RPM-GPG-KEY-Jenkins
enabled=1
priority=1
hdp.repo
[[email protected] 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.0
baseurl=http://192.168.31.11/ambari/HDP/centos7/2.6.3.0-235
gpgcheck=1
gpgkey=http://192.168.31.11/ambari/HDP/centos7/2.6.3.0-235/RPM-GPG-KEY/RPM-GPG-KEY-Jenkins
enabled=1
priority=1
[HDP-UTILS-1.1.0.21]
name=HDP Utils Version - HDP-UTILS-1.1.0.21
baseurl=http://192.168.31.11/ambari/HDP-UTILS
gpgcheck=1
gpgkey=http://192.168.31.11/ambari/HDP-UTILS/RPM-GPG-KEY/RPM-GPG-KEY-Jenkins
enabled=1
priority=1
将上面的修改过的源放到/etc/yum.repos.d/下面
[[email protected] yum.repos.d]# yum clean all
[[email protected] yum.repos.d]# yum list update
[[email protected] yum.repos.d]# yum makecache
[[email protected] yum.repos.d]# yum repolist
3.4 安装Mysql数据库
Ambari安装会将安装等信息写入数据库,建议使用MariaDB数据库,也可以不安装而使用默认数据库PostgreSQL
[[email protected] ~]# yum install mariadb-server
[[email protected] ~]# systemctl start mariadb
[[email protected] ~]# systemctl enable mariadb
#数据库初始化设置
[[email protected] ~]# mysql_secure_installation
#首先是设置密码,会提示先输入密码
Enter current password for root (enter for none):<–初次运行直接回车
#设置密码
Set root password? [Y/n] <– 是否设置root用户密码,输入y并回车或直接回车
New password: <– 设置root用户的密码
Re-enter new password: <– 再输入一次你设置的密码
#其他配置
Remove anonymous users? [Y/n] <– 是否删除匿名用户,回车
Disallow root login remotely? [Y/n] <–是否禁止root远程登录,回车,
Remove test database and access to it? [Y/n] <– 是否删除test数据库,回车
Reload privilege tables now? [Y/n] <– 是否重新加载权限表,回车
#初始化MariaDB完成,接下来测试登录,输入密码能正常登陆就完成了
[[email protected] ~]# mysql -uroot -p
安装完成后创建ambari数据库及用户,登录数据库root用户执行下面语句:
[[email protected] ~]# mysql -uroot -p
createdatabase ambari characterset utf8 ;
CREATEUSER‘ambari‘@‘%‘IDENTIFIED BY‘Ambari-123‘;
GRANTALLPRIVILEGESON *.* TO‘ambari‘@‘%‘;
FLUSH PRIVILEGES;
如果要安装Hive,再创建Hive数据库和用户再执行下面的语句:
createdatabase hive characterset utf8 ;
CREATEUSER‘hive‘@‘%‘IDENTIFIED BY‘Hive-123‘;
GRANTALLPRIVILEGESON *.* TO‘hive‘@‘%‘;
FLUSH PRIVILEGES;
如果要安装Oozie,再创建Oozie数据库和用户再执行下面的语句:
createdatabase oozie characterset utf8 ;
CREATEUSER‘oozie‘@‘%‘IDENTIFIED BY‘Oozie-123‘;
GRANTALLPRIVILEGESON *.* TO‘oozie‘@‘%‘;
FLUSH PRIVILEGES;
安装mysql jdbc 驱动
[[email protected] ~]# yum install mysql-connector-java
3.5 安装JDK
Java SE Development Kit 8u152下载地址:http://www.oracle.com/technetwork/cn/java/javase/downloads/jdk8-downloads-2133151-zhs.html
下载解压版jdk-8u152-linux-x64.tar.gz,再执行下面命令:
[[email protected] ~]# tar -zxvf jdk-8u152-linux-x64.tar.gz -C /opt/java/
[[email protected] ~]# vi /etc/profile
export JAVA_HOME=/opt/java/jdk1.8.0_152
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
PATH=$PATH:$HOME/bin:$JAVA_HOME/bin
source /etc/profile
4.进行安装Ambari
4.1 安装Ambari2.6.0
4.1.1安装Ambari
[[email protected] ~]# yum install ambari-server
4.1.2配置Ambari
[[email protected] ~]# ambari-server setup
下面是配置执行流程,按照提示操作
1.检查SELinux是否关闭,如果关闭不用操作
Using python /usr/bin/python
Setup ambari-server
Checking SELinux...
SELinux status is‘disabled‘
2.提示是否自定义设置。输入:y
Customize user account for ambari-server daemon [y/n] (n)? y
3.ambari-server 账号。输入:ambari
Enter user account for ambari-server daemon (root):ambari
Adjusting ambari-server permissions and ownership...
4.检查防火墙,如果关闭则不用操作
Checking firewall status...
Redirecting to /bin/systemctl status iptables.service
5.设置JDK。输入:3
Checking JDK...
Do you want to change Oracle JDK [y/n] (n)? y
[] Oracle JDK 1.8 + Java Cryptography Extension (JCE) Policy Files 8
[] Oracle JDK 1.7 + Java Cryptography Extension (JCE) Policy Files 7
[] Custom JDK
==============================================================================
Enter choice (1): 3
6.如果上面选择3自定义JDK,则需要设置JAVA_HOME。输入:/opt/java/jdk1.8.0_152
WARNING: JDK must be installed onall hosts and JAVA_HOME must be valid onall 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 onall hosts.
Path to JAVA_HOME: /opt/java/jdk1.8.0_152
Validating JDK on Ambari Server...done.
Completing setup...
7.数据库配置。选择:y
Configuringdatabase...
Enteradvanceddatabaseconfiguration[y/n] (n)? y
8.选择数据库类型。输入:3
Configuring database...
==============================================================================
Choose one of the following options:
[1] - PostgreSQL (Embedded)
[2] - Oracle
[3] - MySQL
[4] - PostgreSQL
[5] - Microsoft SQL Server (Tech Preview)
[6] - SQL Anywhere
==============================================================================
Enter choice (3): 3
9.设置数据库的具体配置信息,根据实际情况输入,如果和括号内相同,则可以直接回车。
Hostname (localhost):
Port (3306):
Database name (ambari):
Username (ambari):
Enter Database Password (Ambari-123):
10.提示必须安装MySQL JDBC,回车结束ambari配置
WARNING: Before starting Ambari Server, you must copy the MySQL JDBC driver JAR file to /usr/share/java.
Press <enter> to continue.
11.将Ambari数据库脚本导入到数据库
如果使用自己定义的数据库,必须在启动Ambari服务之前导入Ambari的sql脚本
#用Ambari用户(上面设置的用户)登录mysql
mysql -u ambari -p
use ambari;
source /var/lib/ambari-server/resources/Ambari-DDL-MySQL-CREATE.sql
4.1.3启动Amabri
执行启动命令,启动Ambari服务
[[email protected] ~]# ambari-server start
成功启动后在浏览器输入Ambari地址:
http://192.168.31.1:8080/
出现登录界面,默认管理员账户登录,账户:admin 密码:admin
以下图片用的别人的图片,版本较低,仅供参考
登录成功后出现下面的界面,至此Ambari的安装成功
4.2 安装安装HDP 2.6.3 配置集群
点击上面登录成功页面的Launch Install Wizard 按钮进行集群配置
4.2.1设置集群名称
4.2.2设置HDP 安装源
选择HDP2.6 ,并且设置Advanced Repository Options 的信息,本次使用本地源,所以修改对用系统的安装源为本地源地址。
4.2.3设置集群机器
4.2.4 Host 确认
确认前面配置集群中hosts列表中的机器是否都可用,也可以移除相关机器,集群中机器Success后进行下一步操作。
4.2.5 选择要安装的服务
4.2.6各个服务Master配置
4.2.6 服务的Slaves 和 Clients节配置
4.2.7 服务的客制化配置
4.2.8 显示配置信息
4.2.9开始安装
安装各个服务,并且完成安装后会启动相关服务,安装过程比较长,如果中途出现错误,请根据具体提示或者log进行操作。
安装过程可以随时查看每个节点的安装进度及日志
全部安装成功界面如下
4.2.10安装完成
5、Hadooop开启高可用(现在安装好Hadoop是不支高可用的,下面准备开启Hadoop高可用)
1、开启高可用开关
2、设置高可用名称(如果hbase是启动的话请关闭在开启HA高可用)
3、选择服务安装在那台主机上
4、按照提示操作,最后显示如下表示HA安装成功
5、Hbase高可用会显示如下图
参考资料:
http://blog.csdn.net/mawenwu1983/article/details/78983275
参考资料:
http://blog.csdn.net/mawenwu1983/article/details/78983275
原文地址:https://www.cnblogs.com/lingluo2017/p/8711073.html