手把手教你通过Ambari新建Hadoop集群图解案例

时间:2021-01-17 14:31:45

                手把手教你通过Ambari新建Hadoop集群图解案例

                                              作者:尹正杰

版权声明:原创作品,谢绝转载!否则将追究法律责任。

  登陆系统之后,会看到Ambari空空如也的欢迎界面,接下来我们就需要介绍如何通过Ambari新建Hadoop集群。关于如何部署Ambari是很简单的,我这里就不啰嗦了,感兴趣的小伙伴可以参考我之前的笔记:离线方式部署Ambari2.6.0.0

1>.登陆Ambari的界面

手把手教你通过Ambari新建Hadoop集群图解案例

2>.点击“Launc Install Wizard”按钮进入新建集群向导

手把手教你通过Ambari新建Hadoop集群图解案例

3>.自定义集群名称

手把手教你通过Ambari新建Hadoop集群图解案例

4>.使用本地的yum仓库(需要选择“Use Local Repository”,我这里默认就使用的这个选项。) 手把手教你通过Ambari新建Hadoop集群图解案例

5>.在redhat7按照上图输入本地源的路径后,点击下一步

手把手教你通过Ambari新建Hadoop集群图解案例

6>.将私钥上传到Ambari到管理控制台上(这个步骤应该是你在部署Ambari服务到时候就已经生成过私钥啦!)

手把手教你通过Ambari新建Hadoop集群图解案例

7>.注册服务器时拍错处理(附有解决问题的详细过程)

    下图正在安装软件:

手把手教你通过Ambari新建Hadoop集群图解案例

  注册服务器,如下图:

手把手教你通过Ambari新建Hadoop集群图解案例

  在上面的那个过程如果你卡顿的时间比较长的话,估计会失败,如下图:

手把手教你通过Ambari新建Hadoop集群图解案例

  查看错误日志,如下图:

手把手教你通过Ambari新建Hadoop集群图解案例

  根据上面的报错信息,大家都知道是没有这个目录,才会报这个错误。可能是Ambari公司的开发人员在对这个目录进行判断时逻辑出现问题了,如果这个目录不存在他们并没有自动创建,

解决方案:  

  因此我们需要登陆对应的服务器手动将这个目录创建出来即可。

  我们看报错一定要看全,我们需要把进度条往下拉,看是否还有其他的报错,你会发现有以下报错:

手把手教你通过Ambari新建Hadoop集群图解案例

  如上图所示,报错“SSLError: Failed to connect. Please check openssl library versions. ”,根据报错提示,说是我的openssl的版本有问题。百度一下原因,说有可能是openssl版本不匹配,因为python 2.7.5有的版本(或更高版本)增加了certificate verification,正是因为这个特性导致ambari-agent无法连接server。(呵呵~是不是感觉跟没说一样!)

解决步骤

  既然他说我的版本有问题,那我就先看卡自己的openssl到底是啥版本

[root@node101 ~]# rpm -qa | grep openssl
openssl-libs-1.0.2k-.el7.x86_64
openssl-1.0.2k-.el7.x86_64
[root@node101 ~]#

  好,接下里,咱们就说干就干,开始升级版本:

[root@node101 ~]# yum update openssl            
Loaded plugins: fastestmirror, priorities
ambari-2.6.0.0 | 2.9 kB ::
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.tuna.tsinghua.edu.cn
* updates: mirrors.tuna.tsinghua.edu.cn
packages excluded due to repository priority protections
No packages marked for update
[root@node101 ~]#

  根据上面的提示,说没有可以更新的安装包对于我服务器而言,因此我得像个方法,让他可以支持更新,那就得重新更换yum源了。

