centos7 安装java 8_CentOS7下利用Ambari搭建HDP大数据平台

点击上方"walkingcloud"关注,并选择"星标"公众号

更多技术干货,第一时间送达

66519d931a30042234911c380fe2bc35.png

Ambari介绍

Apache Ambari是一个基于Web的支持Apache Hadoop集群的供应、管理和监控的开源工具, Ambari已支持大多数Hadoop组件,包括HDFS、MapReduce、Hive、Pig、 Hbase、Zookeeper、Sqoop和Hcatalog等。提供Web UI进行可视化的集群管理,简化了大数据平台的安装、使用难度。

Ambari体系结构

Ambari 自身也是一个分布式架构的软件,主要由两部分组成:Ambari Server 和 Ambari Agent。

简单来说,用户通过Ambari Server通知 Ambari Agent 安装对应的软件;Agent 会定时地发送各个机器每个软件模块的状态给 Ambari Server,最终这些状态信息会呈现在 Ambari 的 GUI,方便用户了解到集群的各种状态,并进行相应的维护。Ambari Server 从整个集群上收集信息。每个主机上都有 Ambari Agent, Ambari Server 通过 Ambari Agent 控制每部主机。

下面介绍CentOS7系统下利用Ambari搭建HDP大数据平台

a09b72c6056dc70772b3b54c3ae90526.png

参考官方文档

https://docs.cloudera.com/HDPDocuments/Ambari-2.6.2.2/bk_ambari-installation/content/install-ambari-server-rhel7.html https://docs.cloudera.com/HDPDocuments/Ambari-2.6.2.2/bk_ambari-installation/content/hdp_26_repositories.html https://docs.cloudera.com/HDPDocuments/Ambari-2.6.2.2/bk_ambari-installation/content/ambari_repositories.html

bed7e9767bb1a088a53ddca88dd95dd6.png

一、准备条件

1、jdk安装包 jdk-8u261-linux-x64.tar.gz

2、提前下载好ambari,HDP,HDP-UTILS 本地仓库Tarball文件

http://public-repo-1.hortonworks.com/ambari/centos7/2.x/updates/2.6.2.2/ambari-2.6.2.2-centos7.tar.gzhttp://public-repo-1.hortonworks.com/HDP/centos7/2.x/updates/2.6.5.0/HDP-2.6.5.0-centos7-rpm.tar.gzhttp://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.22/repos/centos7/HDP-UTILS-1.1.0.22-centos7.tar.gz
400f7e9a1ef701a9247a3402052da9b3.png
8a74b70f0b538e66c3ef94128afa2d79.png

二、操作系统基础环境准备

先在ambari机器上配置JDK,准备基础环境

1)、关闭防火墙

systemctl disable firewalldsystemctl stop firewalld

2)、关闭SELINUX

sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/configsetenforce 0
aa523098aa45ec4cb731ab0747c8ee0d.png

3)、设置ulimit 文件打开数为10000

在/etc/profile最后一行添加ulimit -n 10000

4)、安装JDK,配置环境变量

cd /opttar -zxvf jdk-8u261-linux-x64.tar.gzmv jdk1.8.0_261 /usr/local/cd /usr/local/mv jdk1.8.0_261 jdk
#在/etc/profile中添加如下行vi /etc/profileexport JAVA_HOME=/usr/local/jdkexport CLASSPATH=.:$JAVA_HOME/libPATH=$PATH:$JAVA_HOME/bin

5)、source /etc/profile生效

最后检查java,ulimit值

437accd9f70e4866e104515c5fd10926.png

以上配置做好之后,可以poweroff关机做一个虚拟机快照,按这个虚拟机模板克隆4台机器 分别为bigdata1,bigdata2,bigdata3,bigdata4

c69804f91563f8e9856bb16316a47d43.png
49d8c7aa22cef2e90b86504126ad9bf4.png

三、主机名修改与免密钥登录配置

1)5台主机分别修改主机名

