Hadoop生态圈-离线方式部署Ambari2.6.0.0

                                     作者:尹正杰

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

  我现在所在的公司用的是CDH管理Hadoop集群,前端时间去面试时发现很多企业都在用HDP,于是回来捣鼓来一下HDP的部署方式。部署时也踩过不少坑,这里把正确部署Ambari的方式记录一下。其实部署Ambari的方式和CDH的部署方式大同小异。

  本片博客会详细介绍如何使用Ambari来安装HDP发行版本,想要避免去官网踩坑的小伙伴可以这篇笔记很适合你哟!HDP是Hontorworks Data Platform的简称,是Hontorworks公司的Hadoop发行版本,在企业中十分流行。同样著名的还有Cludera公司的CDH发行版本(详情请参考我的笔记:离线方式部署Cloudera Manager5.15.1)。

一.Ambari简介

  和CDH一样,Ambari是一款用于部署,管理和监控Hadoop集群服务的开源系统,它实现来以下功能:

    1>.安装一个Hadoop集群:

      第一:提供了以向导指引的方式安装一个集群,可以在任意的主机上安装Hadoop服务。

      第二:提供了对Hadoop服务的配置功能。

    2>.管理一个Hadoop集群:

      提供了启动,停止等集群管理功能。

    3>.监控Hadoop集群:

      第一:提供了一个监控Hadoop集群监控状态的仪表盘。

      第二:提供了一套监控指标体系来手机监控数据。

      第三:提供了一套预警框架,可以结合预定的监控指标实现通知告警。

  和CDH很像,从设计上看Ambari使用的Master/Slaves架构(主/从架构,由一个Ambari-Server和多个Agent组成)。如下图所示,它是通过一个Server主进程来实现集群的管理和操作命令的发送,而具体管理动作则由安装在每台目标主机上的Agent进程进行执行。例如通过Ambari启动HDFS服务的时候,首先会由Ambari-Server向安装来HDFS服务所在主机的Agent进程发送启动指令,然后再有相关Agent进程执行其所在主机的本地命令来启动HDFS的相应服务。

二.集群服务规划设计

  在正式安装之前,我们还需要完成一些前期准备工作,包括集群服务的设计,服务器环境准备和用于安装Ambari的本地yum仓库等。

  1. yum(全称为Yellow dog UpdaterModified)是一个在FedoraRedHat以及CentOS中的Shell前端软件包管理器。基于RPM包管理,能够从指定的服务器自动下载RPM包并且安装,可以自动处理依赖性关系,并且一次安装所有的以来的软件包,无须繁琐地一次次下载,安装。

  在了解了集群服务器角色的职责划分之后,现在可以开始设计以下集群节点的服务划分了。Ambari通过集成HDP这样一个Hadoop发行版安装包来实现对应组件服务的安装。接下来,我们看看截止到HDP2.5版本,它都提供了那些核心服务。

1>.NameNode

  分布式文件系统HDFS主控服务,主要用于保存文件系的元数据信息以及操作路由。

2>.SecondNameNode

  专职用于帮助NameNode合并快照日志文件的服务,以缓解NameNode压力。

3>.DataNodes

  分布式文件系统HDFS的数据存储服务,主要你提供文件数据块的存储和查询功能。

4>.ResourceManger

  资源调度系统YARN的主控服务,负责统一的资源分配和调度工作。

5>.NodeManagers

  资源调度系统YARN的容器服务,负责具体的任务执行工作,YARN只会将任务分配到安装了NodeManager服务的主机执行任务。

6>.App Timeline Server

  负责存储在YARN中执行任务的历史信息,包括任务状态,任务日志等,并提供对这些信息查询的能力。

7>.Histroy Server

  负责存储在YARN中执行的任务的历史信息,包括任务状态,任务日志等,并提供对这些信息查询的能力。

8>.Hive Metastore

  负责存储数据仓库Hive的元数据信息,例如表名称,表字段和字段属性等。

9>.HiveServer2

  Hive在线查询服务,支持通过JDBC和ODBC等标准协议查询数据。

10>.Tez

  使用DAG作为计算模型的一款分布式计算引擎,HDP版本里Hive组件的计算引擎使用的正式Tez。

11>.Active HBase Master

  分布式NoSQL服务,HBase的主控服务,主要负责Region的分配和DDL操作。

12>.RegionServers

  分布式NoSQL服务,HBase的数据存储服务,主要提供具体数据的存储与查询功能。

13>.Zookeeper server

  分布式协同管理服务,负责HBase,Ambari Infra 和Kafka等多项服务的协同工作。

14>.Kafka Broker

  分布式消息系统Kafka,负责消息的接受,发送,消息主题的管理等工作。

15>.Spark History Server

  分布式内存计算框架Spark的任务历史服务,负责存储记录Spark任务的历史信息,包括任务状态,执行时间,任务日志和环境变量等信息。同时也提供这些历史细腻下的查看检索功能。

16>.Spark Thrift Servers

  分布式内存计算框架Spark的在线查询服务,和Hive的HiveServer2服务类似。支持通过JDBC和OBDC等标准协议查询数据。

17>.Knox Gateway

  网关服务,可以代理HDP中YARN,HBase,HDFS等众多组件的Restful服务。

18>.Ranger Admin

  权限管理服务,可以代理YARN,HBase,HDFS等众多组件的权限管理功能。

19>.Ranger KMS Server

  Ranger的Key管理服务,用于管理Hadoop集群的认证密钥。

20>.Ranger Usersync 

  Rabfer的用户同步服务,负责将Hadoop的集群用户同步更新到Ranger的内部服务。

21>.Zepplin

  交互式在线分析工具,可以直接通过Web界面编写SQL或代码的形式使用Spark,Hive等服务进行交互式分析。

22>.Log Search  

  日志采集与分析服务,负责收集所有Hadoop服务的日志文件并提供集中展示和检索功能。

23>.Ambari Infra

  搜索服务,用于存储Ranger的审计日志以及Log Search采集到的系统日志等数据。

24>.Clients

  各种服务的客户端程序,包括MapReduce2 Clients,YARN Clients,Hive Clients,Zookeeper Clients,Spark Clients,HBase Clients等等。

 

  在了解上述Ambari可以安装的核心服务之后,我们可以根据服务列表自行添加服务,这和我们之前部署CDH自定义需要安装服务几乎如出一辙。想必部署过CDH的小伙伴,对这个理解起来也非常简单的,我在这里就不多费口舌啦~

三.环境准备

1>.Ambari目前只支持64位的操作系统,具体操作如下:

  1.1>.RHEL(Redhat Enterprise Linux)6或者7;

  1.2>.CentOS6或者CentOS7;

  1.3>.OEL(Oracle Enterprise Linux)6或者7;

  1.4>.SLES(SuSE Linux Enterprise Server)11;

  1.5>.Debian 7;

  1.6>.Ubantu12 或者14;

2>.配置主机列表(每台主机都需要配置,我本次实验共计3台服务器)

  Ambari所管理的各个服务之间需要使用FQDN来进行访问,所以我们还需要为各个服务器配置他们的FQDN。Linux系统可以通过主机表配置它的 FQDN,编辑“/etc/hosts”这个配置文件即可。

  1. [root@node101 ~]# cat /etc/hosts
  2. 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
  3. :: localhost localhost.localdomain localhost6 localhost6.localdomain6
  4.  
  5. 172.30.1.101 node101.yinzhengjie.org.cn
  6. 172.30.1.102 node102.yinzhengjie.org.cn
  7. 172.30.1.103 node103.yinzhengjie.org.cn
  8.  
  9. [root@node101 ~]#
  10. [root@node101 ~]#
  11.  
  12. FQDNFully Qualified Domain Name):
      完全合格域名/全称域名,是指主机名加上全路径,全路径中列出了序列中所有域成员。全域名可以从逻辑上准确地表示处主机在什么地方,也可以说全域名是主机名的一种完全表示形式。

  我都实验环境配置了3台服务器,3台服务器都相同,如下图:

3>.各个主机配置免密登陆(在“node101.yinzhengjie.org.cn”上操作)

  1. [root@node101 ~]# ssh-keygen -t rsa -P '' -f ~/.ssh/id_rsa
  2. Generating public/private rsa key pair.
  3. Created directory '/root/.ssh'.
  4. Your identification has been saved in /root/.ssh/id_rsa.
  5. Your public key has been saved in /root/.ssh/id_rsa.pub.
  6. The key fingerprint is:
  7. d1:::b3:ca::0e::f2::::7d::d4: root@node101.yinzhengjie.org.cn
  8. The key's randomart image is:
  9. +--[ RSA ]----+
  10. | ooBo .o+..E|
  11. | .=.B. . o |
  12. | . o + .. . |
  13. | + + o |
  14. | = S |
  15. | + |
  16. | . |
  17. | |
  18. | |
  19. +-----------------+
  20. [root@node101 ~]#
  21. [root@node101 ~]#
  22. [root@node101 ~]#
  23. [root@node101 ~]#
  24. [root@node101 ~]# ll ~/.ssh/id_rsa
  25. -rw-------. root root Dec : /root/.ssh/id_rsa
  26. [root@node101 ~]#
  27. [root@node101 ~]# cat ~/.ssh/id_rsa
  28. -----BEGIN RSA PRIVATE KEY-----
  29. MIIEogIBAAKCAQEAwtFCswPu3AOKXa2TzJRBKG/LC8knCtLE54zMVUaMwbWH0fdV
  30. xHpa8n+V15W3HwLFBZDgyNmnPvZkVJUvTYqf5QaLsxm5J0JAxlmBkY/ayByeULLw
  31. SVIXM/hqBulYnbUViVhGEmBbpI3ASjFVXQyiihyNhzoPZBjdiexnTh7aYJDjQ8qL
  32. IZyQu+rjeoqju839dUmm4RfmqgaPsa717CNxqUgUdviTdK2meV4hA7HtKAxMTpYK
  33. JcEAu3lvh9NRT2k8HSMvEaN/WVUF8SrNN1oUC4aFSO9tDmY3euBCccYf+RqSlzys
  34. m5dxCFDk94cEhsvIzfdzUB4usPs1inUHcQ9pqQIDAQABAoIBAAWbPA4myNLwDyVO
  35. /3fdtFpTjUZTjZoUIrJ/LMovc5GHhdcXBRLYapGb9lXz6wcrbzwPxUhCazu2n4CH
  36. oorauGtA2vhWfyuQDokmvkHQH/2uRSgRXjTd9ej69yInyPMQ6QPA1JNmznxXz/bS
  37. oKBC4tKSq8f+db7tsEJt2TM4VBR/Sg0x77LhZA70MC2+vv+9AoIKVVdZ/KNud+Dk
  38. r2c+Hmo4r7I4G2Oqaj33f7RXFsILIwl0SBvpag4GPhwnOuphXDr3DQ1v5j+4x0rx
  39. 3JE+HmlpU66XveUuy7pMurdbOCajwPQgLkDo5W7bBUMIlBS/nZvInncVdDPzWFHO
  40. ZlUh8dkCgYEA6Ykewa0oN96XLPdqbADHRqpzxL7zXJJ644Hh2HygyhR0xw3bOI57
  41. IjkYje9e5PVUcXWuOj/oOMfKal2jW/78bnEgukX1JgkX8RHT9zsgZ0AGEpquHkjv
  42. NrB1qrdbEwnNpSLB8pwGveD9zf89yzocZE+5CUBfnsuAgZqPYkjPMwcCgYEA1Y6x
  43. o1ZxxsPGZIk+hZPuynemdZYnQWp3Z9ynVv902x1/sxcn/uZ+0DZDLQbqGA+2WdEg
  44. EQZ9BwKTCkThoPBJKEzR3Ck122ahqSKCEQRGwK0h05uaA3KSTGIbujGaoBfDWG6f
  45. 3fTSWZnTNaObmcOhxTgsMRegy/kWOIgYqdX04c8CgYA9rsf+49uBljtb1yW2zSXV
  46. VmQpjT3+L3ph6QZcBd76QRjvEovajlebnHUN2DG6S8o4BZs1K3gMt0iRe5YQUHMg
  47. QKUiTiQIHdLDC7Bu1qEiZFi2RUDEIwN78HPD2ZYmmypD+cA8clWdhXXEGSybJwgk
  48. vqHi/avD54BTux0wGocPtQKBgFY2Ud4nsqzUMg46HaRdUSQpY2jK4jQVX/js6h1D
  49. 6Y/fe8L30SylLoKttTbDONPX2/ysYO6emPCwiF236wJGnrIHOR1RAa3947tc8/cc
  50. q9dyzVoY0fccVJVDcgAbsFl63mCf4CgBgr2rTMm1r8ZGZNMyVxzGdiKB/wd5YcOG
  51. XWKfAoGAYpvjXzEYzr7Y7KKlZBR3gUZZwfngYYgf8g1L42oB1un1NUajiMCyPsm6
  52. oxKrFj6a8SH1xy1U0S7QbPK7osjR5qU7SMsqgziouBl1UmAT5WVKoik4UvHLlKC3
  53. hB0HxUvfVYM5lV3BaggVTC/EOAOsa+jqfbrwjBxjn/kmmv2FtLk=
  54. -----END RSA PRIVATE KEY-----
  55. [root@node101 ~]#
  56. [root@node101 ~]#

[root@node101 ~]# ssh-keygen -t rsa -P '' -f ~/.ssh/id_rsa                #生成密钥

  1. [root@node101 ~]# ssh-copy-id root@node101.yinzhengjie.org.cn
  2. The authenticity of host 'node101.yinzhengjie.org.cn (172.30.1.101)' can't be established.
  3. ECDSA key fingerprint is e5::dc::ee:e6:ed::de:::a8:c4:::e7.
  4. Are you sure you want to continue connecting (yes/no)? yes
  5. /usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
  6. /usr/bin/ssh-copy-id: INFO: key(s) remain to be installed -- if you are prompted now it is to install the new keys
  7. root@node101.yinzhengjie.org.cn's password:
  8.  
  9. Number of key(s) added:
  10.  
  11. Now try logging into the machine, with: "ssh 'root@node101.yinzhengjie.org.cn'"
  12. and check to make sure that only the key(s) you wanted were added.
  13.  
  14. [root@node101 ~]#
  15. [root@node101 ~]# ssh node101.yinzhengjie.org.cn
  16. Last login: Wed Dec :: from 172.30.1.2
  17. [root@node101 ~]# who
  18. root pts/ -- : (172.30.1.2)
  19. root pts/ -- : (node101.yinzhengjie.org.cn)
  20. [root@node101 ~]#
  21. [root@node101 ~]# logout
  22. Connection to node101.yinzhengjie.org.cn closed.
  23. [root@node101 ~]#

[root@node101 ~]# ssh-copy-id root@node101.yinzhengjie.org.cn              #与本机(node101.yinzhengjie.org.cn)配置免密钥登陆

  1. [root@node101 ~]# ssh-copy-id root@node102.yinzhengjie.org.cn
  2. /usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
  3. /usr/bin/ssh-copy-id: INFO: key(s) remain to be installed -- if you are prompted now it is to install the new keys
  4. root@node102.yinzhengjie.org.cn's password:
  5.  
  6. Number of key(s) added:
  7.  
  8. Now try logging into the machine, with: "ssh 'root@node102.yinzhengjie.org.cn'"
  9. and check to make sure that only the key(s) you wanted were added.
  10.  
  11. [root@node101 ~]#
  12. [root@node101 ~]# ssh node102.yinzhengjie.org.cn
  13. Last login: Wed Dec :: from 172.30.1.101
  14. [root@nod102 ~]#
  15. [root@nod102 ~]# who
  16. root pts/ -- : (172.30.1.2)
  17. root pts/ -- : (172.30.1.101)
  18. [root@nod102 ~]#
  19. [root@nod102 ~]# logout
  20. Connection to node102.yinzhengjie.org.cn closed.
  21. [root@node101 ~]#

[root@node101 ~]# ssh-copy-id root@node102.yinzhengjie.org.cn              #与node102.yinzhengjie.org.cn配置免密钥登陆

  1. [root@node101 ~]# ssh-copy-id root@node103.yinzhengjie.org.cn
  2. /usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
  3. /usr/bin/ssh-copy-id: INFO: key(s) remain to be installed -- if you are prompted now it is to install the new keys
  4. root@node103.yinzhengjie.org.cn's password:
  5.  
  6. Number of key(s) added:
  7.  
  8. Now try logging into the machine, with: "ssh 'root@node103.yinzhengjie.org.cn'"
  9. and check to make sure that only the key(s) you wanted were added.
  10.  
  11. [root@node101 ~]#
  12. [root@node101 ~]# ssh node103.yinzhengjie.org.cn
  13. Last login: Wed Dec :: from 172.30.1.101
  14. [root@node103 ~]#
  15. [root@node103 ~]#
  16. [root@node103 ~]# who
  17. root pts/ -- : (172.30.1.2)
  18. root pts/ -- : (172.30.1.101)
  19. [root@node103 ~]#
  20. [root@node103 ~]# logout
  21. Connection to node103.yinzhengjie.org.cn closed.
  22. [root@node101 ~]#

