# vim /etc/hostname
hdp-01
# vim /etc/hosts
192.168.3.100 hdp01.xxxx.com hdp-01
192.168.3.110 hdp02.xxxx.com hdp-02
192.168.3.120 hdp03.xxxx.com hdp-03
192.168.3.130 hdp04.xxxx.com hdp-04
注:第一列为主机的IP,第二列为主机的FQDN域名,作用于主机名类似(配置HDP组件的时候需要),第三列为主机名。修改完以后,重启每一台机器。
# vi /etc/sysconfig/selinux
selinux=disabled
# systemctl stop firewalld
# systemctl disable firewalld
# ssh-keygen -t rsa
# scp ~/.ssh/id_rsa.pub hdp-01:/root/.ssh/authorized_keys
# scp ~/.ssh/id_rsa.pub hdp-02:/root/.ssh/authorized_keys
# scp ~/.ssh/id_rsa.pub hdp-03:/root/.ssh/authorized_keys
# scp ~/.ssh/id_rsa.pub hdp-01:/root/.ssh/authorized_keys
# ssh hdp-02
如果无需输入密码,且用hostname命令查看到正确的主机名,则表示配置免密码登录成功;
# yum install -y ntp //安装ntp服务
# systemctl enable ntpd //设置服务开机启动
# systemctl start ntpd //启动服务
# cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
# ntpdate us.pool.ntp.org
# vi /etc/ntp.conf
# systemctl restart ntpd //重启服务
# systemctl status ntpd //查看ntp是否成功
# ntpstat
# mkdir -p /usr/java/
上传jdk到目录/usr/java/
# tar -xzvf jdk-8u121-linux-x64.tar.gz
# vim /etc/profile
JAVA_HOME=/usr/java/jdk1.8.0_121
CLASSPATH=$JAVA_HOME/lib/
PATH=$PATH:$JAVA_HOME/bin
export PATH JAVA_HOME CLASSPATH
# source /etc/profile
# java -version
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)
下载mysql的repo源(CentOS 7.2的yum源中默认没有mysql,要先下载mysql的repo源)
# yum install -y wget
# wget http://repo.mysql.com/mysql57-community-release-el7-8.noarch.rpm
安装mysql57-community-release-el7-8.noarch.rpm包
# rpm -ivh mysql57-community-release-el7-8.noarch.rpm --nodeps --force
安装这个包后,会获得两个mysql的yum repo源
# ll /etc/yum.repos.d
mysql-community.repo
mysql-community-source.repo
安装mysql
# yum install -y mysql-server //安装
# systemctl start mysqld // 启动
# systemctl enable mysqld // 开机自启
# service mysqld status // 运行状态
# grep 'temporary password' /var/log/mysqld.log
# mysql -u root -p
mysql> Enter password: (输入刚才查询到的随机密码)
mysql> set global validate_password_policy=0;
mysql> set global validate_password_length=4;
# 重置用户密码
mysql> alter user 'root'@'localhost' identified by 'xxxxxxx';
# 允许使用用户名root密码XXXXXXX从任何主机连接到mysql服务器
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'xxxxx' WITH GRANT OPTION;
完成后,保存退出:
mysql> flush privileges;
mysql> quit;
# yum install -y mysql-connector-java
# mysql -u root -p
mysql> create database ambari character set utf8;
mysql> CREATE USER 'ambari'@'%' IDENTIFIED BY 'ambari';
mysql> GRANT ALL PRIVILEGES ON *.* TO 'ambari'@'%';
mysql> FLUSH PRIVILEGES;
如果要安装Hive,再创建Hive,ranger和oozie数据库和用户 再执行下面的语句:
mysql> create database hive character set utf8;
mysql> CREATE USER 'hive'@'%' IDENTIFIED BY 'hive';
mysql> GRANT ALL PRIVILEGES ON *.* TO 'hive'@'%';
mysql> FLUSH PRIVILEGES;
mysql> create database oozie character set utf8;
mysql> CREATE USER 'oozie'@'%' IDENTIFIED BY 'oozie';
mysql> GRANT ALL PRIVILEGES ON *.* TO 'oozie'@'%';
mysql> FLUSH PRIVILEGES;
mysql> create database ranger character set utf8;
mysql> CREATE USER 'ranger'@'%' IDENTIFIED BY 'ranger';
mysql> GRANT ALL PRIVILEGES ON *.* TO 'ranger'@'%';
mysql> FLUSH PRIVILEGES;
下载HortWorks官网上的3个库到本地(也可以在线下载,但是速度会很慢)。
我们先把hortworks官网上需要下载的3个库下载到本地(这个还是需要很长时间的,当然你也可以在线下载,通过wget但是由于文件比较大,所以下载会非常慢)然后把他上传到我们的镜像服务器上。
Ambari以及HDP文档地址:
https://www.cnblogs.com/zhang-ke/p/8944240.html
2)把下载到的3个资源文件,上传到ambari.server,并解压到制定目录
# mkdir /var/www/html/ambari-hdp
# mkdir /var/www/html/ambari-hdp/HDP-UTILS
# tar -xvf ambari-2.6.0.0-centos7.tar.gz -C /var/www/html/ambari-hdp/
# tar -xvf HDP-2.6.3.0-centos7-rpm.tar.gz -C /var/www/html/ambari-hdp/
# tar -xvf HDP-UTILS-1.1.0.21-centos7.tar.gz -C /var/www/html/ambari-hdp/HDP-UTILS
3)在ambari.server(hdp-01)上配置httpd服务:
# yum install -y httpd
# systemctl start httpd
# systemctl enable httpd.service
# yum install -y yum-plugin-priorities
cd /var/www/html/ambari-hdp/ambari/centos7/2.6.0.0-267/
修改baseurl和gpgkey的地址(http://ecs-hbase-01/ambari-hdp/上面复制下来)
# vim ambari.repo
#VERSION_NUMBER=2.6.0.0-267
[ambari-2.6.0.0]
name=ambari Version - ambari-2.6.0.0
baseurl=http://hdp-01/ambari-hdp/ambari/centos7/2.6.0.0-267/
gpgcheck=1
gpgkey=http://hdp-01/ambari-hdp/ambari/centos7/2.6.0.0-267/RPM-GPG-KEY/RPM-GPG-KEY-Jenkins
enabled=1
priority=1
保存后ambari.repo文件 复制cp ambari.repo /etc/yum.repos.d/
# cp ambari.repo /etc/yum.repos.d/
# cd /var/www/html/ambari-hdp/HDP/centos7/2.6.3.0-235/
# vim hdp.repo
#VERSION_NUMBER=2.6.3.0-235
[HDP-2.6.3.0]
name=HDP Version - HDP-2.6.3.0
baseurl=http://hdp-01/ambari-hdp/HDP/centos7/2.6.3.0-235/
gpgcheck=1
gpgkey=http://hdp-01/ambari-hdp/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://hdp-01/ambari-hdp/HDP-UTILS/
gpgcheck=1
gpgkey=http://hdp-01/ambari-hdp/HDP-UTILS/RPM-GPG-KEY/RPM-GPG-KEY-Jenkins
enabled=1
priority=1
保存后,复制
# cp hdp.repo /etc/yum.repos.d/
# cd /etc/yum.repos.d/
# scp ambari.repo hdp.repo root@hdp-02:/etc/yum.repos.d/
# scp ambari.repo hdp.repo root@hdp-03:/etc/yum.repos.d/
# scp ambari.repo hdp.repo root@hdp-04:/etc/yum.repos.d/
# yum clean all
# yum makecache
# yum repolist
# yum install -y ambari-server
# mysql -uroot -p
mysql> use ambari;
mysql> source /var/lib/ambari-server/resources/Ambari-DDL-MySQL-CREATE.sql;
# ambari-server setup
Customize user account for ambari-server daemon [y/n] (n)? y
Enter user account for ambari-server daemon (root): root
Adjusting ambari-server permissions and ownership...
// 设置JDK 输入:3
Checking JDK...Do you want to change Oracle JDK [y/n] (n)? y
[1] Oracle JDK 1.8 + Java Cryptography Extension (JCE) Policy Files 8
[2] Oracle JDK 1.7 + Java Cryptography Extension (JCE) Policy Files 7
[3] Custom JDK
==========================================
Enter choice (1): 3
// 如果上面选择3自定义JDK,则需要设置JAVA_HOME。输入
/usr/java/jdk1.8.0_121
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: /usr/local/jdk/jdk1.8.0_131
Validating JDK on Ambari Server...done.
Completing setup...
//数据库配置。选择:y
Configuring database...Enter advanced database configuration [y/n] (n)? y
//选择数据库类型。输入: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 (1): 3
// 设置数据库的具体配置信息,根据实际情况输入,如果和括号内相同,则可以直接回车
Hostname (localhost): hdp-01
Port (3306):
Database name (ambari):
Username (ambari):
Enter Database Password (bigDate):
//提示必须安装MySQL JDBC,已安装则直接通过
WARNING: Before starting Ambari Server, you must copy the MySQL JDBC driver JAR file to /usr/share/java.
Press <enter> to continue.
# ambari-server setup --jdbc-db=mysql --jdbc-driver=/usr/share/java/mysql-connector-java.jar
# ambari-server start
//设置开机自启
# chkconfig --add ambari-server
# yum install -y ambari-agent
//设置开机自启
# chkconfig --add ambari-agent
1)在浏览器里第一次输入http://hdp-01:8080/#/login
会出现登录界面,默认管理员账户登录, 账户:admin 密码:admin
2)安装向导: 登录成功后出现下面的界面:
3)设置集群名称:给你的集群命名,点击下一步
4)选择版本:这一步选择软件版本和安装源。版本选择HDP2.6
OS Name Base URL
Redhat7 HDP-2.6 http://hdp-01/ambari-hdp/HDP/centos7/2.6.3.0-235/
Redhat7 HDP-UTILS-1.1.0.21 http://hdp-01/ambari-hdp/HDP-UTILS/
5)设置集群机器
hdp01.xxxx.com
hdp02.xxxx.com
hdp03.xxxx.com
hdp04.xxxx.com
1、 ambari-server主机与agent节点不能使用密钥文件登录,即无法联通。手动检查是否可以无密码在远程机器上执行命令/
2、yum安装时失败,到/etc/yum.repos.d/ 目录下检查,有没有ambari.repo仓库文件。尝试用yum clean all清除过期的缓存,再次尝试安装
3、此前安装过Ambari等相关的功能,没有清理干净,又重新安装的,检查一下残留文件,删除重试
4、因为python 2.7.5有的版本(或更高版本)增加了certificate verification,正是因为这个特性导致ambari-agent无法连接server
# vim /etc/python/cert-verification.cfg
[https]verify=disable 修改为verify=disable
vim /etc/ambari-agent/conf/ambari-agent.ini
[security]
ssl_verify_cert=0
force_https_protocol=PROTOCOL_TLSv1_2
# ambari-agent restart
# python /usr/lib/python2.6/site-packages/ambari_agent/HostCleanup.py --silent --skip=users
7)选择安装服务
9)节点客户端分配
10)自定义配置
11)显示配置信息
12)安装,启动和测试
tail -200f /var/log/ambari-server/ambari-server.log