这篇文章将为大家详细讲解有关HDP-2.6.5和ambari-2.6.2如何安装配置,小编觉得挺实用的,因此分享给大家做个参考,希望大家阅读完这篇文章后可以有所收获。
专注于为中小企业提供网站制作、成都网站设计服务,电脑端+手机端+微信端的三站合一,更高效的管理,为中小企业北塔免费做网站提供优质的服务。我们立足成都,凝聚了一批互联网行业人才,有力地推动了超过千家企业的稳健成长,帮助中小企业通过网站建设实现规模扩充和转变。
* ambari-2.6.2.2-centos7.tar.gz * HDP-2.6.5.0-centos7-rpm.tar.gz * HDP-GPL-2.6.5.0-centos7-gpl.tar.gz * HDP-UTILS-1.1.0.22-centos7.tar.gz * jdk-8u162-linux-x64.tar.gz * apache-tomcat-8.5.27.tar.gz * MySQL-connector-java-5.1.46.tar.gz 自行至 https://hortonworks.com 下载
System: CentOS 7.x JDK: JDK-1.8.xxx Tomcat: Tomcat-8.5.27 (或者使用 Nginx、Httpd) MariaDB: MariaDB-5.5.60
Ambari-Server: 10.0.2.20 Ambari-Agent01: 10.0.2.21 Ambari-Agent02: 10.0.2.22 cat >>/etc/hosts<环境准备
# 关闭firewalld (防火墙) systemctl stop firewalld.service systemctl disabled firewalld.servicentpd时间同步服务配置
# 所有节点 cat >>/etc/ntp.conf<配置免密登陆
[root@Ambari-Server ~]$ ssh-keygen # 一路回车至结束 [root@Ambari-Server .ssh]$ ssh-copy-id 10.0.2.20 [root@Ambari-Server .ssh]$ for n in 21 22;do scp authorized_keys id_rsa id_rsa.pub 10.0.2.$n:/root/.ssh/;done # 为去除‘yes'输入,执行下面的命令 [root@Ambari-Server ~]$ for n in Ambari-Server Ambari-Agent01 Ambari-Agent02 server.ambari.com agent01.ambari.com agent02.ambari.com;do ssh $n "uptime";done解决依赖
# 所有节点 /usr/bin/yum install zlib zlib-devel libjpeg libjpeg-devel libpng libpng-devel gd gd-devel curl curl-devel freetype freetype-devel libxslt libxslt-devel libxml2 libxml2-devel ncurses ncurses-devel gcc gcc-c++ flex flex-devel libtiff-devel pam-devel libffi-devel e2fsprogs-devel openssl* ntpdate tree autoconf lrzsz uuid dstat bind-utils vim rsync net-tools wget -y # 必须安装 /usr/bin/yum install python-setuptools python-devel -y tar xf pip-18.1.tar.gz cd pip-18.1 python setup.py python setup.py build python setup.py install # 安装python依赖psutil pip install psutil 依赖问题根据自己服务器情况自行安装,上述依赖是我的服务器基础优化安装的依赖包配置JAVA环境
# 所有节点 tar xf jdk-8u162-linux-x64.tar.gz -C /opt/ cd /opt;ln -s jdk1.8.0_162 jdk;cd cat >>/etc/profile<同步hosts文件
[root@Ambari-Server ~]$ for n in 21 22;do scp /etc/hosts 10.0.2.$n:/etc/;done安装MariaDB
[root@Ambari-Server ~]$ useradd mysql -M -s /sbin/nologin [root@Ambari-Server ~]$ yum install mariadb-server mariadb -y [root@Ambari-Server ~]$ sed -i '3a\skip-name-resolve=on\ncharacter-set-server=utf8' /etc/my.cnf [root@Ambari-Server ~]$ systemctl start mariadb.service [root@Ambari-Server ~]$ mysqladmin -uroot password 123456 [root@Ambari-Server yum.repos.d]$ mysql -uroot -p123456 -e "create database ambari;" [root@Ambari-Server yum.repos.d]$ mysql -uroot -p123456 -e "grant all privileges on ambari.* to ambari@'localhost' identified by '123456';" [root@Ambari-Server yum.repos.d]$ mysql -uroot -p123456 -e "grant all privileges on ambari.* to ambari@'10.0.2.20' identified by '123456';" [root@Ambari-Server yum.repos.d]$ mysql -uroot -p123456 -e "flush privileges;"安装Tomcat
[root@Ambari-Server ~]$ tar xf apache-tomcat-8.5.27.tar.gz -C /opt/ [root@Ambari-Server data]$ cd /opt/;ln -s apache-tomcat-8.5.27 tomcat;cd [root@Ambari-Server ~]$ tar xf mysql-connector-java-5.1.46.tar.gz [root@Ambari-Server ~]$ mv mysql-connector-java-5.1.46/mysql-connector-java-5.1.46-bin.jar /opt/tomcat/lib/ [root@Ambari-Server ~]$ mkdir /usr/share/java [root@Ambari-Server ~]$ mv mysql-connector-java-5.1.46/mysql-connector-java-5.1.46.jar /usr/share/java/配置Ambari、HDP本地yum库
[root@Ambari-Server hdp]$ rm -fr /opt/tomcat/webapps/* [root@Ambari-Server hdp]$ mkdir /opt/tomcat/webapps/hdp -p [root@Ambari-Server conf]$ tar xf ambari-2.6.2.2-centos7.tar.gz -C /opt/tomcat/webapps/hdp [root@Ambari-Server conf]$ tar xf ambari-2.6.2.2-centos7.tar.gz -C /opt/tomcat/webapps/hdp [root@Ambari-Server conf]$ tar xf HDP-GPL-2.6.5.0-centos7-gpl.tar.gz -C /opt/tomcat/webapps/hdp [root@Ambari-Server conf]$ tar xf HDP-UTILS-1.1.0.22-centos7.tar.gz -C /opt/tomcat/webapps/hdp [root@Ambari-Server conf]$ tar xf HDP-2.6.5.0-centos7-rpm.tar.gz -C /opt/tomcat/webapps/hdp [root@Ambari-Server conf]$ sed -i '112ctrue ' /opt/tomcat/conf/web.xml [root@Ambari-Server bin]$ /opt/tomcat/bin/startup.sh # 官方repo文件位置 [root@Ambari-Server 2.6.2.2-1]$ ll /opt/tomcat/webapps/hdp/ambari/centos7/2.6.2.2-1/ambari.repo -rw-r--r-- 1 root root 304 6月 12 2018 /opt/tomcat/webapps/hdp/ambari/centos7/2.6.2.2-1/ambari.repo [root@Ambari-Server 2.6.5.0-292]$ ll /opt/tomcat/webapps/hdp/HDP/centos7/2.6.5.0-292/hdp.repo -rw-r--r-- 1 root root 575 5月 15 2018 /opt/tomcat/webapps/hdp/HDP/centos7/2.6.5.0-292/hdp.repo [root@Ambari-Server 2.6.5.0-292]$ ll /opt/tomcat/webapps/hdp/HDP-GPL/centos7/2.6.5.0-292/hdp-gpl.gpl.repo -rw-r--r-- 1 root root 310 5月 15 2018 /opt/tomcat/webapps/hdp/HDP-GPL/centos7/2.6.5.0-292/hdp-gpl.gpl.repo [root@Ambari-Server 1.1.0.22]$ ll /opt/tomcat/webapps/hdp/HDP-UTILS/centos7/1.1.0.22/hdp-utils.repo -rw-r--r-- 1 root root 197 5月 29 2018 /opt/tomcat/webapps/hdp/HDP-UTILS/centos7/1.1.0.22/hdp-utils.repo # 参照官方repo文件,创建本地ambari.repo文件 [root@Ambari-Server yum.repos.d]$ cat >/etc/yum.repos.d/ambari.repo<安装配置Ambari-Server
[root@Ambari-Server ~]$ yum install ambari-server -y # 设置Ambari [root@Ambari-Server ~]$ ambari-server setup Using python /usr/bin/python Setup ambari-server Checking SELinux... SELinux status is 'disabled' Customize user account for ambari-server daemon [y/n] (n)? y Enter user account for ambari-server daemon (root): Adjusting ambari-server permissions and ownership... Checking firewall status... 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 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/jdk Validating JDK on Ambari Server...done. Checking GPL software agreement... Completing setup... Configuring database... Enter advanced database configuration [y/n] (n)? y Configuring 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 (3): 3 Hostname (localhost): Port (3306): Database name (ambari): Username (ambari): Enter Database Password (123456): Configuring ambari database... 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.sql Proceed with configuring remote database connection properties [y/n] (y)? Extracting system views... ambari-admin-2.6.2.2.1.jar ........... Adjusting ambari-server permissions and ownership... Ambari Server 'setup' completed successfully. # 根据设置过程中的提示执行SQL [root@Ambari-Server ~]$ mysql -uroot -p123456 -e "use ambari;source /var/lib/ambari-server/resources/Ambari-DDL-MySQL-CREATE.sql;" # 配置mysql-java连接器(驱动jar包) [root@Ambari-Server ~]$ echo "server.jdbc.driver.path=/opt/tomcat/lib/mysql-connector-java-5.1.46-bin.jar" >>/etc/ambari-server/conf/ambari.properties # 配置ambari启动端口,默认是8080与yum源tomcat服务默认端口冲突 [root@Ambari-Server ambari-server]$ echo "client.api.port=9999" >>/etc/ambari-server/conf/ambari.properties [root@Ambari-Server ~]$ mysql -uroot -p123456 -e "show tables from ambari;" # 启动Ambari-server,因为systemctl没有启动信息输出,不使用systemctl启动 [root@Ambari-Server ambari-server]$ /etc/init.d/ambari-server start Using python /usr/bin/python Starting ambari-server Ambari Server running with administrator privileges. Organizing resource files at /var/lib/ambari-server/resources... Ambari database consistency check started... Server PID at: /var/run/ambari-server/ambari-server.pid Server out at: /var/log/ambari-server/ambari-server.out Server log at: /var/log/ambari-server/ambari-server.log Waiting for server start.............................................. Server started listening on 9999 DB configs consistency check: no errors and warnings were found. Ambari Server 'start' completed successfully.安装配置Ambari-agent
#agent可以不安装,通过页面配置时安装,通过页面安装注册agent主机时会报通过SSL进行HTTPS连接错误。具体错误下面会有说明 [root@Ambari-Server ~]$ for n in 20 21 22;do ssh 10.0.2.$n "yum install ambari-agent -y";done [root@Ambari-Server conf]$ sed -i "s#hostname=localhost#hostname=Ambari-Server#" /etc/ambari-agent/conf/ambari-agent.ini # 强制指定安全协议,为防止报错 报错信息: ERROR 2018-12-14 14:41:11,462 NetUtil.py:96 - EOF occurred in violation of protocol (_ssl.c:618) ERROR 2018-12-14 14:41:11,462 NetUtil.py:97 - SSLError: Failed to connect. Please check openssl library versions. [root@Ambari-Server conf]$ sed -i '/\[security\]/a\force_https_protocol=PROTOCOL_TLSv1_2' /etc/ambari-agent/conf/ambari-agent.ini # 同步配置文件至所有节点 [root@Ambari-Server conf]$ for n in 21 22;do scp /etc/ambari-agent/conf/ambari-agent.ini 10.0.2.$n:/etc/ambari-agent/conf/;done # 启动所有节点Agent [root@Ambari-Server conf]$ for n in 20 21 22;do ssh 10.0.2.$n "/etc/init.d/ambari-agent start";done页面配置Ambari****
默认登陆权限:admin admin # 配置集群名配置安装的HDP版本及本地HDP yum源
这一步会报SSL HTTPS连接错误。在ambari-agent的安装步骤中已解决此问题;下图出现的警告根据实际情况处理,也可以忽略
根据情况选择安装需要使用的应用
选择应用安装部署布局。红框中是本测试环境的布局、分布概况。Ambari本身相当应用全部放在ambari-server服务器上运行
集群salve与client的安装分布
集群各应用配置
Review
安装、启动并测试
默认配置不需要修改,一直下一步直至完成安装、配置开启 RM-HA(ResourceManager-High-Available)
不开启也可以。为保证集群高可用性,通常都会开启在 service 下拉菜单中选中 YARN 集群服务
在 service actions 下拉按钮组中选择 Enable ResourceManager HA
下一步之后,选择resourcemanager部署节点
默认配置,不需要修改,直接下一步,直至安装、配置自动完成即可配置完成后结果
开启NameNode-HA
在页面配置,很简单,根据页面提示操作就可以。不再配图完成
如果安装ambari-metrics,安装、配置完成以后 ambari-metrics 启动不了,日志报错如下: from metric_collector import MetricsCollector File "/usr/lib/python2.6/site-packages/resource_monitoring/core/metric_collector.py", line 23, infrom host_info import HostInfo File "/usr/lib/python2.6/site-packages/resource_monitoring/core/host_info.py", line 22, in import psutil File "/usr/lib/python2.6/site-packages/resource_monitoring/psutil/build/lib.linux-x86_64-2.6/psutil/__init__.py", line 89, in import psutil._pslinux as _psplatform File "/usr/lib/python2.6/site-packages/resource_monitoring/psutil/build/lib.linux-x86_64-2.6/psutil/_pslinux.py", line 20, in from psutil import _common ImportError: cannot import name _common 先写解决方法: cd /usr/lib/python2.6/site-packages/resource_monitoring/psutil python setup.py build # 如果报gcc编译错误,请自行安装、升级gcc\gcc-c++ python setup.py install 问题原因: Ambari安装过程会安装一个目录 /usr/lib/python2.6 ,因为系统是CentOS 7.3,默认使用的是 python 2.7.5,不应该有 python2.6的依赖的。 查看系统python命令,下图红框中的命令是ambari生成的 ll /usr/bin/|grep python 查看命令:
[root@ambari-server psutil]$ cat /usr/bin/python-wrap #!/usr/bin/env bash # Copyright (c) 2011-2017, Hortonworks Inc. All rights reserved. # Except as expressly permitted in a written agreement between you # or your company and Hortonworks, Inc, any use, reproduction, # modification, redistribution, sharing, lending or other exploitation # of all or any part of the contents of this file is strictly prohibited. PY_PACKAGES_DIR=site-packages OS_DIST=`cat /etc/issue 2>/dev/null` if [[ $OS_DIST == *Ubuntu* ]] || [[ $OS_DIST == *Debian* ]] ; then PY_PACKAGES_DIR=dist-packages fi export PYTHONPATH=/usr/lib/python2.6/$PY_PACKAGES_DIR:$PYTHONPATH # reset settings unset PYTHON # checking for preferable python versions if [ -a /usr/bin/python2.7 ] && [ -z "$PYTHON" ]; then PYTHON=/usr/bin/python2.7 fi if [ -a /usr/bin/python2.6 ] && [ -z "$PYTHON" ]; then PYTHON=/usr/bin/python2.6 fi # if no preferable python versions found, try to use system one if [[ -z "$PYTHON" ]]; then PYTHON=/usr/bin/python fi # execute script $PYTHON "$@" 从这个命令脚本中可心看出 ambari 使用的还是 python2.7 只是重新设置了 PYTHONPATH 依赖库,依赖库中是有psutil这个module的,但只是安装目录。启动 ambari-metrics 的报错日志中会有一条命令(我这里没有记录下来),大致意思是“命令执行中没有发现 psutil build 目录”,那么,按照通用python包安装命令执行: python setup.py build python setup.py install 至此,问题解决,启动 ambari-collecator ,已经可以起来了。关于“HDP-2.6.5和ambari-2.6.2如何安装配置”这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,使各位可以学到更多知识,如果觉得文章不错,请把它分享出去让更多的人看到。
当前标题:HDP-2.6.5和ambari-2.6.2如何安装配置
文章链接:http://bzwzjz.com/article/gicjei.html