hostnamectl set-hostname ambarihostnamectl set-hostname bigdata1hostnamectl set-hostname bigdata2hostnamectl set-hostname bigdata3hostnamectl set-hostname bigdata4

2)配置ambari-server免密钥登录其他4台节点

ssh-keygen

3)配置主机域名解析

vi /etc/hosts添加如下行10.20.90.59 ambari10.20.90.60 bigdata110.20.90.61 bigdata210.20.90.62 bigdata310.20.90.63 bigdata4

4)拷贝公钥

ssh-copy-id root@bigdata1ssh-copy-id root@bigdata2ssh-copy-id root@bigdata3ssh-copy-id root@bigdata4ssh-copy-id root@ambari
4a5acb49d95a3ec3e6458391c7951568.png

5)主机域名解析文件拷贝到4台节点上

scp /etc/hosts root@bigdata1:/etcscp /etc/hosts root@bigdata2:/etcscp /etc/hosts root@bigdata3:/etcscp /etc/hosts root@bigdata4:/etc
fb790c6034b89a812380fbe43cb5a46b.png
9baa2257f6c434ef3d36dbd3405434bb.png

并验证可以正常免密登录

99fc98b561958e552dd2a62378485d0f.png

四、配置Ambari HDP以及HDP-UTILS 本地yum源

在ambari服务器上配置Ambari HDP以及HDP-UTILS 本地yum源

yum install -y httpdcd /optmkdir /var/www/html/ambarimkdir /var/www/html/hdptar -zxf ambari-2.6.2.2-centos7.tar.gz -C /var/www/html/ambari/tar -zxf HDP-2.6.5.0-centos7-rpm.tar.gz -C /var/www/html/hdp/tar -zxf HDP-UTILS-1.1.0.22-centos7.tar.gz -C /var/www/html/hdp/ systemctl start httpdsystemctl enable httpd

SFTP上传到/opt目录下

a7cd86de4367ff896bbb0f84607c63fe.png
f9530eb561b247280708f6c4c4cd0dd2.png
b1edc594d6915758e9594385a6ee9c3a.png

验证Ambari HDP以及HDP-UTILS 本地yum源均可以正常访问

http://10.20.90.59/ambari/ambari/centos7/2.6.2.2-1/http://10.20.90.59/hdp/HDP/centos7/2.6.5.0-292/http://10.20.90.59/hdp/HDP-UTILS/centos7/1.1.0.22/
106262afd39dcea7464662af0137804d.png
d70bc7635dafdc11d289f3625950d736.png
19de1de5aa3cb81e62820af8ce920040.png

针对下面这个错误的解决办法

8fbd5446c3edcd1b2abe36aec87cee10.png

删除或者移走html文件

9aec2813cdfe7a76c3afb1a030188738.png

配置ambari YUM源

cat >/etc/yum.repos.d/ambari.repo<

#配置hdp YUM源

cat >/etc/yum.repos.d/hdp.repo<
2f8c39bfe84fedeac13512f78deb3491.png
cat /etc/yum.repos.d/ambari.repocat /etc/yum.repos.d/hdp.repo

五、安装ambari-server

yum -y install ambari-server
60aa39035a17f6881588cad0da29b7e9.png

六、安装MariaDB数据库并配置数据库

1、安装MariaDB数据库

yum -y install mariadb-serversystemctl enable mariadb.servicesystemctl start mariadb.servicenetstat -anp | grep 3306
63cff18779238f4990835ea43dd6c276.png
0d850a88fa6fc7a44aa5647dcafa0911.png

2、设置数据库初始密码

mysqladmin -uroot password "ambari"

3、设置可以远程登录

mysql -uroot -pambarigrant all privileges on *.* to 'root'@'ambari' identified by 'ambari' with grant option;grant all privileges on *.* to 'root'@'10.20.90.59' identified by 'ambari' with grant option;flush privileges;systemctl restart mariadb.service

4、创建ambari数据库