[root@node101 ~]# ssh-copy-id root@node103.yinzhengjie.org.cn              #与node103.yinzhengjie.org.cn配置免密钥登陆

4>.编写集群管理脚本

  在配置FQDN和免密钥登陆后,咱们就可以编写一些集群的管理脚本,便于我们下发文件到其他节点中。

  1. [root@node101 ~]# vi /usr/local/bin/xcall.sh              #我们创建该脚本时,直接就把它放在默认的“PATH”环境变量中。因此编辑好后只要有执行权限就可以在任意路径调用它啦!
  2. [root@node101 ~]#
  3. [root@node101 ~]#
  4. [root@node101 ~]# cat /usr/local/bin/xcall.sh
  5. #!/bin/bash
  6. #@author :yinzhengjie
  7. #blog:http://www.cnblogs.com/yinzhengjie
  8. #EMAIL:y1053419035@qq.com
  9.  
  10. #判断用户是否传参
  11. if [ $# -lt ];then
  12. echo "请输入参数"
  13. exit
  14. fi
  15.  
  16. #获取用户输入的命令
  17. cmd=$@
  18.  
  19. for (( i=;i<=;i++ ))
  20. do
  21. #使终端变绿色
  22. tput setaf
  23. echo ============= node${i}.yinzhengjie.org.cn : $cmd ============
  24. #使终端变回原来的颜色,即白灰色
  25. tput setaf
  26. #远程执行命令
  27. ssh node${i}.yinzhengjie.org.cn $cmd
  28. #判断命令是否执行成功
  29. if [ $? == ];then
  30. echo "命令执行成功"
  31. fi
  32. done
  33. [root@node101 ~]#
  34. [root@node101 ~]#
  35. [root@node101 ~]# chmod +x /usr/local/bin/xcall.sh              #别忘记添加执行权限哟!
  36. [root@node101 ~]#
  37. [root@node101 ~]# xcall.sh cat /etc/redhat-release              #我们在这里可以测试一些咱们的脚本是否好使~
  38. ============= node101.yinzhengjie.org.cn : cat /etc/redhat-release ============
  39. CentOS Linux release 7.2. (Core)
  40. 命令执行成功
  41. ============= node102.yinzhengjie.org.cn : cat /etc/redhat-release ============
  42. CentOS Linux release 7.2. (Core)
  43. 命令执行成功
  44. ============= node103.yinzhengjie.org.cn : cat /etc/redhat-release ============
  45. CentOS Linux release 7.2. (Core)
  46. 命令执行成功
  47. [root@node101 ~]#
  48. [root@node101 ~]#

[root@node101 ~]# vi /usr/local/bin/xcall.sh              #编写批量执行命令的脚本,我们在创建该脚本时,直接就把它放在默认的“PATH”环境变量中。因此编辑好后只要有执行权限就可以在任意路径调用它啦!

  1. [root@node101 ~]# xcall.sh "yum -y install rsync"
  2. ============= node101.yinzhengjie.org.cn : yum -y install rsync ============
  3. Loaded plugins: fastestmirror
  4. Loading mirror speeds from cached hostfile
  5. * base: mirrors.huaweicloud.com
  6. * extras: mirrors.huaweicloud.com
  7. * updates: mirrors..com
  8. Resolving Dependencies
  9. --> Running transaction check
  10. ---> Package rsync.x86_64 :3.1.-.el7 will be installed
  11. --> Finished Dependency Resolution
  12.  
  13. Dependencies Resolved
  14.  
  15. ================================================================================
  16. Package Arch Version Repository Size
  17. ================================================================================
  18. Installing:
  19. rsync x86_64 3.1.-.el7 base k
  20.  
  21. Transaction Summary
  22. ================================================================================
  23. Install Package
  24.  
  25. Total download size: k
  26. Installed size: k
  27. Downloading packages:
  28. Running transaction check
  29. Running transaction test
  30. Transaction test succeeded
  31. Running transaction
  32. Installing : rsync-3.1.-.el7.x86_64 /
  33. Verifying : rsync-3.1.-.el7.x86_64 /
  34.  
  35. Installed:
  36. rsync.x86_64 :3.1.-.el7
  37.  
  38. Complete!
  39. 命令执行成功
  40. ============= node102.yinzhengjie.org.cn : yum -y install rsync ============
  41. Loaded plugins: fastestmirror
  42. Repodata is over weeks old. Install yum-cron? Or run: yum makecache fast
  43. http://mirrors.njupt.edu.cn/centos/7.6.1810/os/x86_64/repodata/bc140c8149fc43a5248fccff0daeef38182e49f6fe75d9b46db1206dc25a6c1c-c7-x86_64-comps.xml.gz: [Errno 12] Timeout on http://10.10.254.10/cache/5/02/mirrors.njupt.edu.cn/033b2636ff3cf3103169fa739764fdd7/bc140c8149fc43a5248fccff0daeef38182e49f6fe75d9b46db1206dc25a6c1c-c7-x86_64-comps.xml.gz: (28, 'Connection timed out after 30682 milliseconds')
  44. Trying other mirror.
  45. http://mirrors.njupt.edu.cn/centos/7.6.1810/updates/x86_64/repodata/8e273c72093a2cfc3f3b2baccfb2b01f7f4bcdc1bb72d53e38074068a756f1c6-primary.sqlite.bz2: [Errno 12] Timeout on http://10.10.254.10/cache/4/02/mirrors.njupt.edu.cn/c35de49cce30395fb97f6c41a56fbad5/8e273c72093a2cfc3f3b2baccfb2b01f7f4bcdc1bb72d53e38074068a756f1c6-primary.sqlite.bz2: (28, 'Connection timed out after 30672 milliseconds')
  46. Trying other mirror.
  47. Determining fastest mirrors
  48. * base: mirrors.huaweicloud.com
  49. * extras: mirrors.huaweicloud.com
  50. * updates: mirrors.neusoft.edu.cn
  51. Resolving Dependencies
  52. --> Running transaction check
  53. ---> Package rsync.x86_64 :3.1.-.el7 will be installed
  54. --> Finished Dependency Resolution
  55.  
  56. Dependencies Resolved
  57.  
  58. ================================================================================
  59. Package Arch Version Repository Size
  60. ================================================================================
  61. Installing:
  62. rsync x86_64 3.1.-.el7 base k
  63.  
  64. Transaction Summary
  65. ================================================================================
  66. Install Package
  67.  
  68. Total download size: k
  69. Installed size: k
  70. Downloading packages:
  71. Running transaction check
  72. Running transaction test
  73. Transaction test succeeded
  74. Running transaction
  75. Installing : rsync-3.1.-.el7.x86_64 /
  76. Verifying : rsync-3.1.-.el7.x86_64 /
  77.  
  78. Installed:
  79. rsync.x86_64 :3.1.-.el7
  80.  
  81. Complete!
  82. 命令执行成功
  83. ============= node103.yinzhengjie.org.cn : yum -y install rsync ============
  84. Loaded plugins: fastestmirror
  85. Repodata is over weeks old. Install yum-cron? Or run: yum makecache fast
  86. http://mirrors.njupt.edu.cn/centos/7.6.1810/os/x86_64/repodata/6614b3605d961a4aaec45d74ac4e5e713e517debb3ee454a1c91097955780697-primary.sqlite.bz2: [Errno 12] Timeout on http://10.10.254.10/cache/5/02/mirrors.njupt.edu.cn/fa6cd86bdbaedbbfedfbfa6d45952cd2/6614b3605d961a4aaec45d74ac4e5e713e517debb3ee454a1c91097955780697-primary.sqlite.bz2: (28, 'Connection timed out after 30867 milliseconds')
  87. Trying other mirror.
  88. Determining fastest mirrors
  89. * base: mirrors.huaweicloud.com
  90. * extras: mirrors.huaweicloud.com
  91. * updates: mirrors.cn99.com
  92. Resolving Dependencies
  93. --> Running transaction check
  94. ---> Package rsync.x86_64 :3.1.-.el7 will be installed
  95. --> Finished Dependency Resolution
  96.  
  97. Dependencies Resolved
  98.  
  99. ================================================================================
  100. Package Arch Version Repository Size
  101. ================================================================================
  102. Installing:
  103. rsync x86_64 3.1.-.el7 base k
  104.  
  105. Transaction Summary
  106. ================================================================================
  107. Install Package
  108.  
  109. Total download size: k
  110. Installed size: k
  111. Downloading packages:
  112. Running transaction check
  113. Running transaction test
  114. Transaction test succeeded
  115. Running transaction
  116. Installing : rsync-3.1.-.el7.x86_64 /
  117. Verifying : rsync-3.1.-.el7.x86_64 /
  118.  
  119. Installed:
  120. rsync.x86_64 :3.1.-.el7
  121.  
  122. Complete!
  123. 命令执行成功
  124. [root@node101 ~]#

[root@node101 ~]# xcall.sh "yum -y install rsync"            #使用我们上面自定义脚本批量安装rsync服务

  1. [root@node101 ~]# vi /usr/local/bin/xrsync.sh             #编写同步脚本,注意:我们在编写脚本时,就把脚本放在Linux自带的“PATH”环境变量中。
  2. [root@node101 ~]#
  3. [root@node101 ~]# cat /usr/local/bin/xrsync.sh    
  4. #!/bin/bash
  5. #@author :yinzhengjie
  6. #blog:http://www.cnblogs.com/yinzhengjie
  7. #EMAIL:y1053419035@qq.com
  8.  
  9. #判断用户是否传参
  10. if [ $# -lt ];then
  11. echo "请输入参数";
  12. exit
  13. fi
  14.  
  15. #获取文件路径
  16. file=$@
  17.  
  18. #获取子路径
  19. filename=`basename $file`
  20.  
  21. #获取父路径
  22. dirpath=`dirname $file`
  23.  
  24. #获取完整路径
  25. cd $dirpath
  26. fullpath=`pwd -P`
  27.  
  28. #同步文件到DataNode
  29. for (( i=;i<=;i++ ))
  30. do
  31. #使终端变绿色
  32. tput setaf
  33. echo =========== node${i}.yinzhengjie.org.cn : $file ===========
  34. #使终端变回原来的颜色,即白灰色
  35. tput setaf
  36. #远程执行命令
  37. rsync -lr $filename `whoami`@node${i}.yinzhengjie.org.cn:$fullpath
  38. #判断命令是否执行成功
  39. if [ $? == ];then
  40. echo "命令执行成功"
  41. fi
  42. done
  43. [root@node101 ~]#
  44. [root@node101 ~]#
  45. [root@node101 ~]# chmod +x /usr/local/bin/xrsync.sh          #别忘记添加执行权限哟!
  46. [root@node101 ~]#

[root@node101 ~]# vi /usr/local/bin/xrsync.sh             #编写同步脚本,注意:我们在编写脚本时,就把脚本放在Linux自带的“PATH”环境变量中。

  1. [root@node101 ~]# xcall.sh cat /etc/hosts | grep yinzhengjie                    #我们在没有同步“/etc/hosts”配置文件时,发现只有“node101.yinzhengjie.org.cn”中配置了FQDN
  2. ============= node101.yinzhengjie.org.cn : cat /etc/hosts ============
  3. 172.30.1.101 node101.yinzhengjie.org.cn
  4. 172.30.1.102 node102.yinzhengjie.org.cn
  5. 172.30.1.103 node103.yinzhengjie.org.cn
  6. ============= node102.yinzhengjie.org.cn : cat /etc/hosts ============
  7. ============= node103.yinzhengjie.org.cn : cat /etc/hosts ============
  8. [root@node101 ~]#
  9. [root@node101 ~]# xrsync.sh /etc/hosts                                  #我们利用咱们自定义的脚本将“/etc/hosts”配置文件下发到"node102.yinzhengjie.org.cn"和“node103.yinzhengjie.org.cn”上去。
  10. =========== node102.yinzhengjie.org.cn : /etc/hosts ===========
  11. 命令执行成功
  12. =========== node103.yinzhengjie.org.cn : /etc/hosts ===========
  13. 命令执行成功
  14. [root@node101 ~]#
  15. [root@node101 ~]#
  16. [root@node101 ~]# xcall.sh cat /etc/hosts | grep yinzhengjie                    #我们验证一下,3台机器上陪孩子是否都相同~如果输出相同说明配置生效啦~
  17. ============= node101.yinzhengjie.org.cn : cat /etc/hosts ============
  18. 172.30.1.101 node101.yinzhengjie.org.cn
  19. 172.30.1.102 node102.yinzhengjie.org.cn
  20. 172.30.1.103 node103.yinzhengjie.org.cn
  21. ============= node102.yinzhengjie.org.cn : cat /etc/hosts ============
  22. 172.30.1.101 node101.yinzhengjie.org.cn
  23. 172.30.1.102 node102.yinzhengjie.org.cn
  24. 172.30.1.103 node103.yinzhengjie.org.cn
  25. ============= node103.yinzhengjie.org.cn : cat /etc/hosts ============
  26. 172.30.1.101 node101.yinzhengjie.org.cn
  27. 172.30.1.102 node102.yinzhengjie.org.cn
  28. 172.30.1.103 node103.yinzhengjie.org.cn
  29. [root@node101 ~]#

5>.本篇博客的操作系统环境如下

  由于Ambari是使用Java语言开发实现的,所以其部署的服务还需要安装Java环境,Ambari支持1.7或者1.8版本。推荐使用1.8版本,因为jdk1.7官网以及不维护了。

  大家可以自行去Oracle官网下载相应的jdk,我这里给出下载地址:https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html(推荐下载tar.gz的安装包)。

  1. [root@node101 ~]# yum -y install lrzsz
  2. Loaded plugins: fastestmirror
  3. Repodata is over weeks old. Install yum-cron? Or run: yum makecache fast
  4. base | 3.6 kB ::
  5. extras | 3.4 kB ::
  6. updates | 3.4 kB ::
  7. (/): base//x86_64/primary_db | 6.0 MB ::
  8. (/): base//x86_64/group_gz | kB ::
  9. (/): extras//x86_64/primary_db | kB ::
  10. (/): updates//x86_64/primary_db | 1.3 MB ::
  11. Determining fastest mirrors
  12. * base: mirrors.huaweicloud.com
  13. * extras: mirrors.huaweicloud.com
  14. * updates: mirrors..com
  15. Resolving Dependencies
  16. --> Running transaction check
  17. ---> Package lrzsz.x86_64 :0.12.-.el7 will be installed
  18. --> Finished Dependency Resolution
  19.  
  20. Dependencies Resolved
  21.  
  22. ===================================================================================================================================================================================
  23. Package Arch Version Repository Size
  24. ===================================================================================================================================================================================
  25. Installing:
  26. lrzsz x86_64 0.12.-.el7 base k
  27.  
  28. Transaction Summary
  29. ===================================================================================================================================================================================
  30. Install Package
  31.  
  32. Total download size: k
  33. Installed size: k
  34. Downloading packages:
  35. lrzsz-0.12.-.el7.x86_64.rpm | kB ::
  36. Running transaction check
  37. Running transaction test
  38. Transaction test succeeded
  39. Running transaction
  40. Installing : lrzsz-0.12.-.el7.x86_64 /
  41. Verifying : lrzsz-0.12.-.el7.x86_64 /
  42.  
  43. Installed:
  44. lrzsz.x86_64 :0.12.-.el7
  45.  
  46. Complete!
  47. [root@node101 ~]#

[root@node101 ~]# yum -y install lrzsz            #安装上传和下载的工具,我们可以将下载好的jdk上传到服务上。

  1. [root@node101 ~]# mkdir -pv /yinzhengjie/softwares
  2. mkdir: created directory ‘/yinzhengjie
  3. mkdir: created directory ‘/yinzhengjie/softwares
  4. [root@node101 ~]#
  5. [root@node101 ~]# ll -h
  6. total 183M
  7. -rw-r--r--. root root 183M Dec : jdk-8u191-linux-x64.tar.gz
  8. [root@node101 ~]#
  9. [root@node101 ~]# tar -zxf jdk-8u191-linux-x64.tar.gz -C /yinzhengjie/softwares/
  10. [root@node101 ~]#
  11. [root@node101 ~]# ln -s /yinzhengjie/softwares/jdk1..0_191/ /yinzhengjie/softwares/jdk
  12. [root@node101 ~]#
  13. [root@node101 ~]# mkdir /usr/java && cd /usr/java
  14. [root@node101 java]#
  15. [root@node101 java]# ln -s /yinzhengjie/softwares/jdk1..0_191/ /usr/java/jdk1.
  16. [root@node101 java]# ln -s /yinzhengjie/softwares/jdk1..0_191/ /usr/java/defalut
  17. [root@node101 java]#
  18. [root@node101 java]# tail - /etc/profile
  19. #ADD JAVA_PATH
  20. JAVA_HOME=/yinzhengjie/softwares/jdk
  21. PATH=$PATH:$JAVA_HOME/bin
  22. [root@node101 java]#
  23. [root@node101 java]#
  24. [root@node101 java]# source /etc/profile
  25. [root@node101 java]#
  26. [root@node101 java]# java -version
  27. java version "1.8.0_191"
  28. Java(TM) SE Runtime Environment (build 1.8.0_191-b12)
  29. Java HotSpot(TM) -Bit Server VM (build 25.191-b12, mixed mode)
  30. [root@node101 java]#

[root@node101 java]# java -version              #在node101.yinzhengjie.org.cn节点上安装jdk环境

  1. [root@node101 java]# xcall.sh python --version
  2. ============= node101.yinzhengjie.org.cn : python --version ============
  3. Python 2.7.
  4. 命令执行成功
  5. ============= node102.yinzhengjie.org.cn : python --version ============
  6. Python 2.7.
  7. 命令执行成功
  8. ============= node103.yinzhengjie.org.cn : python --version ============
  9. Python 2.7.
  10. 命令执行成功
  11. [root@node101 java]#

[root@node101 java]# xcall.sh python --version      #Linux自带的python环境

  1. [root@node101 java]# xrsync.sh /yinzhengjie/
  2. =========== node102.yinzhengjie.org.cn : /yinzhengjie/ ===========
  3. 命令执行成功
  4. =========== node103.yinzhengjie.org.cn : /yinzhengjie/ ===========
  5. 命令执行成功
  6. [root@node101 java]#
  7. [root@node101 java]#
  8. [root@node101 java]# xrsync.sh /etc/profile                                          #同步环境变量
  9. =========== node102.yinzhengjie.org.cn : /etc/profile ===========
  10. 命令执行成功
  11. =========== node103.yinzhengjie.org.cn : /etc/profile ===========
  12. 命令执行成功
  13. [root@node101 java]#
  14. [root@node101 java]# xcall.sh ln -s /yinzhengjie/softwares/jdk/bin/jps /usr/local/bin/                #做个软链接,便于xcall.sh 脚本可以直接访问到它
  15. ============= node101.yinzhengjie.org.cn : ln -s /yinzhengjie/softwares/jdk/bin/jps /usr/local/bin/ ============
  16. 命令执行成功
  17. ============= node102.yinzhengjie.org.cn : ln -s /yinzhengjie/softwares/jdk/bin/jps /usr/local/bin/ ============
  18. 命令执行成功
  19. ============= node103.yinzhengjie.org.cn : ln -s /yinzhengjie/softwares/jdk/bin/jps /usr/local/bin/ ============
  20. 命令执行成功
  21. [root@node101 java]#
  22. [root@node101 java]# xcall.sh jps                                                #说明java环境配置成功啦~
  23. ============= node101.yinzhengjie.org.cn : jps ============
  24. Jps
  25. 命令执行成功
  26. ============= node102.yinzhengjie.org.cn : jps ============
  27. Jps
  28. 命令执行成功
  29. ============= node103.yinzhengjie.org.cn : jps ============
  30. Jps
  31. 命令执行成功
  32. [root@node101 java]#

5>.关闭防火墙和selinux

  1. [root@node101 java]# xcall.sh systemctl stop firewalld
  2. ============= node101.yinzhengjie.org.cn : systemctl stop firewalld ============
  3. 命令执行成功
  4. ============= node102.yinzhengjie.org.cn : systemctl stop firewalld ============
  5. 命令执行成功
  6. ============= node103.yinzhengjie.org.cn : systemctl stop firewalld ============
  7. 命令执行成功
  8. [root@node101 java]#

[root@node101 java]# xcall.sh systemctl stop firewalld                              #关闭防火墙

  1. [root@node101 java]# xcall.sh systemctl disable firewalld
  2. ============= node101.yinzhengjie.org.cn : systemctl disable firewalld ============
  3. Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
  4. Removed symlink /etc/systemd/system/basic.target.wants/firewalld.service.
  5. 命令执行成功
  6. ============= node102.yinzhengjie.org.cn : systemctl disable firewalld ============
  7. Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
  8. Removed symlink /etc/systemd/system/basic.target.wants/firewalld.service.
  9. 命令执行成功
  10. ============= node103.yinzhengjie.org.cn : systemctl disable firewalld ============
  11. Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
  12. Removed symlink /etc/systemd/system/basic.target.wants/firewalld.service.
  13. 命令执行成功
  14. [root@node101 java]#

[root@node101 java]# xcall.sh systemctl disable firewalld                            #禁用防火墙,防止他开机自启动

  1. [root@node101 java]# xcall.sh systemctl status firewalld
  2. ============= node101.yinzhengjie.org.cn : systemctl status firewalld ============
  3. firewalld.service - firewalld - dynamic firewall daemon
  4. Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
  5. Active: inactive (dead)
  6.  
  7. Dec :: node101.yinzhengjie.org.cn systemd[]: Starting firewalld - dynamic firewall daemon...
  8. Dec :: node101.yinzhengjie.org.cn systemd[]: Started firewalld - dynamic firewall daemon.
  9. Dec :: node101.yinzhengjie.org.cn systemd[]: Stopping firewalld - dynamic firewall daemon...
  10. Dec :: node101.yinzhengjie.org.cn systemd[]: Stopped firewalld - dynamic firewall daemon.
  11. ============= node102.yinzhengjie.org.cn : systemctl status firewalld ============
  12. firewalld.service - firewalld - dynamic firewall daemon
  13. Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
  14. Active: inactive (dead)
  15.  
  16. Dec :: nod102.yinzhengjie.org.cn systemd[]: Starting firewalld - dynamic firewall daemon...
  17. Dec :: nod102.yinzhengjie.org.cn systemd[]: Started firewalld - dynamic firewall daemon.
  18. Dec :: nod102.yinzhengjie.org.cn systemd[]: Stopping firewalld - dynamic firewall daemon...
  19. Dec :: nod102.yinzhengjie.org.cn systemd[]: Stopped firewalld - dynamic firewall daemon.
  20. ============= node103.yinzhengjie.org.cn : systemctl status firewalld ============
  21. firewalld.service - firewalld - dynamic firewall daemon
  22. Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
  23. Active: inactive (dead)
  24.  
  25. Dec :: node103.yinzhengjie.org.cn systemd[]: Starting firewalld - dynamic firewall daemon...
  26. Dec :: node103.yinzhengjie.org.cn systemd[]: Started firewalld - dynamic firewall daemon.
  27. Dec :: node103.yinzhengjie.org.cn systemd[]: Stopping firewalld - dynamic firewall daemon...
  28. Dec :: node103.yinzhengjie.org.cn systemd[]: Stopped firewalld - dynamic firewall daemon.
  29. [root@node101 java]#
  30. [root@node101 java]#
  31. [root@node101 java]#

[root@node101 java]# xcall.sh systemctl status firewalld                             #查看防火墙状态

  1. [root@node101 ~]# xcall.sh sed -i 's#SELINUX=enforcing#SELINUX=disabled#' /etc/selinux/config
  2. ============= node101.yinzhengjie.org.cn : sed -i s#SELINUX=enforcing#SELINUX=disabled# /etc/selinux/config ============
  3. 命令执行成功
  4. ============= node102.yinzhengjie.org.cn : sed -i s#SELINUX=enforcing#SELINUX=disabled# /etc/selinux/config ============
  5. 命令执行成功
  6. ============= node103.yinzhengjie.org.cn : sed -i s#SELINUX=enforcing#SELINUX=disabled# /etc/selinux/config ============
  7. 命令执行成功
  8. [root@node101 ~]#
  9. [root@node101 ~]#
  10. [root@node101 ~]# xcall.sh cat /etc/selinux/config | grep SELINUX= | grep -v ^#
  11. SELINUX=disabled
  12. SELINUX=disabled
  13. SELINUX=disabled
  14. [root@node101 ~]#

[root@node101 ~]# xcall.sh sed -i 's#SELINUX=enforcing#SELINUX=disabled#' /etc/selinux/config      #禁用selinux,防止它开机自启动,这样修改需要重启操作系统方能生效哦!

  1. [root@node101 ~]# xcall.sh getenforce
  2. ============= node101.yinzhengjie.org.cn : getenforce ============
  3. Enforcing
  4. 命令执行成功
  5. ============= node102.yinzhengjie.org.cn : getenforce ============
  6. Enforcing
  7. 命令执行成功
  8. ============= node103.yinzhengjie.org.cn : getenforce ============
  9. Enforcing
  10. 命令执行成功
  11. [root@node101 ~]#
  12. [root@node101 ~]#
  13. [root@node101 ~]# xcall.sh setenforce
  14. ============= node101.yinzhengjie.org.cn : setenforce ============
  15. 命令执行成功
  16. ============= node102.yinzhengjie.org.cn : setenforce ============
  17. 命令执行成功
  18. ============= node103.yinzhengjie.org.cn : setenforce ============
  19. 命令执行成功
  20. [root@node101 ~]#
  21. [root@node101 ~]# xcall.sh getenforce
  22. ============= node101.yinzhengjie.org.cn : getenforce ============
  23. Permissive
  24. 命令执行成功
  25. ============= node102.yinzhengjie.org.cn : getenforce ============
  26. Permissive
  27. 命令执行成功
  28. ============= node103.yinzhengjie.org.cn : getenforce ============
  29. Permissive
  30. 命令执行成功
  31. [root@node101 ~]#

[root@node101 ~]# xcall.sh setenforce 0                                        #临时关闭selinux,立即生效!

6>.配置ntpd服务器并配置开机自启动

  1. [root@node101 ~]# xcall.sh yum -y install ntp
  2. ============= node101.yinzhengjie.org.cn : yum -y install ntp ============
  3. Loaded plugins: fastestmirror
  4. Loading mirror speeds from cached hostfile
  5. * base: mirrors.huaweicloud.com
  6. * extras: mirrors.huaweicloud.com
  7. * updates: mirrors..com
  8. Resolving Dependencies
  9. --> Running transaction check
  10. ---> Package ntp.x86_64 :4.2.6p5-.el7.centos will be installed
  11. --> Processing Dependency: ntpdate = 4.2.6p5-.el7.centos for package: ntp-4.2.6p5-.el7.centos.x86_64
  12. --> Processing Dependency: libcrypto.so.(OPENSSL_1.0.2)(64bit) for package: ntp-4.2.6p5-.el7.centos.x86_64
  13. --> Processing Dependency: libopts.so.()(64bit) for package: ntp-4.2.6p5-.el7.centos.x86_64
  14. --> Running transaction check
  15. ---> Package autogen-libopts.x86_64 :5.18-.el7 will be installed
  16. ---> Package ntpdate.x86_64 :4.2.6p5-.el7.centos will be installed
  17. ---> Package openssl-libs.x86_64 :1.0.1e-.el7. will be updated
  18. --> Processing Dependency: openssl-libs(x86-) = :1.0.1e-.el7. for package: :openssl-1.0.1e-.el7..x86_64
  19. ---> Package openssl-libs.x86_64 :1.0.2k-.el7 will be an update
  20. --> Running transaction check
  21. ---> Package openssl.x86_64 :1.0.1e-.el7. will be updated
  22. ---> Package openssl.x86_64 :1.0.2k-.el7 will be an update
  23. --> Finished Dependency Resolution
  24.  
  25. Dependencies Resolved
  26.  
  27. ================================================================================
  28. Package Arch Version Repository
  29. Size
  30. ================================================================================
  31. Installing:
  32. ntp x86_64 4.2.6p5-.el7.centos base k
  33. Installing for dependencies:
  34. autogen-libopts x86_64 5.18-.el7 base k
  35. ntpdate x86_64 4.2.6p5-.el7.centos base k
  36. Updating for dependencies:
  37. openssl x86_64 :1.0.2k-.el7 base k
  38. openssl-libs x86_64 :1.0.2k-.el7 base 1.2 M
  39.  
  40. Transaction Summary
  41. ================================================================================
  42. Install Package (+ Dependent packages)
  43. Upgrade ( Dependent packages)
  44.  
  45. Total download size: 2.4 M
  46. Downloading packages:
  47. Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
  48. --------------------------------------------------------------------------------
  49. Total kB/s | 2.4 MB :
  50. Running transaction check
  51. Running transaction test
  52. Transaction test succeeded
  53. Running transaction
  54. Updating : :openssl-libs-1.0.2k-.el7.x86_64 /
  55. Installing : ntpdate-4.2.6p5-.el7.centos.x86_64 /
  56. Installing : autogen-libopts-5.18-.el7.x86_64 /
  57. Installing : ntp-4.2.6p5-.el7.centos.x86_64 /
  58. Updating : :openssl-1.0.2k-.el7.x86_64 /
  59. Cleanup : :openssl-1.0.1e-.el7..x86_64 /
  60. Cleanup : :openssl-libs-1.0.1e-.el7..x86_64 /
  61. Verifying : :openssl-libs-1.0.2k-.el7.x86_64 /
  62. Verifying : ntpdate-4.2.6p5-.el7.centos.x86_64 /
  63. Verifying : ntp-4.2.6p5-.el7.centos.x86_64 /
  64. Verifying : autogen-libopts-5.18-.el7.x86_64 /
  65. Verifying : :openssl-1.0.2k-.el7.x86_64 /
  66. Verifying : :openssl-libs-1.0.1e-.el7..x86_64 /
  67. Verifying : :openssl-1.0.1e-.el7..x86_64 /
  68.  
  69. Installed:
  70. ntp.x86_64 :4.2.6p5-.el7.centos
  71.  
  72. Dependency Installed:
  73. autogen-libopts.x86_64 :5.18-.el7 ntpdate.x86_64 :4.2.6p5-.el7.centos
  74.  
  75. Dependency Updated:
  76. openssl.x86_64 :1.0.2k-.el7 openssl-libs.x86_64 :1.0.2k-.el7
  77.  
  78. Complete!
  79. 命令执行成功
  80. ============= node102.yinzhengjie.org.cn : yum -y install ntp ============
  81. Loaded plugins: fastestmirror
  82. Loading mirror speeds from cached hostfile
  83. * base: mirrors.huaweicloud.com
  84. * extras: mirrors.huaweicloud.com
  85. * updates: mirrors.neusoft.edu.cn
  86. Resolving Dependencies
  87. --> Running transaction check
  88. ---> Package ntp.x86_64 :4.2.6p5-.el7.centos will be installed
  89. --> Processing Dependency: ntpdate = 4.2.6p5-.el7.centos for package: ntp-4.2.6p5-.el7.centos.x86_64
  90. --> Processing Dependency: libcrypto.so.(OPENSSL_1.0.2)(64bit) for package: ntp-4.2.6p5-.el7.centos.x86_64
  91. --> Processing Dependency: libopts.so.()(64bit) for package: ntp-4.2.6p5-.el7.centos.x86_64
  92. --> Running transaction check
  93. ---> Package autogen-libopts.x86_64 :5.18-.el7 will be installed
  94. ---> Package ntpdate.x86_64 :4.2.6p5-.el7.centos will be installed
  95. ---> Package openssl-libs.x86_64 :1.0.1e-.el7. will be updated
  96. --> Processing Dependency: openssl-libs(x86-) = :1.0.1e-.el7. for package: :openssl-1.0.1e-.el7..x86_64
  97. ---> Package openssl-libs.x86_64 :1.0.2k-.el7 will be an update
  98. --> Running transaction check
  99. ---> Package openssl.x86_64 :1.0.1e-.el7. will be updated
  100. ---> Package openssl.x86_64 :1.0.2k-.el7 will be an update
  101. --> Finished Dependency Resolution
  102.  
  103. Dependencies Resolved
  104.  
  105. ================================================================================
  106. Package Arch Version Repository
  107. Size
  108. ================================================================================
  109. Installing:
  110. ntp x86_64 4.2.6p5-.el7.centos base k
  111. Installing for dependencies:
  112. autogen-libopts x86_64 5.18-.el7 base k
  113. ntpdate x86_64 4.2.6p5-.el7.centos base k
  114. Updating for dependencies:
  115. openssl x86_64 :1.0.2k-.el7 base k
  116. openssl-libs x86_64 :1.0.2k-.el7 base 1.2 M
  117.  
  118. Transaction Summary
  119. ================================================================================
  120. Install Package (+ Dependent packages)
  121. Upgrade ( Dependent packages)
  122.  
  123. Total download size: 2.4 M
  124. Downloading packages:
  125. Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
  126. --------------------------------------------------------------------------------
  127. Total kB/s | 2.4 MB :
  128. Running transaction check
  129. Running transaction test
  130. Transaction test succeeded
  131. Running transaction
  132. Updating : :openssl-libs-1.0.2k-.el7.x86_64 /
  133. Installing : ntpdate-4.2.6p5-.el7.centos.x86_64 /
  134. Installing : autogen-libopts-5.18-.el7.x86_64 /
  135. Installing : ntp-4.2.6p5-.el7.centos.x86_64 /
  136. Updating : :openssl-1.0.2k-.el7.x86_64 /
  137. Cleanup : :openssl-1.0.1e-.el7..x86_64 /
  138. Cleanup : :openssl-libs-1.0.1e-.el7..x86_64 /
  139. Verifying : :openssl-libs-1.0.2k-.el7.x86_64 /
  140. Verifying : ntpdate-4.2.6p5-.el7.centos.x86_64 /
  141. Verifying : ntp-4.2.6p5-.el7.centos.x86_64 /
  142. Verifying : autogen-libopts-5.18-.el7.x86_64 /
  143. Verifying : :openssl-1.0.2k-.el7.x86_64 /
  144. Verifying : :openssl-libs-1.0.1e-.el7..x86_64 /
  145. Verifying : :openssl-1.0.1e-.el7..x86_64 /
  146.  
  147. Installed:
  148. ntp.x86_64 :4.2.6p5-.el7.centos
  149.  
  150. Dependency Installed:
  151. autogen-libopts.x86_64 :5.18-.el7 ntpdate.x86_64 :4.2.6p5-.el7.centos
  152.  
  153. Dependency Updated:
  154. openssl.x86_64 :1.0.2k-.el7 openssl-libs.x86_64 :1.0.2k-.el7
  155.  
  156. Complete!
  157. 命令执行成功
  158. ============= node103.yinzhengjie.org.cn : yum -y install ntp ============
  159. Loaded plugins: fastestmirror
  160. Loading mirror speeds from cached hostfile
  161. * base: mirrors.huaweicloud.com
  162. * extras: mirrors.huaweicloud.com
  163. * updates: mirrors.cn99.com
  164. Resolving Dependencies
  165. --> Running transaction check
  166. ---> Package ntp.x86_64 :4.2.6p5-.el7.centos will be installed
  167. --> Processing Dependency: ntpdate = 4.2.6p5-.el7.centos for package: ntp-4.2.6p5-.el7.centos.x86_64
  168. --> Processing Dependency: libcrypto.so.(OPENSSL_1.0.2)(64bit) for package: ntp-4.2.6p5-.el7.centos.x86_64
  169. --> Processing Dependency: libopts.so.()(64bit) for package: ntp-4.2.6p5-.el7.centos.x86_64
  170. --> Running transaction check
  171. ---> Package autogen-libopts.x86_64 :5.18-.el7 will be installed
  172. ---> Package ntpdate.x86_64 :4.2.6p5-.el7.centos will be installed
  173. ---> Package openssl-libs.x86_64 :1.0.1e-.el7. will be updated
  174. --> Processing Dependency: openssl-libs(x86-) = :1.0.1e-.el7. for package: :openssl-1.0.1e-.el7..x86_64
  175. ---> Package openssl-libs.x86_64 :1.0.2k-.el7 will be an update
  176. --> Running transaction check
  177. ---> Package openssl.x86_64 :1.0.1e-.el7. will be updated
  178. ---> Package openssl.x86_64 :1.0.2k-.el7 will be an update
  179. --> Finished Dependency Resolution
  180.  
  181. Dependencies Resolved
  182.  
  183. ================================================================================
  184. Package Arch Version Repository
  185. Size
  186. ================================================================================
  187. Installing:
  188. ntp x86_64 4.2.6p5-.el7.centos base k
  189. Installing for dependencies:
  190. autogen-libopts x86_64 5.18-.el7 base k
  191. ntpdate x86_64 4.2.6p5-.el7.centos base k
  192. Updating for dependencies:
  193. openssl x86_64 :1.0.2k-.el7 base k
  194. openssl-libs x86_64 :1.0.2k-.el7 base 1.2 M
  195.  
  196. Transaction Summary
  197. ================================================================================
  198. Install Package (+ Dependent packages)
  199. Upgrade ( Dependent packages)
  200.  
  201. Total download size: 2.4 M
  202. Downloading packages:
  203. Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
  204. --------------------------------------------------------------------------------
  205. Total kB/s | 2.4 MB :
  206. Running transaction check
  207. Running transaction test
  208. Transaction test succeeded
  209. Running transaction
  210. Updating : :openssl-libs-1.0.2k-.el7.x86_64 /
  211. Installing : ntpdate-4.2.6p5-.el7.centos.x86_64 /
  212. Installing : autogen-libopts-5.18-.el7.x86_64 /
  213. Installing : ntp-4.2.6p5-.el7.centos.x86_64 /
  214. Updating : :openssl-1.0.2k-.el7.x86_64 /
  215. Cleanup : :openssl-1.0.1e-.el7..x86_64 /
  216. Cleanup : :openssl-libs-1.0.1e-.el7..x86_64 /
  217. Verifying : :openssl-libs-1.0.2k-.el7.x86_64 /
  218. Verifying : ntpdate-4.2.6p5-.el7.centos.x86_64 /
  219. Verifying : ntp-4.2.6p5-.el7.centos.x86_64 /
  220. Verifying : autogen-libopts-5.18-.el7.x86_64 /
  221. Verifying : :openssl-1.0.2k-.el7.x86_64 /
  222. Verifying : :openssl-libs-1.0.1e-.el7..x86_64 /
  223. Verifying : :openssl-1.0.1e-.el7..x86_64 /
  224.  
  225. Installed:
  226. ntp.x86_64 :4.2.6p5-.el7.centos
  227.  
  228. Dependency Installed:
  229. autogen-libopts.x86_64 :5.18-.el7 ntpdate.x86_64 :4.2.6p5-.el7.centos
  230.  
  231. Dependency Updated:
  232. openssl.x86_64 :1.0.2k-.el7 openssl-libs.x86_64 :1.0.2k-.el7
  233.  
  234. Complete!
  235. 命令执行成功
  236. [root@node101 ~]#

[root@node101 ~]# xcall.sh yum -y install ntp            #各个节点安装ntp服务

  如果你的内网有ntpd服务器的话直接修改每台服务器的“/etc/ntp.conf”配置文件即可,将ntpd服务器的IP地址写进去。如果没有话,那就自己部署一个即可,详情请参考:https://www.cnblogs.com/yinzhengjie/p/9480665.html。我这里就是在“node101.yinzhengjie.org.cn”主机上部署了ntp服务器,并修改了以下参数:

  然后在“node102.yinzhengjie.org.cn”和“node103.yinzhengjie.org.cn”这2台主机上配置了周期性的计划任务:

  1. [root@node101 ~]# systemctl start ntpd
  2. [root@node101 ~]#
  3. [root@node101 ~]# systemctl enable ntpd
  4. Created symlink from /etc/systemd/system/multi-user.target.wants/ntpd.service to /usr/lib/systemd/system/ntpd.service.
  5. [root@node101 ~]#
  6. [root@node101 ~]# systemctl status ntpd
  7. ntpd.service - Network Time Service
  8. Loaded: loaded (/usr/lib/systemd/system/ntpd.service; enabled; vendor preset: disabled)
  9. Active: active (running) since Wed -- :: EST; 12s ago
  10. Main PID: (ntpd)
  11. CGroup: /system.slice/ntpd.service
  12. └─ /usr/sbin/ntpd -u ntp:ntp -g
  13.  
  14. Dec :: node101.yinzhengjie.org.cn ntpd[]: Listen normally on lo 127.0.0.1 UDP
  15. Dec :: node101.yinzhengjie.org.cn ntpd[]: Listen normally on eth0 172.30.1.101 UDP
  16. Dec :: node101.yinzhengjie.org.cn ntpd[]: Listen normally on lo :: UDP
  17. Dec :: node101.yinzhengjie.org.cn ntpd[]: Listen normally on eth0 fe80::21c:42ff:fe58:1b11 UDP
  18. Dec :: node101.yinzhengjie.org.cn ntpd[]: Listening on routing socket on fd # for interface updates
  19. Dec :: node101.yinzhengjie.org.cn ntpd[]: 0.0.0.0 c016 restart
  20. Dec :: node101.yinzhengjie.org.cn ntpd[]: 0.0.0.0 c012 freq_set kernel 0.000 PPM
  21. Dec :: node101.yinzhengjie.org.cn ntpd[]: 0.0.0.0 c011 freq_not_set
  22. Dec :: node101.yinzhengjie.org.cn systemd[]: Started Network Time Service.
  23. Dec :: node101.yinzhengjie.org.cn ntpd[]: 0.0.0.0 c514 freq_mode
  24. [root@node101 ~]#

[root@node101 ~]# systemctl start ntpd                      #在node101.yinzhengjie.org.cn启动ntpd服务

  1. [root@node101 ~]# xcall.sh crontab -l
  2. ============= node101.yinzhengjie.org.cn : crontab -l ============
  3. no crontab for root
  4. ============= node102.yinzhengjie.org.cn : crontab -l ============
  5. */ * * * * /usr/sbin/ntpdate node101.yinzhengjie.org.cn
  6. 命令执行成功
  7. ============= node103.yinzhengjie.org.cn : crontab -l ============
  8. */ * * * * /usr/sbin/ntpdate node101.yinzhengjie.org.cn
  9. 命令执行成功
  10. [root@node101 ~]#

四.搭建本地yum源仓库(实现离线安装

  安装Ambari系统本身以及通过Ambari安装HDP发行版中的Hadoop服务都需要通过yum的方式进行安装。由于本片博客场景定位的是企业级应用,而企业内部的服务器处于安全考虑通常会通过防火墙隔绝外网环境。就算服务器可以直接联网,HDP那么多达到数G的安装包大小也不适合通过互联网直接安装。所以需要在局域网搭建一套Ambari和HDP的本地yum源仓库用于进行安装。本篇博客将会安装Ambari2.6.0以及对应的HDP2.6.3.0版本。

1>.下载离线安装包(Hortonworks官网文档怎么找?)

  1. [root@node101 ~]# yum -y install wget
  2. Loaded plugins: fastestmirror
  3. Loading mirror speeds from cached hostfile
  4. * base: mirrors.huaweicloud.com
  5. * extras: mirrors.huaweicloud.com
  6. * updates: mirrors..com
  7. Resolving Dependencies
  8. --> Running transaction check
  9. ---> Package wget.x86_64 :1.14-.el7 will be installed
  10. --> Finished Dependency Resolution
  11.  
  12. Dependencies Resolved
  13.  
  14. ===================================================================================================================================================================================
  15. Package Arch Version Repository Size
  16. ===================================================================================================================================================================================
  17. Installing:
  18. wget x86_64 1.14-.el7 base k
  19.  
  20. Transaction Summary
  21. ===================================================================================================================================================================================
  22. Install Package
  23.  
  24. Total download size: k
  25. Installed size: 2.0 M
  26. Downloading packages:
  27. wget-1.14-.el7.x86_64.rpm | kB ::
  28. Running transaction check
  29. Running transaction test
  30. Transaction test succeeded
  31. Running transaction
  32. Installing : wget-1.14-.el7.x86_64 /
  33. Verifying : wget-1.14-.el7.x86_64 /
  34.  
  35. Installed:
  36. wget.x86_64 :1.14-.el7
  37.  
  38. Complete!
  39. [root@node101 ~]#

[root@node101 ~]# yum -y install wget                  #安装下载工具包

  1. [root@yinzhengjie hdp]# 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
  2. ---- ::-- http://public-repo-1.hortonworks.com/HDP/centos7/2.x/updates/2.6.3.0/HDP-2.6.3.0-centos7-rpm.tar.gz
  3. Resolving public-repo-.hortonworks.com (public-repo-.hortonworks.com)... 52.85.158.49, 52.85.158.71, 52.85.158.182, ...
  4. Connecting to public-repo-.hortonworks.com (public-repo-.hortonworks.com)|52.85.158.49|:... connected.
  5. HTTP request sent, awaiting response... OK
  6. Length: (.5G) [application/x-tar]
  7. Saving to: HDP-2.6.3.0-centos7-rpm.tar.gz
  8.  
  9. %[=======================================================================================================================================>] ,,, .84MB/s in 17m 11s
  10.  
  11. -- :: (6.49 MB/s) - HDP-2.6.3.0-centos7-rpm.tar.gz saved [/]
  12.  
  13. [root@yinzhengjie hdp]#
  14. [root@yinzhengjie hdp]# ll
  15. total
  16. -rw-r--r-- root root Oct HDP-2.6.3.0-centos7-rpm.tar.gz
  17. [root@yinzhengjie hdp]#

[root@yinzhengjie hdp]# 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          #下载HDP,大约6.5G

  1. [root@yinzhengjie hdp]# wget http://public-repo-1.hortonworks.com/ambari/centos7/2.x/updates/2.6.0.0/ambari-2.6.0.0-centos7.tar.gz
  2. ---- ::-- http://public-repo-1.hortonworks.com/ambari/centos7/2.x/updates/2.6.0.0/ambari-2.6.0.0-centos7.tar.gz
  3. Resolving public-repo-.hortonworks.com (public-repo-.hortonworks.com)... 52.85.158.117, 52.85.158.49, 52.85.158.71, ...
  4. Connecting to public-repo-.hortonworks.com (public-repo-.hortonworks.com)|52.85.158.117|:... connected.
  5. HTTP request sent, awaiting response... OK
  6. Length: (.6G) [application/x-tar]
  7. Saving to: ambari-2.6.0.0-centos7.tar.gz
  8.  
  9. %[=======================================================================================================================================>] ,,, .44MB/s in 4m 26s
  10.  
  11. -- :: (6.31 MB/s) - ambari-2.6.0.0-centos7.tar.gz saved [/]
  12.  
  13. [root@yinzhengjie hdp]#
  14. [root@yinzhengjie hdp]# ll
  15. total
  16. -rw-r--r-- root root Oct ambari-2.6.0.0-centos7.tar.gz
  17. -rw-r--r-- root root Oct HDP-2.6.3.0-centos7-rpm.tar.gz
  18. [root@yinzhengjie hdp]#
  19. [root@yinzhengjie hdp]#

[root@yinzhengjie hdp]# wget http://public-repo-1.hortonworks.com/ambari/centos7/2.x/updates/2.6.0.0/ambari-2.6.0.0-centos7.tar.gz         #下载Ambari,大约1.6G

  1. [root@yinzhengjie hdp]# wget http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.21/repos/centos7/HDP-UTILS-1.1.0.21-centos7.tar.gz
  2. ---- ::-- http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.21/repos/centos7/HDP-UTILS-1.1.0.21-centos7.tar.gz
  3. Resolving public-repo-.hortonworks.com (public-repo-.hortonworks.com)... 52.85.158.117, 52.85.158.49, 52.85.158.71, ...
  4. Connecting to public-repo-.hortonworks.com (public-repo-.hortonworks.com)|52.85.158.117|:... connected.
  5. HTTP request sent, awaiting response... OK
  6. Length: (839M) [application/x-tar]
  7. Saving to: HDP-UTILS-1.1.0.21-centos7.tar.gz
  8.  
  9. %[=========================================================================================================================================>] ,, .67MB/s in 2m 7s
  10.  
  11. -- :: (6.60 MB/s) - HDP-UTILS-1.1.0.21-centos7.tar.gz saved [/]
  12.  
  13. [root@yinzhengjie hdp]#
  14. [root@yinzhengjie hdp]# ll
  15. total
  16. -rw-r--r-- root root Oct ambari-2.6.0.0-centos7.tar.gz
  17. -rw-r--r-- root root Oct HDP-2.6.3.0-centos7-rpm.tar.gz
  18. -rw-r--r-- root root Oct HDP-UTILS-1.1.0.21-centos7.tar.gz
  19. [root@yinzhengjie hdp]#

[root@yinzhengjie hdp]# wget http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.21/repos/centos7/HDP-UTILS-1.1.0.21-centos7.tar.gz        #下载HDP-UTILS,大约839M左右

  大家可以直接在服务端跟我一样使用wget工具下载,如果网速不好端朋友,可以直接用我已经下载好端软件,我这里给出百度云链接:

2>.安装WEB服务器

  这里我们可以使用Apache来当作HTTP服务器。当然你也可以用Nginx,由于CentOS的yum源默认就支持可以安装httpd服务,因此我就偷个懒就直接用httpd吧。

  1. [root@node101 ~]# yum -y install httpd
  2. Loaded plugins: fastestmirror
  3. Loading mirror speeds from cached hostfile
  4. * base: mirrors.huaweicloud.com
  5. * extras: mirrors.huaweicloud.com
  6. * updates: mirrors..com
  7. Resolving Dependencies
  8. --> Running transaction check
  9. ---> Package httpd.x86_64 :2.4.-.el7.centos will be installed
  10. --> Processing Dependency: httpd-tools = 2.4.-.el7.centos for package: httpd-2.4.-.el7.centos.x86_64
  11. --> Processing Dependency: /etc/mime.types for package: httpd-2.4.-.el7.centos.x86_64
  12. --> Processing Dependency: libaprutil-.so.()(64bit) for package: httpd-2.4.-.el7.centos.x86_64
  13. --> Processing Dependency: libapr-.so.()(64bit) for package: httpd-2.4.-.el7.centos.x86_64
  14. --> Running transaction check
  15. ---> Package apr.x86_64 :1.4.-.el7_4. will be installed
  16. ---> Package apr-util.x86_64 :1.5.-.el7 will be installed
  17. ---> Package httpd-tools.x86_64 :2.4.-.el7.centos will be installed
  18. ---> Package mailcap.noarch :2.1.-.el7 will be installed
  19. --> Finished Dependency Resolution
  20.  
  21. Dependencies Resolved
  22.  
  23. ===================================================================================================================================================================================
  24. Package Arch Version Repository Size
  25. ===================================================================================================================================================================================
  26. Installing:
  27. httpd x86_64 2.4.-.el7.centos base 2.7 M
  28. Installing for dependencies:
  29. apr x86_64 1.4.-.el7_4. base k
  30. apr-util x86_64 1.5.-.el7 base k
  31. httpd-tools x86_64 2.4.-.el7.centos base k
  32. mailcap noarch 2.1.-.el7 base k
  33.  
  34. Transaction Summary
  35. ===================================================================================================================================================================================
  36. Install Package (+ Dependent packages)
  37.  
  38. Total download size: 3.0 M
  39. Installed size: M
  40. Downloading packages:
  41. (/): httpd-tools-2.4.-.el7.centos.x86_64.rpm | kB ::
  42. (/): mailcap-2.1.-.el7.noarch.rpm | kB ::
  43. (/): apr-1.4.-.el7_4..x86_64.rpm | kB ::
  44. (/): httpd-2.4.-.el7.centos.x86_64.rpm | 2.7 MB ::
  45. (/): apr-util-1.5.-.el7.x86_64.rpm | kB ::
  46. -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  47. Total kB/s | 3.0 MB ::
  48. Running transaction check
  49. Running transaction test
  50. Transaction test succeeded
  51. Running transaction
  52. Installing : apr-1.4.-.el7_4..x86_64 /
  53. Installing : apr-util-1.5.-.el7.x86_64 /
  54. Installing : httpd-tools-2.4.-.el7.centos.x86_64 /
  55. Installing : mailcap-2.1.-.el7.noarch /
  56. Installing : httpd-2.4.-.el7.centos.x86_64 /
  57. Verifying : httpd-tools-2.4.-.el7.centos.x86_64 /
  58. Verifying : apr-1.4.-.el7_4..x86_64 /
  59. Verifying : mailcap-2.1.-.el7.noarch /
  60. Verifying : httpd-2.4.-.el7.centos.x86_64 /
  61. Verifying : apr-util-1.5.-.el7.x86_64 /
  62.  
  63. Installed:
  64. httpd.x86_64 :2.4.-.el7.centos
  65.  
  66. Dependency Installed:
  67. apr.x86_64 :1.4.-.el7_4. apr-util.x86_64 :1.5.-.el7 httpd-tools.x86_64 :2.4.-.el7.centos mailcap.noarch :2.1.-.el7
  68.  
  69. Complete!
  70. [root@node101 ~]#

[root@node101 ~]# yum -y install httpd                    #通过yum的方式安装httpd服务

  1. [root@node101 ~]# systemctl start httpd                    #启动httpd服务
  2. [root@node101 ~]#
  3. [root@node101 ~]# systemctl enable httpd                   #配置httpd为开机自启动服务
  4. Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.
  5. [root@node101 ~]#
  6. [root@node101 ~]# systemctl status httpd                    #查看httpd的状态
  7. httpd.service - The Apache HTTP Server
  8. Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
  9. Active: active (running) since Wed -- :: CST; 12s ago
  10. Docs: man:httpd()
  11. man:apachectl()
  12. Main PID: (httpd)
  13. Status: "Total requests: 0; Current requests/sec: 0; Current traffic: 0 B/sec"
  14. CGroup: /system.slice/httpd.service
  15. ├─ /usr/sbin/httpd -DFOREGROUND
  16. ├─ /usr/sbin/httpd -DFOREGROUND
  17. ├─ /usr/sbin/httpd -DFOREGROUND
  18. ├─ /usr/sbin/httpd -DFOREGROUND
  19. ├─ /usr/sbin/httpd -DFOREGROUND
  20. └─ /usr/sbin/httpd -DFOREGROUND
  21.  
  22. Dec :: node101.yinzhengjie.org.cn systemd[]: Starting The Apache HTTP Server...
  23. Dec :: node101.yinzhengjie.org.cn systemd[]: Started The Apache HTTP Server.
  24. [root@node101 ~]#

[root@node101 ~]# systemctl start httpd                    #启动httpd服务

  1. [root@node101 ~]# mkdir -pv /var/www/html/ambari/HDP-UTILS                  #在这里我们在Apache的默认根目录创建对应的目录,便于存放加压后的数据文件。
  2. mkdir: created directory ‘/var/www/html/ambari
  3. mkdir: created directory ‘/var/www/html/ambari/HDP-UTILS
  4. [root@node101 ~]#
  5. [root@node101 ~]# ll /var/www/html/
  6. total
  7. drwxr-xr-x root root Dec : ambari
  8. [root@node101 ~]#
  9. [root@node101 ~]# ll /var/www/html/ambari/
  10. total
  11. drwxr-xr-x root root Dec : HDP-UTILS
  12. [root@node101 ~]#
  13. [root@node101 ~]# ll /var/www/html/ambari/HDP-UTILS/
  14. total
  15. [root@node101 ~]#
  16. [root@node101 ~]# ll                                          #这是我已经下载好的软件包,我们将其解压到web服务器的指定目录中
  17. total
  18. -rwxrwxrwx. root root Dec : ambari-2.6.0.0-centos7.tar.gz
  19. -rwxr-xr-x. root root Dec : HDP-2.6.3.0-centos7-rpm.tar.gz
  20. -rwxr-xr-x. root root Dec : HDP-UTILS-1.1.0.21-centos7.tar.gz
  21. -rw-r--r--. root root Dec : jdk-8u191-linux-x64.tar.gz
  22. [root@node101 ~]#
  23. [root@node101 ~]#
  24. [root@node101 ~]# tar -zxf ambari-2.6.0.0-centos7.tar.gz -C /var/www/html/ambari/    #我们将ambari的安装包解压到指定的目录,然后客户端可以去对应的目录访问相应的数据。加压后会生成一个ambari的目录,下面解压的文件是相同的道理。
  25. [root@node101 ~]#
  26. [root@node101 ~]#
  27. [root@node101 ~]# ll /var/www/html/ambari/
  28. total
  29. drwxr-xr-x. root root Dec : ambari
  30. drwxr-xr-x. root root Dec : HDP-UTILS
  31. [root@node101 ~]#
  32. [root@node101 ~]#
  33. [root@node101 ~]# tar -zxf HDP-2.6.3.0-centos7-rpm.tar.gz -C /var/www/html/ambari/        #解压后会在对应的解压目录中生成一个HDP目录
  34. [root@node101 ~]#
  35. [root@node101 ~]# ll /var/www/html/ambari/
  36. total
  37. drwxr-xr-x. root root Dec : ambari
  38. drwxr-xr-x. users Oct HDP
  39. drwxr-xr-x. root root Dec : HDP-UTILS
  40. [root@node101 ~]#
  41. [root@node101 ~]# ll /var/www/html/ambari/HDP-UTILS/
  42. total
  43. [root@node101 ~]#
  44. [root@node101 ~]# tar -zxf HDP-UTILS-1.1.0.21-centos7.tar.gz -C /var/www/html/ambari/HDP-UTILS/      #加压后在HDP-UTILS目录中会多处很多文件。
  45. [root@node101 ~]#
  46. [root@node101 ~]# ll /var/www/html/ambari/HDP-UTILS/
  47. total
  48. -rw-r--r--. users Jun epel-release--.noarch.rpm
  49. drwxr-xr-x. users Oct extjs
  50. drwxr-xr-x. users Oct fping
  51. drwxr-xr-x. users Oct ganglia
  52. drwxr-xr-x. users Oct hadoop-lzo
  53. -rw-r--r--. users Jun hdp-util.repo
  54. drwxr-xr-x. users Oct jna-source
  55. drwxr-xr-x. users Oct libconfuse
  56. drwxr-xr-x. users Oct lucid
  57. drwxr-xr-x. users Oct lzo
  58. drwxr-xr-x. users Oct mysql
  59. drwxr-xr-x. users Oct mysql-connector-java
  60. drwxr-xr-x. users Oct mysql-connector-java-source
  61. drwxr-xr-x. users Oct nagios
  62. drwxr-xr-x. users Oct nagios-plugins
  63. drwxr-xr-x. users Oct openblas
  64. drwxr-xr-x. users Oct pdsh
  65. drwxr-xr-x. users Oct perl
  66. drwxr-xr-x. users Oct R
  67. drwxr-xr-x. users Oct repodata
  68. drwxr-xr-x. users Oct RPM-GPG-KEY
  69. drwxr-xr-x. users Oct rrdtool
  70. drwxr-xr-x. users Oct snappy
  71. [root@node101 ~]#

  接下来我们也可以访问http://node101.yinzhengjie.org.cn/ambari/:

3>.制作本地源

  1. [root@node101 ~]# yum -y install yum-utils createrepo yum-plugin-priorities
  2. Loaded plugins: fastestmirror
  3. base | 3.6 kB ::
  4. extras | 3.4 kB ::
  5. updates | 3.4 kB ::
  6. Loading mirror speeds from cached hostfile
  7. * base: mirrors.huaweicloud.com
  8. * extras: mirrors.huaweicloud.com
  9. * updates: mirrors..com
  10. Resolving Dependencies
  11. --> Running transaction check
  12. ---> Package createrepo.noarch :0.9.-.el7 will be installed
  13. --> Processing Dependency: python-deltarpm for package: createrepo-0.9.-.el7.noarch
  14. --> Processing Dependency: libxml2-python for package: createrepo-0.9.-.el7.noarch
  15. --> Processing Dependency: deltarpm for package: createrepo-0.9.-.el7.noarch
  16. ---> Package yum-plugin-priorities.noarch :1.1.-.el7 will be installed
  17. ---> Package yum-utils.noarch :1.1.-.el7 will be installed
  18. --> Processing Dependency: yum >= 3.4.- for package: yum-utils-1.1.-.el7.noarch
  19. --> Processing Dependency: python-kitchen for package: yum-utils-1.1.-.el7.noarch
  20. --> Running transaction check
  21. ---> Package deltarpm.x86_64 :3.6-.el7 will be installed
  22. ---> Package libxml2-python.x86_64 :2.9.-.el7_2. will be installed
  23. --> Processing Dependency: libxml2 = 2.9.-.el7_2. for package: libxml2-python-2.9.-.el7_2..x86_64
  24. ---> Package python-deltarpm.x86_64 :3.6-.el7 will be installed
  25. ---> Package python-kitchen.noarch :1.1.-.el7 will be installed
  26. --> Processing Dependency: python-chardet for package: python-kitchen-1.1.-.el7.noarch
  27. ---> Package yum.noarch :3.4.-.el7.centos.0.1 will be updated
  28. ---> Package yum.noarch :3.4.-.el7.centos will be an update
  29. --> Processing Dependency: rpm >= 4.11.- for package: yum-3.4.-.el7.centos.noarch
  30. --> Processing Dependency: python-urlgrabber >= 3.10- for package: yum-3.4.-.el7.centos.noarch
  31. --> Running transaction check
  32. ---> Package libxml2.x86_64 :2.9.-.el7_1. will be updated
  33. ---> Package libxml2.x86_64 :2.9.-.el7_2. will be an update
  34. ---> Package python-chardet.noarch :2.2.-.el7_1 will be installed
  35. ---> Package python-urlgrabber.noarch :3.10-.el7 will be updated
  36. ---> Package python-urlgrabber.noarch :3.10-.el7 will be an update
  37. ---> Package rpm.x86_64 :4.11.-.el7 will be updated
  38. --> Processing Dependency: rpm = 4.11.-.el7 for package: rpm-libs-4.11.-.el7.x86_64
  39. --> Processing Dependency: rpm = 4.11.-.el7 for package: rpm-python-4.11.-.el7.x86_64
  40. ---> Package rpm.x86_64 :4.11.-.el7 will be an update
  41. --> Running transaction check
  42. ---> Package rpm-libs.x86_64 :4.11.-.el7 will be updated
  43. --> Processing Dependency: rpm-libs(x86-) = 4.11.-.el7 for package: rpm-build-libs-4.11.-.el7.x86_64
  44. ---> Package rpm-libs.x86_64 :4.11.-.el7 will be an update
  45. ---> Package rpm-python.x86_64 :4.11.-.el7 will be updated
  46. ---> Package rpm-python.x86_64 :4.11.-.el7 will be an update
  47. --> Running transaction check
  48. ---> Package rpm-build-libs.x86_64 :4.11.-.el7 will be updated
  49. ---> Package rpm-build-libs.x86_64 :4.11.-.el7 will be an update
  50. --> Finished Dependency Resolution
  51.  
  52. Dependencies Resolved
  53.  
  54. ===================================================================================================================================================================================
  55. Package Arch Version Repository Size
  56. ===================================================================================================================================================================================
  57. Installing:
  58. createrepo noarch 0.9.-.el7 base k
  59. yum-plugin-priorities noarch 1.1.-.el7 base k
  60. yum-utils noarch 1.1.-.el7 base k
  61. Installing for dependencies:
  62. deltarpm x86_64 3.6-.el7 base k
  63. libxml2-python x86_64 2.9.-.el7_2. base k
  64. python-chardet noarch 2.2.-.el7_1 base k
  65. python-deltarpm x86_64 3.6-.el7 base k
  66. python-kitchen noarch 1.1.-.el7 base k
  67. Updating for dependencies:
  68. libxml2 x86_64 2.9.-.el7_2. base k
  69. python-urlgrabber noarch 3.10-.el7 base k
  70. rpm x86_64 4.11.-.el7 base 1.2 M
  71. rpm-build-libs x86_64 4.11.-.el7 base k
  72. rpm-libs x86_64 4.11.-.el7 base k
  73. rpm-python x86_64 4.11.-.el7 base k
  74. yum noarch 3.4.-.el7.centos base 1.2 M
  75.  
  76. Transaction Summary
  77. ===================================================================================================================================================================================
  78. Install Packages (+ Dependent packages)
  79. Upgrade ( Dependent packages)
  80.  
  81. Total download size: 4.7 M
  82. Downloading packages:
  83. Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
  84. (/): libxml2-2.9.-.el7_2..x86_64.rpm | kB ::
  85. (/): python-deltarpm-3.6-.el7.x86_64.rpm | kB ::
  86. (/): deltarpm-3.6-.el7.x86_64.rpm | kB ::
  87. (/): python-kitchen-1.1.-.el7.noarch.rpm | kB ::
  88. (/): python-chardet-2.2.-.el7_1.noarch.rpm | kB ::
  89. (/): python-urlgrabber-3.10-.el7.noarch.rpm | kB ::
  90. (/): rpm-build-libs-4.11.-.el7.x86_64.rpm | kB ::
  91. (/): rpm-4.11.-.el7.x86_64.rpm | 1.2 MB ::
  92. (/): yum-3.4.-.el7.centos.noarch.rpm | 1.2 MB ::
  93. (/): yum-plugin-priorities-1.1.-.el7.noarch.rpm | kB ::
  94. (/): yum-utils-1.1.-.el7.noarch.rpm | kB ::
  95. (/): rpm-libs-4.11.-.el7.x86_64.rpm | kB ::
  96. (/): libxml2-python-2.9.-.el7_2..x86_64.rpm | kB ::
  97. (/): rpm-python-4.11.-.el7.x86_64.rpm | kB ::
  98. createrepo-0.9.-.el7.noarch FAILED
  99. http://centos.ustc.edu.cn/centos/7.6.1810/os/x86_64/Packages/createrepo-0.9.9-28.el7.noarch.rpm: [Errno 12] Timeout on http://centos.ustc.edu.cn/centos/7.6.1810/os/x86_64/Packages/createrepo-0.9.9-28.el7.noarch.rpm: (28, 'Operation too slow. Less than 1000 bytes/sec transferred the last 30 seconds')
  100. Trying other mirror.
  101. (/): createrepo-0.9.-.el7.noarch.rpm | kB ::
  102. -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  103. Total kB/s | 4.7 MB ::
  104. Running transaction check
  105. Running transaction test
  106. Transaction test succeeded
  107. Running transaction
  108. Updating : rpm-4.11.-.el7.x86_64 /
  109. Updating : rpm-libs-4.11.-.el7.x86_64 /
  110. Installing : deltarpm-3.6-.el7.x86_64 /
  111. Installing : python-deltarpm-3.6-.el7.x86_64 /
  112. Updating : rpm-build-libs-4.11.-.el7.x86_64 /
  113. Updating : rpm-python-4.11.-.el7.x86_64 /
  114. Installing : python-chardet-2.2.-.el7_1.noarch /
  115. Installing : python-kitchen-1.1.-.el7.noarch /
  116. Updating : libxml2-2.9.-.el7_2..x86_64 /
  117. Installing : libxml2-python-2.9.-.el7_2..x86_64 /
  118. Updating : python-urlgrabber-3.10-.el7.noarch /
  119. Updating : yum-3.4.-.el7.centos.noarch /
  120. Installing : yum-plugin-priorities-1.1.-.el7.noarch /
  121. Installing : createrepo-0.9.-.el7.noarch /
  122. Installing : yum-utils-1.1.-.el7.noarch /
  123. Cleanup : yum-3.4.-.el7.centos.0.1.noarch /
  124. Cleanup : rpm-python-4.11.-.el7.x86_64 /
  125. Cleanup : python-urlgrabber-3.10-.el7.noarch /
  126. Cleanup : rpm-build-libs-4.11.-.el7.x86_64 /
  127. Cleanup : rpm-libs-4.11.-.el7.x86_64 /
  128. Cleanup : rpm-4.11.-.el7.x86_64 /
  129. Cleanup : libxml2-2.9.-.el7_1..x86_64 /
  130. Verifying : rpm-python-4.11.-.el7.x86_64 /
  131. Verifying : rpm-libs-4.11.-.el7.x86_64 /
  132. Verifying : python-urlgrabber-3.10-.el7.noarch /
  133. Verifying : libxml2-2.9.-.el7_2..x86_64 /
  134. Verifying : yum-plugin-priorities-1.1.-.el7.noarch /
  135. Verifying : rpm-4.11.-.el7.x86_64 /
  136. Verifying : rpm-build-libs-4.11.-.el7.x86_64 /
  137. Verifying : libxml2-python-2.9.-.el7_2..x86_64 /
  138. Verifying : deltarpm-3.6-.el7.x86_64 /
  139. Verifying : createrepo-0.9.-.el7.noarch /
  140. Verifying : python-deltarpm-3.6-.el7.x86_64 /
  141. Verifying : yum-utils-1.1.-.el7.noarch /
  142. Verifying : python-chardet-2.2.-.el7_1.noarch /
  143. Verifying : python-kitchen-1.1.-.el7.noarch /
  144. Verifying : yum-3.4.-.el7.centos.noarch /
  145. Verifying : rpm-4.11.-.el7.x86_64 /
  146. Verifying : libxml2-2.9.-.el7_1..x86_64 /
  147. Verifying : rpm-libs-4.11.-.el7.x86_64 /
  148. Verifying : rpm-build-libs-4.11.-.el7.x86_64 /
  149. Verifying : yum-3.4.-.el7.centos.0.1.noarch /
  150. Verifying : rpm-python-4.11.-.el7.x86_64 /
  151. Verifying : python-urlgrabber-3.10-.el7.noarch /
  152.  
  153. Installed:
  154. createrepo.noarch :0.9.-.el7 yum-plugin-priorities.noarch :1.1.-.el7 yum-utils.noarch :1.1.-.el7
  155.  
  156. Dependency Installed:
  157. deltarpm.x86_64 :3.6-.el7 libxml2-python.x86_64 :2.9.-.el7_2. python-chardet.noarch :2.2.-.el7_1 python-deltarpm.x86_64 :3.6-.el7 python-kitchen.noarch :1.1.-.el7
  158.  
  159. Dependency Updated:
  160. libxml2.x86_64 :2.9.-.el7_2. python-urlgrabber.noarch :3.10-.el7 rpm.x86_64 :4.11.-.el7 rpm-build-libs.x86_64 :4.11.-.el7 rpm-libs.x86_64 :4.11.-.el7
  161. rpm-python.x86_64 :4.11.-.el7 yum.noarch :3.4.-.el7.centos
  162.  
  163. Complete!
  164. [root@node101 ~]#

[root@node101 ~]# yum -y install yum-utils createrepo yum-plugin-priorities               #安装本地源制作相关工具  

  1. [root@node101 ~]# cd /var/www/html/ambari/
  2. [root@node101 ambari]#
  3. [root@node101 ambari]# createrepo ./          #创建本地源,会在当前目录下生产一个repodata的目录。
  4. Spawning worker with pkgs
  5. Spawning worker with pkgs
  6. Workers Finished
  7. Saving Primary metadata
  8. Saving file lists metadata
  9. Saving other metadata
  10. Generating sqlite DBs
  11. Sqlite DBs complete
  12. [root@node101 ambari]# 

  执行上述操作后,会生产一个目录:

  为了能让yum命令能够找到我们的安装文件,还需要在yum的配置目录中“/etc/yum.repos.d/”创建两个仓库的配置文件,名字可以自定义,如下:

  1. [root@node101 ~]# cat /etc/yum.repos.d/ambari.repo
  2. #!/bin/bash
  3. #@author :yinzhengjie
  4. #blog:http://www.cnblogs.com/yinzhengjie
  5. #EMAIL:y1053419035@qq.com
  6.  
  7. [ambari-2.6.0.0]
  8. name=ambari Version - ambari-2.6.0.0
  9. baseurl=http://node101.yinzhengjie.org.cn/ambari/ambari/centos7/2.6.0.0-267
  10. gpgcheck=
  11. gpgkey=http://node101.yinzhengjie.org.cn/ambari/ambari/centos7/2.6.0.0-267/RPM-GPG-KEY/RPM-GPG-KEY-Jenkins
  12. enabled=
  13. priority=
  14. [root@node101 ~]#

[root@node101 ~]# cat /etc/yum.repos.d/ambari.repo

  1. [root@node101 ~]# cat /etc/yum.repos.d/hdp.repo
  2. #!/bin/bash
  3. #@author :yinzhengjie
  4. #blog:http://www.cnblogs.com/yinzhengjie
  5. #EMAIL:y1053419035@qq.com
  6.  
  7. [HDP-2.6.3.0]
  8. name=HDP Version - HDP-2.6.3.0
  9. baseurl=http://node101.yinzhengjie.org.cn/ambari/HDP/centos7/2.6.3.0-235/
  10. gpgcheck=
  11. gpgkey=http://node101.yinzhengjie.org.cn/ambari/HDP/centos7/2.6.3.0-235/RPM-GPG-KEY/RPM-GPG-KEY-Jenkins
  12. enabled=
  13. priority=
  14.  
  15. [HDP-UTILS-1.1.0.21]
  16. name=HDP-UTILS Version - HDP-UTILS-1.1.0.21
  17. baseurl=http://node101.yinzhengjie.org.cn/ambari/HDP-UTILS/
  18. gpgcheck=
  19. gpgkey=http://node101.yinzhengjie.org.cn/ambari/HDP-UTILS/RPM-GPG-KEY/RPM-GPG-KEY-Jenkins
  20. enabled=
  21. priority=
  22. [root@node101 ~]#

[root@node101 ~]# cat /etc/yum.repos.d/hdp.repo

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

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

  1. [root@node101 ~]# yum makecache
  2. Loaded plugins: fastestmirror, priorities
  3. HDP-2.6.3.0 | 2.9 kB ::
  4. HDP-UTILS-1.1.0.21 | 2.9 kB ::
  5. ambari-2.6.0.0 | 2.9 kB ::
  6. base | 3.6 kB ::
  7. extras | 3.4 kB ::
  8. updates | 3.4 kB ::
  9. (/): HDP-2.6.3.0/filelists_db | kB ::
  10. (/): HDP-2.6.3.0/primary_db | kB ::
  11. (/): HDP-2.6.3.0/other_db | kB ::
  12. (/): HDP-UTILS-1.1.0.21/filelists_db | kB ::
  13. (/): HDP-UTILS-1.1.0.21/other_db | kB ::
  14. (/): HDP-UTILS-1.1.0.21/primary_db | kB ::
  15. (/): ambari-2.6.0.0/filelists_db | kB ::
  16. (/): ambari-2.6.0.0/other_db | 1.3 kB ::
  17. (/): ambari-2.6.0.0/primary_db | 8.6 kB ::
  18. (/): base//x86_64/group_gz | kB ::
  19. (/): extras//x86_64/prestodelta | kB ::
  20. (/): base//x86_64/other_db | 2.6 MB ::
  21. (/): extras//x86_64/primary_db | kB ::
  22. (/): extras//x86_64/other_db | kB ::
  23. (/): extras//x86_64/filelists_db | kB ::
  24. (/): updates//x86_64/prestodelta | kB ::
  25. (/): updates//x86_64/primary_db | 1.3 MB ::
  26. (/): updates//x86_64/other_db | kB ::
  27. (/): updates//x86_64/filelists_db | 1.3 MB ::
  28. (/): base//x86_64/filelists_db | 7.1 MB ::
  29. (/): base//x86_64/primary_db | 6.0 MB ::
  30. Determining fastest mirrors
  31. * base: mirrors.aliyun.com
  32. * extras: mirrors.tuna.tsinghua.edu.cn
  33. * updates: mirrors.tuna.tsinghua.edu.cn
  34. Metadata Cache Created
  35. [root@node101 ~]#

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

  1. [root@node101 ~]# hostname
  2. node101.yinzhengjie.org.cn
  3. [root@node101 ~]#
  4. [root@node101 ~]# yum repolist                                  #检查一下yum的列表清单
  5. Loaded plugins: fastestmirror, priorities
  6. Loading mirror speeds from cached hostfile
  7. * base: mirrors.aliyun.com
  8. * extras: mirrors.tuna.tsinghua.edu.cn
  9. * updates: mirrors.tuna.tsinghua.edu.cn
  10. packages excluded due to repository priority protections
  11. repo id repo name status
  12. HDP-2.6.3.0 HDP Version - HDP-2.6.3.0 236            #这个yum源是咱们自己自定义的
  13. HDP-UTILS-1.1.0.21 HDP-UTILS Version - HDP-UTILS-1.1.0.21 64            #这远yum源也是咱们自定义的
  14. ambari-2.6.0.0 ambari Version - ambari-2.6.0.0 12            #这个yum元依旧是咱们自定的,如果你发现有这3个yum源是存在的,那么说明你的yum仓库部署就没有问题哟!
  15. base//x86_64 CentOS- - Base ,+
  16. extras//x86_64 CentOS- - Extras +
  17. updates//x86_64 CentOS- - Updates
  18. repolist: ,
  19. [root@node101 ~]#

4>.同步yum源的配置文件(将node101.yinzhengjie.org.cn的2个yum源配置文件拷贝到node102.yinzhengjie.org.cn和node103.yinzhengjie.org.cn上去。)

  1. [root@node101 ~]# xrsync.sh /etc/yum.repos.d/ambari.repo
  2. =========== node102.yinzhengjie.org.cn : /etc/yum.repos.d/ambari.repo ===========
  3. 命令执行成功
  4. =========== node103.yinzhengjie.org.cn : /etc/yum.repos.d/ambari.repo ===========
  5. 命令执行成功
  6. [root@node101 ~]#

[root@node101 ~]# xrsync.sh /etc/yum.repos.d/ambari.repo            #使用咱们自定义的脚本将ambari.repo文件同步到其他2个节点上。

  1. [root@node101 ~]# xrsync.sh /etc/yum.repos.d/hdp.repo
  2. =========== node102.yinzhengjie.org.cn : /etc/yum.repos.d/hdp.repo ===========
  3. 命令执行成功
  4. =========== node103.yinzhengjie.org.cn : /etc/yum.repos.d/hdp.repo ===========
  5. 命令执行成功
  6. [root@node101 ~]#

[root@node101 ~]# xrsync.sh /etc/yum.repos.d/hdp.repo              #同理,将hdp.repo也同步到其他2个节点上

  1. [root@node101 ~]# ssh node102.yinzhengjie.org.cn #登陆到node102yinzhengjie.org.cn节点
  2. Last login: Thu Dec :: from 172.30.1.2
  3. [root@nod102 ~]#
  4. [root@nod102 ~]# yum clean all #情况yum的缓存
  5. Loaded plugins: fastestmirror
  6. Cleaning repos: HDP-2.6.3.0 HDP-UTILS-1.1.0.21 ambari-2.6.0.0 base extras updates
  7. Cleaning up everything
  8. Cleaning up list of fastest mirrors
  9. [root@nod102 ~]#
  10. [root@nod102 ~]# yum makecache #重新制造缓存
  11. Loaded plugins: fastestmirror
  12. HDP-2.6.3.0 | 2.9 kB ::
  13. HDP-UTILS-1.1.0.21 | 2.9 kB ::
  14. ambari-2.6.0.0 | 2.9 kB ::
  15. base | 3.6 kB ::
  16. extras | 3.4 kB ::
  17. updates | 3.4 kB ::
  18. (/): HDP-2.6.3.0/primary_db | kB ::
  19. (/): HDP-2.6.3.0/filelists_db | kB ::
  20. (/): HDP-2.6.3.0/other_db | kB ::
  21. (/): HDP-UTILS-1.1.0.21/filelists_db | kB ::
  22. (/): HDP-UTILS-1.1.0.21/other_db | kB ::
  23. (/): HDP-UTILS-1.1.0.21/primary_db | kB ::
  24. (/): ambari-2.6.0.0/filelists_db | kB ::
  25. (/): ambari-2.6.0.0/other_db | 1.3 kB ::
  26. (/): ambari-2.6.0.0/primary_db | 8.6 kB ::
  27. (/): base//x86_64/group_gz | kB ::
  28. (/): extras//x86_64/prestodelta | kB ::
  29. (/): extras//x86_64/primary_db | kB ::
  30. (/): extras//x86_64/other_db | kB ::
  31. (/): extras//x86_64/filelists_db | kB ::
  32. (/): base//x86_64/other_db | 2.6 MB ::
  33. (/): updates//x86_64/prestodelta | kB ::
  34. (/): updates//x86_64/primary_db | 1.3 MB ::
  35. (/): updates//x86_64/other_db | kB ::
  36. (/): updates//x86_64/filelists_db | 1.3 MB ::
  37. (/): base//x86_64/primary_db | 6.0 MB ::
  38. (/): base//x86_64/filelists_db | 7.1 MB ::
  39. Determining fastest mirrors
  40. * base: mirrors.aliyun.com
  41. * extras: mirrors.tuna.tsinghua.edu.cn
  42. * updates: mirrors.tuna.tsinghua.edu.cn
  43. Metadata Cache Created
  44. You have new mail in /var/spool/mail/root
  45. [root@nod102 ~]#
  46. [root@nod102 ~]#
  47. [root@nod102 ~]# yum repolist #查看yum的列表
  48. Loaded plugins: fastestmirror
  49. Loading mirror speeds from cached hostfile
  50. * base: mirrors.aliyun.com
  51. * extras: mirrors.tuna.tsinghua.edu.cn
  52. * updates: mirrors.tuna.tsinghua.edu.cn
  53. repo id repo name status
  54. HDP-2.6.3.0 HDP Version - HDP-2.6.3.0
  55. HDP-UTILS-1.1.0.21 HDP-UTILS Version - HDP-UTILS-1.1.0.21
  56. ambari-2.6.0.0 ambari Version - ambari-2.6.0.0
  57. base//x86_64 CentOS- - Base ,
  58. extras//x86_64 CentOS- - Extras
  59. updates//x86_64 CentOS- - Updates
  60. repolist: ,
  61. [root@nod102 ~]#

[root@node102 ~]# yum repolist                             #查看node102.yinzhengjie.org.cn服务器的yum的列表

  1. [root@node101 ~]# ssh node103.yinzhengjie.org.cn
  2. Last login: Thu Dec :: from 172.30.1.2
  3. [root@node103 ~]#
  4. You have new mail in /var/spool/mail/root
  5. [root@node103 ~]#
  6. [root@node103 ~]# yum clean all
  7. Loaded plugins: fastestmirror
  8. Cleaning repos: HDP-2.6.3.0 HDP-UTILS-1.1.0.21 ambari-2.6.0.0 base extras updates
  9. Cleaning up everything
  10. Cleaning up list of fastest mirrors
  11. [root@node103 ~]#
  12. [root@node103 ~]# yum makecache
  13. Loaded plugins: fastestmirror
  14. HDP-2.6.3.0 | 2.9 kB ::
  15. HDP-UTILS-1.1.0.21 | 2.9 kB ::
  16. ambari-2.6.0.0 | 2.9 kB ::
  17. base | 3.6 kB ::
  18. extras | 3.4 kB ::
  19. updates | 3.4 kB ::
  20. (/): HDP-2.6.3.0/primary_db | kB ::
  21. (/): HDP-2.6.3.0/filelists_db | kB ::
  22. (/): HDP-2.6.3.0/other_db | kB ::
  23. (/): HDP-UTILS-1.1.0.21/filelists_db | kB ::
  24. (/): HDP-UTILS-1.1.0.21/other_db | kB ::
  25. (/): HDP-UTILS-1.1.0.21/primary_db | kB ::
  26. (/): ambari-2.6.0.0/primary_db | 8.6 kB ::
  27. (/): ambari-2.6.0.0/filelists_db | kB ::
  28. (/): ambari-2.6.0.0/other_db | 1.3 kB ::
  29. (/): base//x86_64/group_gz | kB ::
  30. (/): extras//x86_64/prestodelta | kB ::
  31. (/): extras//x86_64/primary_db | kB ::
  32. (/): extras//x86_64/filelists_db | kB ::
  33. (/): extras//x86_64/other_db | kB ::
  34. (/): updates//x86_64/prestodelta | kB ::
  35. (/): base//x86_64/other_db | 2.6 MB ::
  36. (/): updates//x86_64/other_db | kB ::
  37. (/): updates//x86_64/primary_db | 1.3 MB ::
  38. (/): base//x86_64/primary_db | 6.0 MB ::
  39. (/): updates//x86_64/filelists_db | 1.3 MB ::
  40. (/): base//x86_64/filelists_db | 7.1 MB ::
  41. Determining fastest mirrors
  42. * base: mirrors.aliyun.com
  43. * extras: mirrors.huaweicloud.com
  44. * updates: mirrors.huaweicloud.com
  45. Metadata Cache Created
  46. You have new mail in /var/spool/mail/root
  47. [root@node103 ~]#
  48. [root@node103 ~]#
  49. [root@node103 ~]# yum repolist
  50. Loaded plugins: fastestmirror
  51. Loading mirror speeds from cached hostfile
  52. * base: mirrors.aliyun.com
  53. * extras: mirrors.huaweicloud.com
  54. * updates: mirrors.huaweicloud.com
  55. repo id repo name status
  56. HDP-2.6.3.0 HDP Version - HDP-2.6.3.0
  57. HDP-UTILS-1.1.0.21 HDP-UTILS Version - HDP-UTILS-1.1.0.21
  58. ambari-2.6.0.0 ambari Version - ambari-2.6.0.0
  59. base//x86_64 CentOS- - Base ,
  60. extras//x86_64 CentOS- - Extras
  61. updates//x86_64 CentOS- - Updates
  62. repolist: ,
  63. [root@node103 ~]#

[root@node103 ~]# yum repolist                            #同上,在node103.yinzhengjie.org.cn上做相同的操作,也是查看yum的列表

五.安装ambari-server

1>.安装postgresql数据库

  和CDH一样,Ambari默认是使用postgresql数据库来保存元数据它的元数据信息,这需要咱们运维的小伙伴对postgresql数据库要具有一定的了解,掌握常见的故障拍错,包括如何配置数据库的主从同步等等。有的人没有懒得去学习也可以使用oracle或者mysql来存放元数据信息,当然,即使你使用来别的数据库,推荐你依然要配置数据库的主从同步,目的是防治单点故障嘛,你懂的。因此,我们可以总结一下为什么不实用postgrsql数据库的原因:

    第一:需要学习数据库的成本提升(主从复制);

    第二:postgresql数据库的性能我们无法保证,因为我们对他的了解情况不深入;

    第三:postgresql数据库的可靠性我们无法保证!

  综上所述,我们在生产环境中不推荐使用内置的数据库选项,而是应该使用自己安装的数据库(单本篇博客依旧会介绍如何使用postgresql数据库来安装Ambari服务。),比如关于如何使用mysql存放Ambari元数据的配置案例请参考:https://www.cnblogs.com/yinzhengjie/p/10074613.html。

  1. [root@node101 ~]# yum -y install postgresql-server
  2. Loaded plugins: fastestmirror, priorities
  3. Loading mirror speeds from cached hostfile
  4. * base: mirrors.aliyun.com
  5. * extras: mirrors.tuna.tsinghua.edu.cn
  6. * updates: mirrors.tuna.tsinghua.edu.cn
  7. packages excluded due to repository priority protections
  8. Resolving Dependencies
  9. --> Running transaction check
  10. ---> Package postgresql-server.x86_64 :9.2.-.el7_5 will be installed
  11. --> Processing Dependency: postgresql-libs(x86-) = 9.2.-.el7_5 for package: postgresql-server-9.2.-.el7_5.x86_64
  12. --> Processing Dependency: postgresql(x86-) = 9.2.-.el7_5 for package: postgresql-server-9.2.-.el7_5.x86_64
  13. --> Processing Dependency: libpq.so.()(64bit) for package: postgresql-server-9.2.-.el7_5.x86_64
  14. --> Running transaction check
  15. ---> Package postgresql.x86_64 :9.2.-.el7_5 will be installed
  16. ---> Package postgresql-libs.x86_64 :9.2.-.el7_5 will be installed
  17. --> Finished Dependency Resolution
  18.  
  19. Dependencies Resolved
  20.  
  21. ==================================================================================================================
  22. Package Arch Version Repository Size
  23. ==================================================================================================================
  24. Installing:
  25. postgresql-server x86_64 9.2.-.el7_5 base 3.8 M
  26. Installing for dependencies:
  27. postgresql x86_64 9.2.-.el7_5 base 3.0 M
  28. postgresql-libs x86_64 9.2.-.el7_5 base k
  29.  
  30. Transaction Summary
  31. ==================================================================================================================
  32. Install Package (+ Dependent packages)
  33.  
  34. Total download size: 7.1 M
  35. Installed size: M
  36. Downloading packages:
  37. (/): postgresql-libs-9.2.-.el7_5.x86_64.rpm | kB ::
  38. (/): postgresql-server-9.2.-.el7_5.x86_64.rpm | 3.8 MB ::
  39. (/): postgresql-9.2.-.el7_5.x86_64.rpm | 3.0 MB ::
  40. ------------------------------------------------------------------------------------------------------------------
  41. Total kB/s | 7.1 MB ::
  42. Running transaction check
  43. Running transaction test
  44. Transaction test succeeded
  45. Running transaction
  46. Installing : postgresql-libs-9.2.-.el7_5.x86_64 /
  47. Installing : postgresql-9.2.-.el7_5.x86_64 /
  48. Installing : postgresql-server-9.2.-.el7_5.x86_64 /
  49. Verifying : postgresql-server-9.2.-.el7_5.x86_64 /
  50. Verifying : postgresql-libs-9.2.-.el7_5.x86_64 /
  51. Verifying : postgresql-9.2.-.el7_5.x86_64 /
  52.  
  53. Installed:
  54. postgresql-server.x86_64 :9.2.-.el7_5
  55.  
  56. Dependency Installed:
  57. postgresql.x86_64 :9.2.-.el7_5 postgresql-libs.x86_64 :9.2.-.el7_5
  58.  
  59. Complete!
  60. [root@node101 ~]#

[root@node101 ~]# yum -y install postgresql-server                  #使用yum的方式安装postgresql数据库

2>.安装Ambari-Server

  注意,在安装Ambari-Server请确保两点:

    第一,是否配置好yum源;

    第二:是否安装来postgresql数据库(如果没有安装psotgresql数据库的话安装Ambari-Server是会报错的);

  1. [root@node101 ~]# yum -y install ambari-server
  2. Loaded plugins: fastestmirror, priorities
  3. Loading mirror speeds from cached hostfile
  4. * base: mirrors.aliyun.com
  5. * extras: mirrors.tuna.tsinghua.edu.cn
  6. * updates: mirrors.tuna.tsinghua.edu.cn
  7. packages excluded due to repository priority protections
  8. Resolving Dependencies
  9. --> Running transaction check
  10. ---> Package ambari-server.x86_64 :2.6.0.0- will be installed
  11. --> Finished Dependency Resolution
  12.  
  13. Dependencies Resolved
  14.  
  15. ==================================================================================================================
  16. Package Arch Version Repository Size
  17. ==================================================================================================================
  18. Installing:
  19. ambari-server x86_64 2.6.0.0- ambari-2.6.0.0 M
  20.  
  21. Transaction Summary
  22. ==================================================================================================================
  23. Install Package
  24.  
  25. Total download size: M
  26. Installed size: M
  27. Downloading packages:
  28. warning: /var/cache/yum/x86_64//ambari-2.6.0.0/packages/ambari-server-2.6.0.0-.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID 07513cad: NOKEY
  29. Public key for ambari-server-2.6.0.0-.x86_64.rpm is not installed
  30. ambari-server-2.6.0.0-.x86_64.rpm | MB ::
  31. Retrieving key from http://node101.yinzhengjie.org.cn/ambari/ambari/centos7/2.6.0.0-267/RPM-GPG-KEY/RPM-GPG-KEY-Jenkins
  32. Importing GPG key 0x07513CAD:
  33. Userid : "Jenkins (HDP Builds) <jenkin@hortonworks.com>"
  34. Fingerprint: df52 ed4f 7a3a c099 4c66 b973 3a7a 3cad
  35. From : http://node101.yinzhengjie.org.cn/ambari/ambari/centos7/2.6.0.0-267/RPM-GPG-KEY/RPM-GPG-KEY-Jenkins
  36. Running transaction check
  37. Running transaction test
  38. Transaction test succeeded
  39. Running transaction
  40. Installing : ambari-server-2.6.0.0-.x86_64 /
  41. Verifying : ambari-server-2.6.0.0-.x86_64 /
  42.  
  43. Installed:
  44. ambari-server.x86_64 :2.6.0.0-
  45.  
  46. Complete!
  47. [root@node101 ~]#

[root@node101 ~]# yum -y install ambari-server                      #安装ambari-server服务端

3>.Ambari-Server目录结构介绍

  Ambari-Server安装完毕后我们主要关注4个目录,他们分别是以下几个:

  1. [root@node101 ~]# ll /etc/ambari-server/conf/
  2. total
  3. -rwxr-xr-x root root Oct ambari.properties
  4. -rwxr-xr-x root root Oct krb5JAASLogin.conf
  5. -rwxr-xr-x root root Dec : log4j.properties
  6. -rwxr-xr-x root root Oct metrics.properties
  7. [root@node101 ~]#

[root@node101 ~]# ll /etc/ambari-server/conf/            #Ambari的配置文件会全部放在这个目录下。

  1. [root@node101 ~]# ll /usr/lib/ambari-server/
  2. total
  3. -rw-r--r-- root root Oct activation-1.1.jar
  4. -rw-r--r-- root root Oct ambari-metrics-common-2.6.0.0..jar
  5. -rw-r--r-- root root Oct ambari-server-2.6.0.0..jar
  6. -rw-r--r-- root root Oct ambari-views-2.6.0.0..jar
  7. -rw-r--r-- root root Oct ant-1.6..jar
  8. -rw-r--r-- root root Oct ant-launcher-1.7..jar
  9. -rw-r--r-- root root Oct antlr-2.7..jar
  10. -rw-r--r-- root root Oct aopalliance-1.0.jar
  11. -rw-r--r-- root root Oct apacheds-i18n-2.0.-M19.jar
  12. -rw-r--r-- root root Oct apacheds-kerberos-codec-2.0.-M19.jar
  13. -rw-r--r-- root root Oct apache-log4j-extras-1.2..jar
  14. -rw-r--r-- root root Oct api-asn1-api-1.0.-M26.jar
  15. -rw-r--r-- root root Oct api-asn1-ber-1.0.-M26.jar
  16. -rw-r--r-- root root Oct api-i18n-1.0.-M26.jar
  17. -rw-r--r-- root root Oct api-ldap-model-1.0.-M26.jar
  18. -rw-r--r-- root root Oct api-util-1.0.-M26.jar
  19. -rw-r--r-- root root Oct asm-3.3..jar
  20. -rw-r--r-- root root Oct avro-1.7..jar
  21. -rw-r--r-- root root Oct c3p0-0.9.5.2.jar
  22. -rw-r--r-- root root Oct cglib-2.2..jar
  23. -rw-r--r-- root root Oct cloning-1.9..jar
  24. -rw-r--r-- root root Oct commonj.sdo-2.1..jar
  25. -rw-r--r-- root root Oct commons-beanutils-1.7..jar
  26. -rw-r--r-- root root Oct commons-beanutils-core-1.8..jar
  27. -rw-r--r-- root root Oct commons-cli-1.3..jar
  28. -rw-r--r-- root root Oct commons-codec-1.8.jar
  29. -rw-r--r-- root root Oct commons-collections-3.2..jar
  30. -rw-r--r-- root root Oct commons-compress-1.5.jar
  31. -rw-r--r-- root root Oct commons-configuration-1.6.jar
  32. -rw-r--r-- root root Oct commons-csv-1.1.jar
  33. -rw-r--r-- root root Oct commons-digester-1.8.jar
  34. -rw-r--r-- root root Oct commons-httpclient-3.1.jar
  35. -rw-r--r-- root root Oct commons-io-2.1.jar
  36. -rw-r--r-- root root Oct commons-lang-2.5.jar
  37. -rw-r--r-- root root Oct commons-logging-1.1..jar
  38. -rw-r--r-- root root Oct commons-math3-3.1..jar
  39. -rw-r--r-- root root Oct commons-net-1.4..jar
  40. -rw-r--r-- root root Oct curator-client-2.7..jar
  41. -rw-r--r-- root root Oct curator-framework-2.7..jar
  42. -rw-r--r-- root root Oct curator-recipes-2.7..jar
  43. -rw-r--r-- root root Oct ecj-3.5..jar
  44. -rw-r--r-- root root Oct eclipselink-2.6..jar
  45. -rw-r--r-- root root Oct ehcache-2.10..jar
  46. -rw-r--r-- root root Oct gson-2.2..jar
  47. -rw-r--r-- root root Oct guava-16.0.jar
  48. -rw-r--r-- root root Oct guice-3.0.jar
  49. -rw-r--r-- root root Oct guice-assistedinject-3.0.jar
  50. -rw-r--r-- root root Oct guice-multibindings-3.0.jar
  51. -rw-r--r-- root root Oct guice-persist-3.0.jar
  52. -rw-r--r-- root root Oct guice-servlet-3.0.jar
  53. -rw-r--r-- root root Oct h2-1.4..jar
  54. -rw-r--r-- root root Oct hadoop-annotations-2.6..jar
  55. -rw-r--r-- root root Oct hadoop-auth-2.7..jar
  56. -rw-r--r-- root root Oct hadoop-common-2.7..jar
  57. -rw-r--r-- root root Oct htrace-core-3.1.-incubating.jar
  58. -rw-r--r-- root root Oct httpclient-4.2..jar
  59. -rw-r--r-- root root Oct httpcore-4.2..jar
  60. -rw-r--r-- root root Oct jackson-annotations-2.8..jar
  61. -rw-r--r-- root root Oct jackson-core-asl-1.9..jar
  62. -rw-r--r-- root root Oct jackson-jaxrs-1.9..jar
  63. -rw-r--r-- root root Oct jackson-mapper-asl-1.9..jar
  64. -rw-r--r-- root root Oct jackson-xc-1.9..jar
  65. -rw-r--r-- root root Oct javax.inject-.jar
  66. -rw-r--r-- root root Oct javax.json-1.0..jar
  67. -rw-r--r-- root root Oct java-xmlbuilder-0.4.jar
  68. -rw-r--r-- root root Oct javax.persistence-2.1..jar
  69. -rw-r--r-- root root Oct javax.servlet-3.0..v201112011016.jar
  70. -rw-r--r-- root root Oct javax.servlet-api-3.1..jar
  71. -rw-r--r-- root root Oct jaxb-api-2.2..jar
  72. -rw-r--r-- root root Oct jaxb-impl-2.2.-.jar
  73. -rw-r--r-- root root Oct jcip-annotations-1.0.jar
  74. -rw-r--r-- root root Oct jersey-client-1.19.jar
  75. -rw-r--r-- root root Oct jersey-core-1.19.jar
  76. -rw-r--r-- root root Oct jersey-guice-1.19.jar
  77. -rw-r--r-- root root Oct jersey-json-1.19.jar
  78. -rw-r--r-- root root Oct jersey-multipart-1.19.jar
  79. -rw-r--r-- root root Oct jersey-server-1.19.jar
  80. -rw-r--r-- root root Oct jersey-servlet-1.19.jar
  81. -rw-r--r-- root root Oct jets3t-0.9..jar
  82. -rw-r--r-- root root Oct jetty-6.1..jar
  83. -rw-r--r-- root root Oct jetty-client-8.1..v20160209.jar
  84. -rw-r--r-- root root Oct jetty-continuation-8.1..v20160209.jar
  85. -rw-r--r-- root root Oct jetty-http-8.1..v20160209.jar
  86. -rw-r--r-- root root Oct jetty-io-8.1..v20160209.jar
  87. -rw-r--r-- root root Oct jetty-security-8.1..v20160209.jar
  88. -rw-r--r-- root root Oct jetty-server-8.1..v20160209.jar
  89. -rw-r--r-- root root Oct jetty-servlet-8.1..v20160209.jar
  90. -rw-r--r-- root root Oct jetty-servlets-8.1..v20160209.jar
  91. -rw-r--r-- root root Oct jetty-util-8.1..v20160209.jar
  92. -rw-r--r-- root root Oct jetty-webapp-8.1..v20160209.jar
  93. -rw-r--r-- root root Oct jetty-xml-8.1..v20160209.jar
  94. -rw-r--r-- root root Oct jline-2.11.jar
  95. -rw-r--r-- root root Oct jna-4.2..jar
  96. -rw-r--r-- root root Oct jsch-0.1..jar
  97. -rw-r--r-- root root Oct json-smart-1.1..jar
  98. -rw-r--r-- root root Oct jsp-2.1-glassfish-2.1.v20100127.jar
  99. -rw-r--r-- root root Oct jsp-api-2.1-glassfish-2.1.v20100127.jar
  100. -rw-r--r-- root root Oct jsr305-1.3..jar
  101. -rw-r--r-- root root Oct jsr311-api-1.1..jar
  102. -rw-r--r-- root root Oct jul-to-slf4j-1.7..jar
  103. -rw-r--r-- root root Oct kerberos-client-2.0.-M19.jar
  104. drwxr-xr-x root root Dec : lib
  105. -rw-r--r-- root root Oct libpam4j-1.8.jar
  106. -rw-r--r-- root root Oct log4j-1.2..jar
  107. -rw-r--r-- root root Oct mailapi-1.5..jar
  108. -rw-r--r-- root root Oct mchange-commons-java-0.2..jar
  109. -rw-r--r-- root root Oct metrics-core-3.1..jar
  110. -rw-r--r-- root root Oct metrics-jvm-3.1..jar
  111. -rw-r--r-- root root Oct mimepull-1.9..jar
  112. -rw-r--r-- root root Oct mina-core-2.0..jar
  113. -rw-r--r-- root root Oct netty-3.7..Final.jar
  114. -rw-r--r-- root root Oct nimbus-jose-jwt-3.9.jar
  115. -rw-r--r-- root root Oct objenesis-2.1.jar
  116. -rw-r--r-- root root Oct objenesis-tck-1.2.jar
  117. -rw-r--r-- root root Oct oro-2.0..jar
  118. -rw-r--r-- root root Oct paranamer-2.3.jar
  119. -rw-r--r-- root root Oct postgresql-9.3--jdbc4.jar
  120. -rw-r--r-- root root Oct protobuf-java-2.5..jar
  121. -rw-r--r-- root root Oct quartz-2.2..jar
  122. -rw-r--r-- root root Oct quartz-jobs-2.2..jar
  123. -rw-r--r-- root root Oct slf4j-api-1.7..jar
  124. -rw-r--r-- root root Oct slf4j-log4j12-1.7..jar
  125. -rw-r--r-- root root Oct smtp-1.5..jar
  126. -rw-r--r-- root root Oct snappy-java-1.0.4.1.jar
  127. -rw-r--r-- root root Oct snmp4j-1.10..jar
  128. -rw-r--r-- root root Oct spring-aop-3.0..RELEASE.jar
  129. -rw-r--r-- root root Oct spring-asm-3.0..RELEASE.jar
  130. -rw-r--r-- root root Oct spring-beans-3.0..RELEASE.jar
  131. -rw-r--r-- root root Oct spring-context-3.0..RELEASE.jar
  132. -rw-r--r-- root root Oct spring-core-3.0..RELEASE.jar
  133. -rw-r--r-- root root Oct spring-expression-3.0..RELEASE.jar
  134. -rw-r--r-- root root Oct spring-jdbc-3.0..RELEASE.jar
  135. -rw-r--r-- root root Oct spring-ldap-core-2.0..RELEASE.jar
  136. -rw-r--r-- root root Oct spring-security-config-3.1..RELEASE.jar
  137. -rw-r--r-- root root Oct spring-security-core-3.1..RELEASE.jar
  138. -rw-r--r-- root root Oct spring-security-kerberos-core-1.0..RELEASE.jar
  139. -rw-r--r-- root root Oct spring-security-kerberos-web-1.0..RELEASE.jar
  140. -rw-r--r-- root root Oct spring-security-ldap-4.0..RELEASE.jar
  141. -rw-r--r-- root root Oct spring-security-web-3.1..RELEASE.jar
  142. -rw-r--r-- root root Oct spring-tx-3.0..RELEASE.jar
  143. -rw-r--r-- root root Oct spring-web-3.0..RELEASE.jar
  144. -rw-r--r-- root root Oct stax-api-1.0-.jar
  145. -rw-r--r-- root root Oct validation-api-1.1..Final.jar
  146. -rw-r--r-- root root Oct velocity-1.7.jar
  147. drwxr-xr-x root root Dec : web
  148. -rw-r--r-- root root Oct xmlenc-0.52.jar
  149. -rw-r--r-- root root Oct xz-1.2.jar
  150. -rw-r--r-- root root Oct zookeeper-3.4..jar
  151. [root@node101 ~]#

[root@node101 ~]# ll /usr/lib/ambari-server/             #Ambari自身的服务会安装到这个目录下。

  1. [root@node101 ~]# ll /var/log/ambari-server/
  2. total
  3. -rw-r--r-- root root Dec : ambari-alerts.log
  4. -rw-r--r-- root root Dec : ambari-audit.log
  5. -rw-r--r-- root root Dec : ambari-config-changes.log
  6. -rw-r--r-- root root Dec : ambari-eclipselink.log
  7. -rw-r--r-- root root Dec : ambari-server-check-database.log
  8. -rw-r--r-- root root Dec : ambari-server-command.log
  9. -rw-r--r-- root root Dec : ambari-server.log
  10. -rw-r--r-- root root Dec : ambari-server.out
  11. drwxr-xr-x root root Dec : capshed-view
  12. drwxr-xr-x root root Dec : files-view
  13. drwxr-xr-x root root Dec : hive20-view
  14. drwxr-xr-x root root Dec : hive-next-view
  15. drwxr-xr-x root root Dec : huetoambarimigration-view
  16. drwxr-xr-x root root Dec : pig-view
  17. drwxr-xr-x root root Dec : slider-view
  18. drwxr-xr-x root root Dec : storm-view
  19. drwxr-xr-x root root Dec : tez-view
  20. drwxr-xr-x root root Dec : wfmanager-view
  21. [root@node101 ~]#

[root@node101 ~]# ll /var/log/ambari-server/            #Ambari自身的服务日志会放到这个目录下。

4>.配置Ambari-Server

  在安装Ambari-Server之后,如果我们直接跳过当前的步骤,直接去执行第5步骤,我们会发现启动服务报错,这是因为在启动服务之前必须要先完成初始配置,执行ambari-server setup命令开始配置。

  1. [root@node101 ~]# ambari-server setup
  2. Using python /usr/bin/python       #看到这里的数据,同学们估计已经猜到了,没错Ambari-Server会通过Python脚本启动一个交互式的shell程序来引导用户完成配置,这和CDH几乎是如出一辙啊!!!
  3. Setup ambari-server
  4. Checking SELinux...           #咱们再看看这个输出,说明程序配置首先会检查是否已经禁用了SELinux,这项配置在之前步骤已经设置过了,所以下面价差的状态为“disabled”
  5. SELinux status is 'disabled'
  6. Customize user account for ambari-server daemon [y/n] (n)? n   #紧接着,出现了一个交互的场景,问咱们是否要指定Ambari的用户,这里用户使用默认的Amabri用户,输入字母“n”,或者直接按回车即可。
  7. Adjusting ambari-server permissions and ownership...
  8. Checking firewall status...         #看到没有,上面检查了selinux的状态,现在又开始检查防火墙的状态啦!下面有紧接着检查JDK环境
  9. Checking JDK...
  10. [] Oracle JDK 1.8 + Java Cryptography Extension (JCE) Policy Files
  11. [] Oracle JDK 1.7 + Java Cryptography Extension (JCE) Policy Files
  12. [] Custom JDK
  13. ==============================================================================
  14. Enter choice ():                         #看到没?让你从上面选择对应的数字,是JDK8还是JDK7,还是咱们自定义安装的jdk,我这里是自定义自定义安装JDK环境的,因此我输入了数字”3”,下面会要求我们指定安装JDK的路径。
  15. WARNING: JDK must be installed on all hosts and JAVA_HOME must be valid on all hosts.
  16. 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.
  17. Path to JAVA_HOME: /yinzhengjie/softwares/jdk         #既然上面我们选择的是自定义JDK环境的,那么我们得告诉它我们的JAVA_HOME路径在哪。实事求是,按照你安装的路径输入进去即可。
  18. Validating JDK on Ambari Server...done.
  19. Completing setup...
  20. Configuring database...
  21. Enter advanced database configuration [y/n] (n)? n         #最后是数据库设置,这里为了方便,我就使用了默认的postgresql数据库。大家看到小括号的提示没?他表示默认就是“n”,因此我们是可以直接回车的!我之前也给大家分析了为什么不要使用内置的数据库的原因,但本片博客会展示内置的postgresql数据库存放元数据信息。
  22. Configuring database...
  23. Default properties detected. Using built-in database.
  24. Configuring ambari database...
  25. Checking PostgreSQL...
  26. Running initdb: This may take up to a minute.
  27. Initializing database ... OK
  28.  
  29. About to start PostgreSQL
  30. Configuring local database...
  31. Configuring PostgreSQL...
  32. Restarting PostgreSQL
  33. Creating schema and user...
  34. done.
  35. Creating tables...
  36. done.
  37. Extracting system views...
  38. ..........ambari-admin-2.6.0.0..jar
  39. .
  40. Adjusting ambari-server permissions and ownership...
  41. Ambari Server 'setup' completed successfully.
  42. [root@node101 ~]#

5>.启动Ambari-Server

  我们初始化了Ambari-Server的存放元数据信息的数据库以及配置jdk等环境后(也就是第4步骤),我们就可以启动Ambari Serveri数据库啦!

  1. [root@node101 ~]# ambari-server start                       #输入相应的启动命令,你就会发现启动数据是成功的
  2. Using python /usr/bin/python
  3. Starting ambari-server
  4. Ambari Server running with administrator privileges.
  5. Organizing resource files at /var/lib/ambari-server/resources...
  6. Ambari database consistency check started...
  7. Server PID at: /var/run/ambari-server/ambari-server.pid          
  8. Server out at: /var/log/ambari-server/ambari-server.out
  9. Server log at: /var/log/ambari-server/ambari-server.log            #这个文件是存放日志的,上面2个文件存放的是PID以及
  10. Waiting for server start......................
  11. Server started listening on 8080                          #这里自然就是监听服务的端口啦~我们可以通过webUI的方式去访问它。
  12.  
  13. DB configs consistency check: no errors and warnings were found.
  14. Ambari Server 'start' completed successfully.                  #这里提示我们服务启动成功啦~
  15. [root@node101 ~]#

  好啦,既然服务已经启动成功了,那我们也别闲着了,说干就干吧,访问一下WebUI吧:

  如上图所示,登陆系统之后,会看到Ambari空空如也的欢迎界面,接下来我们就需要介绍如何通过Ambari新建Hadoop集群。详情请参考我的博客:手把手教你通过Ambari新建Hadoop集群图解案例

离线方式部署Ambari2.6.0.0的更多相关文章

  1. 运维监控-基于yum的方式部署Zabbix Server 4.0 版本

    运维监控-基于yum的方式部署Zabbix Server 4.0 版本 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.如何选择zabbix版本 1>.打开zabbix官方 ...

  2. 运维监控-基于yum的方式部署 Zabbix Agent 4.0 版本

    运维监控-基于yum的方式部署 Zabbix Agent 4.0 版本 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 上一篇博客我们分享了如何基于yum的方式部署zabbix 4. ...

  3. Apache Hadoop集群离线安装部署(二)——Spark-2.1.0 on Yarn安装

    Apache Hadoop集群离线安装部署(一)——Hadoop(HDFS.YARN.MR)安装:http://www.cnblogs.com/pojishou/p/6366542.html Apac ...

  4. Hadoop生态圈-离线方式部署Cloudera Manager5.15.1

    Hadoop生态圈-离线方式部署Cloudera Manager5.15.1 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 到目前位置,Cloudera Manager和CDH最新 ...

  5. 二进制方式部署Kubernetes 1.6.0集群(开启TLS)

    本节内容: Kubernetes简介 环境信息 创建TLS加密通信的证书和密钥 下载和配置 kubectl(kubecontrol) 命令行工具 创建 kubeconfig 文件 创建高可用 etcd ...

  6. Tidb 离线Ansible方式部署实践

    1.最近浏览到一个比较新的分布式数据库Tidb,开源看起来比较牛的样子,一时手痒就动手试试部署 2.参考官方 Ansible 离线方式部署 :https://pingcap.com/docs-cn/o ...

  7. Hadoop生态圈-基于yum源的方式部署Cloudera Manager5.15.1

    Hadoop生态圈-基于yum源的方式部署Cloudera Manager5.15.1 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 我之前分享过关于离线方式部署Cloudera ...

  8. Apache Hadoop集群离线安装部署(三)——Hbase安装

    Apache Hadoop集群离线安装部署(一)——Hadoop(HDFS.YARN.MR)安装:http://www.cnblogs.com/pojishou/p/6366542.html Apac ...

  9. Apache Hadoop集群离线安装部署(一)——Hadoop(HDFS、YARN、MR)安装

    虽然我已经装了个Cloudera的CDH集群(教程详见:http://www.cnblogs.com/pojishou/p/6267616.html),但实在太吃内存了,而且给定的组件版本是不可选的, ...

随机推荐

  1. 《linux内核设计与实现》读书笔记——第三章

  2. GuiHelloWorld

    package com.home.test; import java.awt.Color; import java.awt.Cursor; import java.awt.Font; import j ...

  3. 关于本科毕业论文《Laguerre小波在数值积分与微分方程数值解中的应用》存在的问题与小结

    本科的毕业设计<Laguerre小波在数值积分与微分方程数值解中的应用>是通过Laguerre小波函数来近似表达某个需要求积分或解微分方程的函数,将原函数很难求得函数用小波函数表达出来,这 ...

  4. type=hidden

    非常值得注意的一个,通常称为隐藏域:如果一个非常重要的信息需要被提交到下一页,但又不能或者无法明示的时候. 一句话,你在页面中是看不到hidden在哪里.最有用的是hidden的值.

  5. Hacked VisualSVN Server by PHP to allow user change password

    index.php <?php$username = $_SERVER["PHP_AUTH_USER"]; //经过 AuthType Basic 认证的用户名$authed ...

  6. D3.js & Data Visualization & SVG

    D3.js & Data Visualization & SVG https://davidwalsh.name/learning-d3 // import {scaleLinear} ...

  7. gitlab搭建与配置说明

    1. 概述 Gitlab分为社区版和企业版,此次安装的是社区版(gitlab-ce). 2. 准备 本次使用系统为Ubuntu16.04. 3. 安装 添加GitLab仓库,并安装到服务器上(将git ...

  8. selenium之批量执行测试用例

    把写好的测试用例放在指定目录下,使用discover函数扫描该目录,并根据关键字自动筛选需要执行的用例.本例使用Python3.6版本. # 遍历指定目录,批量执行测试用例 import unitte ...

  9. Bootstrap滚动监控器

    前面的话 滚动监听插件是用来根据滚动条所处的位置来自动更新导航项的.滚动导航条下面的区域并关注导航项的变化,下拉菜单中的条目也会自动高亮显示.本文将详细介绍Bootstrap滚动监控器 基本用法 滚动 ...

  10. Ubuntu 16.04安装idea

    此篇为http://www.cnblogs.com/EasonJim/p/7139275.html的分支页. 前提:必须正确安装JDK和Tomcat. 下载: https://www.jetbrain ...