[root@node101 ~]# mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.`date +%F`         #先备份一份yum源
[root@node101 ~]#
[root@node101 ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
---- ::-- http://mirrors.aliyun.com/repo/Centos-7.repo
Resolving mirrors.aliyun.com (mirrors.aliyun.com)... 42.81.12.221, 42.81.12.217, 42.81.12.218, ...
Connecting to mirrors.aliyun.com (mirrors.aliyun.com)|42.81.12.221|:... connected.
HTTP request sent, awaiting response... OK
Length: (.5K) [application/octet-stream]
Saving to: ‘/etc/yum.repos.d/CentOS-Base.repo’ %[===========================================================================>] , --.-K/s in .001s -- :: (2.68 MB/s) - ‘/etc/yum.repos.d/CentOS-Base.repo’ saved [/] [root@node101 ~]#

[root@node101 ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo            #下载阿里的yum源,别忘记提前备份一份哟!

[root@node101 ~]# yum clean all
Loaded plugins: fastestmirror, priorities
Cleaning repos: HDP-2.6.3.0 HDP-UTILS-1.1.0.21 ambari-2.6.0.0 base extras updates
Cleaning up list of fastest mirrors
[root@node101 ~]#

[root@node101 ~]# yum clean all                                                        #清除缓存

[root@node101 ~]# yum makecache
Loaded plugins: fastestmirror, priorities
HDP-2.6.3.0 | 2.9 kB ::
HDP-UTILS-1.1.0.21 | 2.9 kB ::
ambari-2.6.0.0 | 2.9 kB ::
base | 3.6 kB ::
extras | 3.4 kB ::
updates | 3.4 kB ::
(/): HDP-2.6.3.0/filelists_db | kB ::
(/): HDP-2.6.3.0/primary_db | kB ::
(/): HDP-2.6.3.0/other_db | kB ::
(/): HDP-UTILS-1.1.0.21/filelists_db | kB ::
(/): HDP-UTILS-1.1.0.21/other_db | kB ::
(/): HDP-UTILS-1.1.0.21/primary_db | kB ::
(/): ambari-2.6.0.0/filelists_db | kB ::
(/): ambari-2.6.0.0/other_db | 1.3 kB ::
(/): ambari-2.6.0.0/primary_db | 8.6 kB ::
(/): base//x86_64/group_gz | kB ::
(/): base//x86_64/filelists_db | 7.1 MB ::
(/): extras//x86_64/prestodelta | kB ::
(/): extras//x86_64/filelists_db | kB ::
(/): extras//x86_64/other_db | kB ::
(/): updates//x86_64/prestodelta | kB ::
(/): updates//x86_64/filelists_db | 1.3 MB ::
(/): extras//x86_64/primary_db | kB ::
(/): updates//x86_64/other_db | kB ::
(/): updates//x86_64/primary_db | 1.3 MB ::
(/): base//x86_64/other_db | 2.6 MB ::
(/): base//x86_64/primary_db | 6.0 MB ::
Determining fastest mirrors
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
Metadata Cache Created
[root@node101 ~]#

[root@node101 ~]# yum makecache                                                        #创建缓存

[root@node101 ~]# yum -y update
......(内容太多了我就懒得复制了~) libdrm.x86_64 :2.4.-.el7
libffi.x86_64 :3.0.-.el7
libgcc.x86_64 :4.8.-.el7
libgcrypt.x86_64 :1.5.-.el7
libgomp.x86_64 :4.8.-.el7
libgudev1.x86_64 :-.el7
libmount.x86_64 :2.23.-.el7
libndp.x86_64 :1.2-.el7
libnetfilter_conntrack.x86_64 :1.0.-.el7_3
libnl3.x86_64 :3.2.-.el7
libpcap.x86_64 :1.5.-.el7
libpciaccess.x86_64 :0.14-.el7
libproxy.x86_64 :0.4.-.el7
libpwquality.x86_64 :1.2.-.el7
libselinux.x86_64 :2.5-14.1.el7
libselinux-python.x86_64 :2.5-14.1.el7
libselinux-utils.x86_64 :2.5-14.1.el7
libsemanage.x86_64 :2.5-.el7
libsepol.x86_64 :2.5-.el7
libsoup.x86_64 :2.62.-.el7
libss.x86_64 :1.42.-.el7
libssh2.x86_64 :1.4.-.el7
libstdc++.x86_64 :4.8.-.el7
libtasn1.x86_64 :4.10-.el7
libuser.x86_64 :0.60-.el7
libuuid.x86_64 :2.23.-.el7
linux-firmware.noarch :-.git85c5d90.el7
logrotate.x86_64 :3.8.-.el7
lsscsi.x86_64 :0.27-.el7
lua.x86_64 :5.1.-.el7
lvm2.x86_64 :2.02.-.el7_6.
lvm2-libs.x86_64 :2.02.-.el7_6.
make.x86_64 :3.82-.el7
man-db.x86_64 :2.6.-.el7
mariadb-libs.x86_64 :5.5.-.el7_5
microcode_ctl.x86_64 :2.1-.el7
mozjs17.x86_64 :17.0.-.el7
ncurses.x86_64 :5.9-14.20130511.el7_4
ncurses-base.noarch :5.9-14.20130511.el7_4
ncurses-libs.x86_64 :5.9-14.20130511.el7_4
net-tools.x86_64 :2.0-0.24.20131004git.el7
nettle.x86_64 :2.7.-.el7
nspr.x86_64 :4.19.-.el7_5
nss.x86_64 :3.36.-.el7_5
nss-softokn.x86_64 :3.36.-.el7_5
nss-softokn-freebl.x86_64 :3.36.-.el7_5
nss-sysinit.x86_64 :3.36.-.el7_5
nss-tools.x86_64 :3.36.-.el7_5
nss-util.x86_64 :3.36.-.el7_5
numactl-libs.x86_64 :2.0.-.el7
openldap.x86_64 :2.4.-.el7
openssh.x86_64 :.4p1-.el7
openssh-clients.x86_64 :.4p1-.el7
openssh-server.x86_64 :.4p1-.el7
os-prober.x86_64 :1.58-.el7
p11-kit.x86_64 :0.23.-.el7
p11-kit-trust.x86_64 :0.23.-.el7
pam.x86_64 :1.1.-.el7
parted.x86_64 :3.1-.el7
pciutils-libs.x86_64 :3.5.-.el7
pcre.x86_64 :8.32-.el7
perl.x86_64 :5.16.-.el7
perl-Pod-Escapes.noarch :1.04-.el7
perl-libs.x86_64 :5.16.-.el7
perl-macros.x86_64 :5.16.-.el7
pinentry.x86_64 :0.8.-.el7
plymouth.x86_64 :0.8.-0.31..el7.centos
plymouth-core-libs.x86_64 :0.8.-0.31..el7.centos
plymouth-scripts.x86_64 :0.8.-0.31..el7.centos
policycoreutils.x86_64 :2.5-.el7
polkit.x86_64 :0.112-.el7
postfix.x86_64 :2.10.-.el7
procps-ng.x86_64 :3.3.-.el7
python.x86_64 :2.7.-.el7
python-libs.x86_64 :2.7.-.el7
python-perf.x86_64 :3.10.-957.1..el7
python-pycurl.x86_64 :7.19.-.el7
python-pyudev.noarch :0.15-.el7
python-slip.noarch :0.4.-.el7
python-slip-dbus.noarch :0.4.-.el7
readline.x86_64 :6.2-.el7
rsyslog.x86_64 :8.24.-.el7
selinux-policy.noarch :3.13.-.el7_6.
selinux-policy-targeted.noarch :3.13.-.el7_6.
setup.noarch :2.8.-.el7
shadow-utils.x86_64 :4.1.5.1-.el7
shared-mime-info.x86_64 :1.8-.el7
sudo.x86_64 :1.8.-.el7
systemd.x86_64 :-.el7
systemd-libs.x86_64 :-.el7
systemd-sysv.x86_64 :-.el7
tar.x86_64 :1.26-.el7
trousers.x86_64 :0.3.-.el7
tuned.noarch :2.10.-.el7
tzdata.noarch :2018g-.el7
util-linux.x86_64 :2.23.-.el7
vim-minimal.x86_64 :7.4.-.el7
virt-what.x86_64 :1.18-.el7
wpa_supplicant.x86_64 :2.6-.el7
xfsprogs.x86_64 :4.5.-.el7
xz.x86_64 :5.2.-.el7
xz-libs.x86_64 :5.2.-.el7
yum-plugin-fastestmirror.noarch :1.1.-.el7
zlib.x86_64 :1.2.-.el7 Replaced:
NetworkManager.x86_64 :1.0.-.el7 grub2.x86_64 :2.02-0.29.el7.centos
grub2-tools.x86_64 :2.02-0.29.el7.centos pygobject3-base.x86_64 :3.14.-.el7 Complete!
[root@node101 ~]#

[root@node101 ~]# yum -y update                                                        #更新yum源

[root@node101 ~]# yum update openssl
Loaded plugins: fastestmirror, priorities
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
packages excluded due to repository priority protections
No packages marked for update
[root@node101 ~]#

[root@node101 ~]# yum update openssl                                                     #更新yum源后,发现并没有最新版本的opennssl

  问题依旧还是僵持着,参考社区版本链接:https://community.hortonworks.com/questions/145/openssl-error-upon-host-registration.html

    修改/etc/python/cert-verification.cfg配置文件

[root@node101 ~]# cat /etc/python/cert-verification.cfg
# Possible values are:
# 'enable' to ensure HTTPS certificate verification is enabled by default
# 'disable' to ensure HTTPS certificate verification is disabled by default
# 'platform_default' to delegate the decision to the redistributor providing this particular Python version # For more info refer to https://www.python.org/dev/peps/pep-0493/
[https]
#verify=platform_default          #这是我操作系统默认的设置,我将它的值改为“disable”,建议复制一行进行修改,这样你知道上修改前的属性值是多少,便于你恢复。
verify=disable
[root@node101 ~]#

  修改/etc/ambari-agent/conf/ambari-agent.ini,在[security]添加下面内容:

[root@node101 ~]# cat /etc/ambari-agent/conf/ambari-agent.ini
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific [server]
hostname=node101.yinzhengjie.org.cn
url_port=
secured_url_port=
connect_retry_delay=
max_reconnect_retry_delay= [agent]
logdir=/var/log/ambari-agent
piddir=/var/run/ambari-agent
prefix=/var/lib/ambari-agent/data
;loglevel=(DEBUG/INFO)
loglevel=INFO
data_cleanup_interval=
data_cleanup_max_age=
data_cleanup_max_size_MB =
ping_port=
cache_dir=/var/lib/ambari-agent/cache
tolerate_download_failures=true
run_as_user=root
parallel_execution=
alert_grace_period=
status_command_timeout=
alert_kinit_timeout=
system_resource_overrides=/etc/resource_overrides
; memory_threshold_soft_mb=
; memory_threshold_hard_mb=
; ignore_mount_points=/mnt/custom1,/mnt/custom2 [security]
keysdir=/var/lib/ambari-agent/keys
server_crt=ca.crt
passphrase_env_var_name=AMBARI_PASSPHRASE
ssl_verify_cert=
credential_lib_dir=/var/lib/ambari-agent/cred/lib
credential_conf_dir=/var/lib/ambari-agent/cred/conf
credential_shell_cmd=org.apache.hadoop.security.alias.CredentialShell force_https_protocol=PROTOCOL_TLSv1_2 #没错,我修改的就是它! [network]
; this option apply only for Agent communication
use_system_proxy_settings=true [services]
pidLookupPath=/var/run/ [heartbeat]
state_interval_seconds=
dirs=/etc/hadoop,/etc/hadoop/conf,/etc/hbase,/etc/hcatalog,/etc/hive,/etc/oozie,
/etc/sqoop,
/var/run/hadoop,/var/run/zookeeper,/var/run/hbase,/var/run/templeton,/var/run/oozie,
/var/log/hadoop,/var/log/zookeeper,/var/log/hbase,/var/run/templeton,/var/log/hive
; - unlimited
log_lines_count=
idle_interval_min=
idle_interval_max= [logging]
syslog_enabled=
[root@node101 ~]#

[root@node101 ~]# cat /etc/ambari-agent/conf/ambari-agent.ini

手把手教你通过Ambari新建Hadoop集群图解案例

  修改上述的配置文件后,我们需要重启重启ambari-agent 服务:

[root@node101 ~]# xrsync.sh /etc/ambari-agent/conf/ambari-agent.ini
=========== node102.yinzhengjie.org.cn : /etc/ambari-agent/conf/ambari-agent.ini ===========
命令执行成功
=========== node103.yinzhengjie.org.cn : /etc/ambari-agent/conf/ambari-agent.ini ===========
命令执行成功
[root@node101 ~]#

[root@node101 ~]# xrsync.sh /etc/ambari-agent/conf/ambari-agent.ini          #将修改的配置信息同步到其他2个节点上去。如果没有同步配置文件,有可能你只有修改的那台服务器是正常的

[root@node101 ~]# ambari-agent restart
Restarting ambari-agent
Verifying Python version compatibility...
Using python /usr/bin/python
Found ambari-agent PID:
Stopping ambari-agent
Removing PID file at /run/ambari-agent/ambari-agent.pid
ambari-agent successfully stopped
Verifying Python version compatibility...
Using python /usr/bin/python
Checking for previously running Ambari Agent...
Checking ambari-common dir...
Starting ambari-agent
Verifying ambari-agent process status...
Ambari Agent successfully started
Agent PID at: /run/ambari-agent/ambari-agent.pid
Agent out at: /var/log/ambari-agent/ambari-agent.out
Agent log at: /var/log/ambari-agent/ambari-agent.log
[root@node101 ~]#

[root@node101 ~]# ambari-agent restart                            #修改文件需要重启服务。

  Duang~,你会发现服务器注册成功啦~问题得到解决:(看来HDP社区版的论坛的确是有不少大佬啊~哈哈哈)

手把手教你通过Ambari新建Hadoop集群图解案例

8>.进入服务选择页面,自定义需要安装的服务

手把手教你通过Ambari新建Hadoop集群图解案例

9>.自定义需要安装的服务后,点击下一步

手把手教你通过Ambari新建Hadoop集群图解案例

10>.分配主控服务,分配完毕后点击下一步

手把手教你通过Ambari新建Hadoop集群图解案例

11>.分配子服务和客户端

手把手教你通过Ambari新建Hadoop集群图解案例

12>.配置NameNode和DataNode在服务器上的存储路径

手把手教你通过Ambari新建Hadoop集群图解案例

  输入Grafana Admin的密码,如下图:

手把手教你通过Ambari新建Hadoop集群图解案例

  点击途中的有警告的按钮,咱们依然还需要输入一个密码,如下图:

手把手教你通过Ambari新建Hadoop集群图解案例

13>.查看安装预览页面,显示了安装组件的概览信息(如果你察觉到哪里配置的不合理可以点击“back”返回去修改),如无异常,点击“Deploy”

手把手教你通过Ambari新建Hadoop集群图解案例

14>.等待组件安装过程

手把手教你通过Ambari新建Hadoop集群图解案例

15>.安装完毕,点击下一步

手把手教你通过Ambari新建Hadoop集群图解案例

16>.安装完毕后,点击“Complete”,进入主界面

手把手教你通过Ambari新建Hadoop集群图解案例

17>.进入Ambari的主界面

手把手教你通过Ambari新建Hadoop集群图解案例