mysql -uroot -pambari -hambari create database ambari DEFAULT CHARSET utf8;use ambarisource /var/lib/ambari-server/resources/Ambari-DDL-MySQL-CREATE.sql
36390c9a592e6c7bdc5539f57080413d.png

七、ambari-server初始化配置

[root@ambari home]# ambari-server setupUsing python  /usr/bin/pythonSetup ambari-serverChecking SELinux...SELinux status is 'disabled'Customize user account for ambari-server daemon [y/n] (n)? yEnter user account for ambari-server daemon (root):rootAdjusting ambari-server permissions and ownership...Checking firewall status...Checking JDK...[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): 3WARNING: 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/jdkValidating JDK on Ambari Server...done.Checking GPL software agreement...GPL License for LZO: https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.htmlEnable Ambari Server to download and install GPL Licensed LZO packages [y/n] (n)? nCompleting setup...Configuring database...Enter advanced database configuration [y/n] (n)? yConfiguring database...==============================================================================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): 3Hostname (localhost): Port (3306): Database name (ambari): Username (ambari): rootEnter Database Password (bigdata): ambariRe-enter password: Configuring ambari database...WARNING: Before starting Ambari Server, you must copy the MySQL JDBC driver JAR file to /usr/share/java and set property "server.jdbc.driver.path=[path/to/custom_jdbc_driver]" in ambari.properties.Press  to continue.Configuring remote database connection properties...WARNING: Before starting Ambari Server, you must run the following DDL against the database to create the schema: /var/lib/ambari-server/resources/Ambari-DDL-MySQL-CREATE.sqlProceed with configuring remote database connection properties [y/n] (y)? yExtracting system views.......ambari-admin-2.6.2.2.1.jar.......Adjusting ambari-server permissions and ownership...Ambari Server 'setup' completed successfully.

拷贝jdbc驱动包,并在ambari.properties配置文件中添加jdbc驱动的配置

mkdir /usr/share/javacp /home/mysql-connector-java-8.0.20.jar /usr/share/java/mysql-connector-java.jarvi /etc/ambari-server/conf/ambari.properties #追加一行server.jdbc.driver.path=/usr/share/java/mysql-connector-java.jar
177f8d98c4ec1846c209933d750b623a.png
ambari-server start
97f8d851257807f6d45a9917e1d3a25f.png

八、ambari web界面向导搭建集群

3b30228294e4d4a70df0c8f4302f51c0.png
de9f6dcad0fc334d586399064918a07f.png
fdb35276e09c7b4b997459b4d5be1397.png
9aefe5782bdb5501f48ae5c744f287b9.png
7c7f1a5437814fbdb2fe635b91f39196.png

注意:这里的URL最后面的/斜杠需要去掉,(图误)

8e9fcf44818b16e4eaf2b40acd3f0c3b.png
acba3faeb1e5890b084b85de4ea83b4e.png
1e167966576c24166d85d94ad4722a3f.png
182d9f4a7c3e9e6413fb88c267f1ee89.png
3d4d96d38bafca61f770d9d0c6df4e3d.png
de6f6df5cbf7cee81cc50f4c7562f387.png
4b36bcb59ea15140a9a3d06ba229dfbb.png
7a374ee877e482ef0abee342367adc62.png
78bf15cfef2cd98da19668374ac1331d.png
63060abca8bb209744aff22b6a084a6d.png
d2bdb65acacf17413ed9ac90d554edc0.png
de1a92217e901a379da43c5b60a35d44.png
262112985f17e76db5128fb100b904cf.png
66519d931a30042234911c380fe2bc35.png

九、排错

1、Confirm Hosts时出现安装ambari-agent的报错的解决方法

修改 /etc/ambari-agent/conf/ambari-agent.ini 文件,在 [security] 配置部分添加[security]...force_https_protocol=PROTOCOL_TLSv1_2

2、yum.conf配置文件修改

vi /etc/yum.conf installonly_limit=5改为installonly_limit=600
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值