Ambari2.7.4+HDP3.1.4安装 Centos7离线安装

2019/04/10 10:10
阅读数 149

<!-- wp:heading -->

1. 本次安装简单介绍

<!-- /wp:heading -->

<!-- wp:heading {"level":3} -->

1.1Ambari

<!-- /wp:heading -->

<!-- wp:paragraph -->

<p>Ambari是一种基于Web的工具,支持Apache Hadoop集群的创建 、管理和监控。</p> <!-- /wp:paragraph -->

<!-- wp:paragraph -->

<p>Ambari已支持大多数Hadoop组件,包括HDFS、MapReduce、Hive、Pig、 Hbase、Zookeeper、Sqoop和Hcatalog等。Apache Ambari 支持HDFS、MapReduce、Hive、Pig、Hbase、Zookeepr、Sqoop和Hcatalog等的集中管理。也是5个顶级hadoop管理工具之一。 </p> <!-- /wp:paragraph -->

<!-- wp:paragraph -->

<p>Ambari 自身也是一个分布式架构的软件,主要由两部分组成:Ambari Server 和 Ambari Agent。简单来说,用户通过 Ambari Server 通知 Ambari Agent 安装对应的软件;Agent 会定时地发送各个机器每个软件模块的状态给 Ambari Server,最终这些状态信息会呈现在 Ambari 的 GUI,方便用户了解到集群的各种状态,并进行相应的维护。</p> <!-- /wp:paragraph -->

<!-- wp:heading {"level":3} -->

1.2 HDP

<!-- /wp:heading -->

<!-- wp:paragraph -->

<p>HDP是hortonworks的软件栈,里面包含了hadoop生态系统的所有软件项目,比如HBase,Zookeeper,Hive,Pig等等。</p> <!-- /wp:paragraph -->

<!-- wp:heading {"level":3} -->

1.3 HDP-UTILS

<!-- /wp:heading -->

<!-- wp:paragraph -->

<p>HDP-UTILS是工具类库。</p> <!-- /wp:paragraph -->

<!-- wp:heading -->

2. Ambari搭建前环境准备

<!-- /wp:heading -->

<!-- wp:heading {"level":3} -->

2.1 版本介绍

<!-- /wp:heading -->

<!-- wp:paragraph -->

<p>截止到2020.03.03,Ambari的最新版本为2.7.5,HDP的最新版本为3.1.5 </p> <!-- /wp:paragraph -->

<!-- wp:paragraph -->

<p>通过 <a href="https://supportmatrix.hortonworks.com/">https://supportmatrix.hortonworks.com/</a> 可以查询Ambari和HDP各个版本支持情况</p> <!-- /wp:paragraph -->

<!-- wp:image {"id":412} -->

<figure class="wp-block-image"><img src="http://www.shookm.com/wp-content/uploads/2020/03/image-1024x530.png" alt="" class="wp-image-412"/></figure> <!-- /wp:image -->

<!-- wp:paragraph {"align":"center"} -->

<p style="text-align:center">我这里选择的是2.7.4版本,所以使用的HDP对应版本为3.1.4</p> <!-- /wp:paragraph -->

<!-- wp:heading {"level":3} -->

<h3>2.2 搭建环境</h3> <!-- /wp:heading -->

<!-- wp:heading {"level":4} -->

<h4>2.2.1 所用到的环境列表</h4> <!-- /wp:heading -->

<!-- wp:table {"className":"is-style-stripes"} -->

<table class="wp-block-table is-style-stripes"><tbody><tr><td>环境</td><td>版本</td></tr><tr><td>Linux</td><td>Centos7物理机*4(英文系统)</td></tr><tr><td>Ambari</td><td>2.7.4</td></tr><tr><td> HDP </td><td>3.1.4</td></tr><tr><td> HDP-UTILS </td><td>1.1.0.2</td></tr><tr><td> MySQL-MariaDB/ MySQL </td><td>10.4.12/5.7</td></tr><tr><td> OracleJDK8 </td><td>1.8.0_201</td></tr><tr><td>Nginx</td><td>1.17.8(已有环境,选用,可不用)</td></tr></tbody></table> <!-- /wp:table -->

<!-- wp:heading {"level":4} -->

<h4>2.2.2 环境下载</h4> <!-- /wp:heading -->

<!-- wp:paragraph -->

<p>Ambari在线安装特别慢,所以使用离线安装,建议使用迅雷下载</p> <!-- /wp:paragraph -->

<!-- wp:table {"className":"is-style-stripes"} -->

<table class="wp-block-table is-style-stripes"><tbody><tr><td>名称</td><td>地址</td></tr><tr><td>ambari</td><td><a href="http://public-repo-1.hortonworks.com/ambari/centos7/2.x/updates/2.7.4.0/ambari-2.7.4.0-centos7.tar.gz">http://public-repo-1.hortonworks.com/ambari/centos7/2.x/updates/2.7.4.0/ambari-2.7.4.0-centos7.tar.gz</a></td></tr><tr><td>HDP </td><td><a href="http://public-repo-1.hortonworks.com/HDP/centos7/3.x/updates/3.1.4.0/HDP-3.1.4.0-centos7-rpm.tar.gz">http://public-repo-1.hortonworks.com/HDP/centos7/3.x/updates/3.1.4.0/HDP-3.1.4.0-centos7-rpm.tar.gz</a></td></tr><tr><td>HDP-UTILS </td><td><a href="http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.22/repos/centos7/HDP-UTILS-1.1.0.22-centos7.tar.gz">http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.22/repos/centos7/HDP-UTILS-1.1.0.22-centos7.tar.gz</a><br></td></tr></tbody></table> <!-- /wp:table -->

<!-- wp:paragraph -->

<p>JDK8环境</p> <!-- /wp:paragraph -->

<!-- wp:table {"className":"is-style-stripes"} -->

<table class="wp-block-table is-style-stripes"><tbody><tr><td>名称</td><td>地址</td></tr><tr><td> OracleJDK </td><td><a href="https://www.oracle.com/java/technologies/javase-jdk8-downloads.html">https://www.oracle.com/java/technologies/javase-jdk8-downloads.html</a></td></tr></tbody></table> <!-- /wp:table -->

<!-- wp:image {"id":422} -->

<figure class="wp-block-image"><img src="http://www.shookm.com/wp-content/uploads/2020/03/image-1-1024x546.png" alt="" class="wp-image-422"/></figure> <!-- /wp:image -->

<!-- wp:heading {"level":3} -->

<h3>2.4 集群节点划分</h3> <!-- /wp:heading -->

<!-- wp:table {"className":"is-style-stripes"} -->

<table class="wp-block-table is-style-stripes"><tbody><tr><td>节点名称</td><td>局域网ip地址</td><td>服务</td><td>内存</td><td>硬盘</td></tr><tr><td>master(主节点)</td><td>192.168.105.137</td><td>Ambari/HDP<br>Ambari Server<br>MariaDB /MySql</td><td>4G</td><td>450G</td></tr><tr><td>slave1(子节点)</td><td>192.168.105.191</td><td> Compute node </td><td>4G</td><td>450G</td></tr><tr><td> slave2(子节点) </td><td>192.168.105.192</td><td> Compute node </td><td>4G</td><td>450G</td></tr><tr><td> slave3(子节点) </td><td>192.168.105.193</td><td> Compute node </td><td>4G</td><td>450G</td></tr></tbody></table> <!-- /wp:table -->

<!-- wp:heading {"level":3} -->

<h3>2.5 修改网络配置(所有节点)</h3> <!-- /wp:heading -->

<!-- wp:paragraph -->

<p>用putty或者xshell连接执行</p> <!-- /wp:paragraph -->

<!-- wp:code -->

<pre class="wp-block-code"><code> # cd /etc/sysconfig/network-scripts </code></pre>

<!-- /wp:code -->

<!-- wp:image {"id":425} -->

<figure class="wp-block-image"><img src="http://www.shookm.com/wp-content/uploads/2020/03/image-3.png" alt="" class="wp-image-425"/><figcaption><br></figcaption></figure> <!-- /wp:image -->

<!-- wp:paragraph -->

<p>找到ifcfg-en开头,后面的数字由每台机器生成各有不同,直接vi编辑即可</p> <!-- /wp:paragraph -->

<!-- wp:paragraph -->

<p>修改前:</p> <!-- /wp:paragraph -->

<!-- wp:image {"id":426} -->

<figure class="wp-block-image"><img src="http://www.shookm.com/wp-content/uploads/2020/03/image-4.png" alt="" class="wp-image-426"/></figure> <!-- /wp:image -->

<!-- wp:paragraph -->

<p>修改后:</p> <!-- /wp:paragraph -->

<!-- wp:image {"id":427} -->

<figure class="wp-block-image"><img src="http://www.shookm.com/wp-content/uploads/2020/03/image-5.png" alt="" class="wp-image-427"/></figure> <!-- /wp:image -->

<!-- wp:code -->

<pre class="wp-block-code"><code>TYPE=Ethernet PROXY_METHOD=none BROWSER_ONLY=no BOOTPROTO=static IPADDR=192.168.105.137 NETMASK=255.255.255.0 GATEWAY=192.168.105.1 DNS1=114.114.114.114 DNS2=8.8.8.8 DEFROUTE=yes IPV4_FAILURE_FATAL=no IPV6INIT=yes IPV6_AUTOCONF=yes IPV6_DEFROUTE=yes IPV6_FAILURE_FATAL=no IPV6_ADDR_GEN_MODE=stable-privacy NAME=eno1 UUID=6c053b64-6581-4665-b3fc-c22f79c58848 DEVICE=eno1 ONBOOT=yes </code></pre>

<!-- /wp:code -->

<!-- wp:paragraph -->

<p> 重启网络服务:# service network start </p> <!-- /wp:paragraph -->

<!-- wp:image {"id":429} -->

<figure class="wp-block-image"><img src="http://www.shookm.com/wp-content/uploads/2020/03/image-6.png" alt="" class="wp-image-429"/></figure> <!-- /wp:image -->

<!-- wp:paragraph -->

<p>ping一下局域网其他机器 通了即可</p> <!-- /wp:paragraph -->

<!-- wp:image {"id":430} -->

<figure class="wp-block-image"><img src="http://www.shookm.com/wp-content/uploads/2020/03/image-7.png" alt="" class="wp-image-430"/></figure> <!-- /wp:image -->

<!-- wp:heading -->

<h2> 3. 系统环境配置</h2> <!-- /wp:heading -->

<!-- wp:heading {"level":3} -->

<h3>3.1 安装 JDK(所有节点)</h3> <!-- /wp:heading -->

<!-- wp:paragraph -->

<p>Linux自带的jdk或者是通过yum安装的jdk都是openjdk<br>最好是使用开源的oracle jdk,缺失部分功能,如果直接安装oracle的jdk,第三方的依赖包不会安装,我们这里是通过yum安装openjdk,并同时安装了第三方依赖包,然后卸载openjdk,通过自己来安装oracle的jdk,就能解决依赖问题。</p> <!-- /wp:paragraph -->

<!-- wp:heading {"level":4} -->

<h4>3.1.1 安装openjdk</h4> <!-- /wp:heading -->

<!-- wp:code -->

<pre class="wp-block-code"><code>[root@master ~]# yum -y install java [root@master ~]# java -version openjdk version "1.8.0_212" OpenJDK Runtime Environment (build 1.8.0_212-c061) OpenJDK 64-Bit Server VM (build 25.212-c061, mixed mode) [root@master ~]# rpm -qa|grep java javapackages-tools-3.4.1-11.el7.noarch java-1.8.0-openjdk-1.8.0.212-0.c061.el7_7.x86_64 python-javapackages-3.4.1-11.el7_7.noarch tzdata-java-2018d-1.el7_7.noarch java-1.8.0-openjdk-headless-1.8.0.212-0.c061.el7_7.x86_64</code></pre>

<!-- /wp:code -->

<!-- wp:heading {"level":4} -->

<h4>3.1.2卸载OpenJDK</h4> <!-- /wp:heading -->

<!-- wp:code -->

<pre class="wp-block-code"><code>[root@master ~]# rpm -e --nodeps java-1.8.0-openjdk-headless-1.8.0.212-0.c061.el7_7.x86_64 [root@master ~]# rpm -e --nodeps java-1.8.0-openjdk-1.8.0.212-0.c061.el7_7.x86_64</code></pre>

<!-- /wp:code -->

<!-- wp:paragraph -->

<p>安装和卸载的时候注意一下open jdk的版本号</p> <!-- /wp:paragraph -->

<!-- wp:heading {"level":4} -->

<h4>3.1.3安装之前下好的 OracleJDK (注意文件位置)</h4> <!-- /wp:heading -->

<!-- wp:code -->

<pre class="wp-block-code"><code>[root@master ~]# rpm -ivh jdk-8u161-linux-x64.rpm 准备中... ################################# [100%] 正在升级/安装... 1:jdk1.8-2000:1.8.0_201-fcs ################################# [100%] Unpacking JAR files... tools.jar... plugin.jar... javaws.jar... deploy.jar... rt.jar... jsse.jar... charsets.jar... localedata.jar... [root@master ~]# java -version java version "1.8.0_201" Java(TM) SE Runtime Environment (build 1.8.0_201-b09) Java HotSpot(TM) 64-Bit Server VM (build 25.201-b09, mixed mode) [root@master ~]# javac -version javac 1.8.0_201</code></pre>

<!-- /wp:code -->

<!-- wp:image {"id":432} -->

<figure class="wp-block-image"><img src="http://www.shookm.com/wp-content/uploads/2020/03/image-9.png" alt="" class="wp-image-432"/><figcaption> <br>验证安装成功 </figcaption></figure> <!-- /wp:image -->

<!-- wp:heading {"level":3} -->

<h3>3.2 修改节点名称(所有节点)</h3> <!-- /wp:heading -->

<!-- wp:heading {"level":4} -->

<h4>3.2.1 修改/etc/hosts文件(所有节点) </h4> <!-- /wp:heading -->

<!-- wp:paragraph -->

<p>方便通过名称来查找相应节点</p> <!-- /wp:paragraph -->

<!-- wp:code -->

<pre class="wp-block-code"><code>[root@master ~]# vi /etc/hosts 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 192.168.105.137 master 192.168.105.191 slave1 192.168.105.192 slave2 192.168.105.193 slave3</code></pre>

<!-- /wp:code -->

<!-- wp:heading {"level":4} -->

<h4>3.2.2 修改/etc/sysconfig/network(所有节点)</h4> <!-- /wp:heading -->

<!-- wp:paragraph -->

<p>各节点改成相对应的节点名即可</p> <!-- /wp:paragraph -->

<!-- wp:code -->

<pre class="wp-block-code"><code>[root@master ~]# vi /etc/sysconfig/network # Created by anaconda NETWORKING=yes HOSTNAME=master</code></pre>

<!-- /wp:code -->

<!-- wp:code -->

<pre class="wp-block-code"><code>[root@master ~]# hostnamectl set-hostname master [root@master ~]# hostname master</code></pre>

<!-- /wp:code -->

<!-- wp:paragraph -->

<p> 接下来通过测试ping各个节点名称是否调通</p> <!-- /wp:paragraph -->

<!-- wp:code -->

<pre class="wp-block-code"><code>[root@master ~]# ping slave1 PING slave1 (192.168.105.191) 56(84) bytes of data. 64 bytes from slave1 (192.168.105.191): icmp_seq=1 ttl=64 time=0.320 ms 64 bytes from slave1 (192.168.105.191): icmp_seq=2 ttl=64 time=0.282 ms 64 bytes from slave1 (192.168.105.191): icmp_seq=3 ttl=64 time=0.278 ms 64 bytes from slave1 (192.168.105.191): icmp_seq=4 ttl=64 time=0.269 ms 64 bytes from slave1 (192.168.105.191): icmp_seq=5 ttl=64 time=0.279 ms 64 bytes from slave1 (192.168.105.191): icmp_seq=6 ttl=64 time=0.277 ms 64 bytes from slave1 (192.168.105.191): icmp_seq=7 ttl=64 time=0.278 ms 64 bytes from slave1 (192.168.105.191): icmp_seq=8 ttl=64 time=0.275 ms ^C --- slave1 ping statistics --- 8 packets transmitted, 8 received, 0% packet loss, time 6999ms rtt min/avg/max/mdev = 0.269/0.282/0.320/0.018 ms </code></pre>

<!-- /wp:code -->

<!-- wp:image {"id":437} -->

<figure class="wp-block-image"><img src="http://www.shookm.com/wp-content/uploads/2020/03/image-10.png" alt="" class="wp-image-437"/></figure> <!-- /wp:image -->

<!-- wp:heading {"level":3} -->

<h3>3.3 更换所有节点为阿里巴巴yum源(所有节点)</h3> <!-- /wp:heading -->

<!-- wp:paragraph -->

<p>阿里巴巴开发者社区url: <a href="https://developer.aliyun.com/mirror/">https://developer.aliyun.com/mirror/</a><br>选择Centos</p> <!-- /wp:paragraph -->

<!-- wp:image {"id":439} -->

<figure class="wp-block-image"><img src="http://www.shookm.com/wp-content/uploads/2020/03/image-11-1024x523.png" alt="" class="wp-image-439"/></figure> <!-- /wp:image -->

<!-- wp:image {"id":440} -->

<figure class="wp-block-image"><img src="http://www.shookm.com/wp-content/uploads/2020/03/image-12.png" alt="" class="wp-image-440"/></figure> <!-- /wp:image -->

<!-- wp:paragraph -->

<p>可直接运行如下</p> <!-- /wp:paragraph -->

<!-- wp:code -->

<pre class="wp-block-code"><code>[root@master ~]# mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup [root@master ~]# curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo [root@master ~]# yum makecache</code></pre>

<!-- /wp:code -->

<!-- wp:heading {"level":3} -->

<h3>3.4 同步时间ntp</h3> <!-- /wp:heading -->

<!-- wp:heading {"level":4} -->

<h4>3.4.1 安装ntp服务(所有节点)</h4> <!-- /wp:heading -->

<!-- wp:code -->

<pre class="wp-block-code"><code>[root@master ~]# yum -y install ntp</code></pre>

<!-- /wp:code -->

<!-- wp:paragraph -->

<p>启动服务,查看状态并设置开机自启</p> <!-- /wp:paragraph -->

<!-- wp:code -->

<pre class="wp-block-code"><code>[root@master ~]# systemctl start ntpd.service [root@master ~]# systemctl status ntpd.service ● ntpd.service - Network Time Service Loaded: loaded (/usr/lib/systemd/system/ntpd.service; disabled; vendor preset: disabled) Active: active (running) since Mon 2020-03-02 15:41:28 CST; 23h ago Main PID: 3909 (ntpd) CGroup: /system.slice/ntpd.service └─3909 /usr/sbin/ntpd -u ntp:ntp -g Mar 02 15:41:28 master ntpd[3909]: Listen normally on 4 lo ::1 UDP 123 Mar 02 15:41:28 master ntpd[3909]: Listen normally on 5 eno1 fe80::7b94:c6e6:5673:c105 UDP 123 Mar 02 15:41:28 master ntpd[3909]: Listening on routing socket on fd #22 for interface updates Mar 02 15:41:28 master systemd[1]: Started Network Time Service. Mar 02 15:41:28 master ntpd[3909]: 0.0.0.0 c016 06 restart Mar 02 15:41:28 master ntpd[3909]: 0.0.0.0 c012 02 freq_set kernel 0.000 PPM Mar 02 15:41:28 master ntpd[3909]: 0.0.0.0 c011 01 freq_not_set Mar 02 15:41:35 master ntpd[3909]: 0.0.0.0 c614 04 freq_mode Mar 02 15:58:21 master ntpd[3909]: 0.0.0.0 0612 02 freq_set kernel 8.697 PPM Mar 02 15:58:21 master ntpd[3909]: 0.0.0.0 0615 05 clock_sync [root@master ~]# systemctl enable ntpd.service</code></pre>

<!-- /wp:code -->

<!-- wp:image {"id":441} -->

<figure class="wp-block-image"><img src="http://www.shookm.com/wp-content/uploads/2020/03/image-13.png" alt="" class="wp-image-441"/></figure> <!-- /wp:image -->

<!-- wp:image {"id":444} -->

<figure class="wp-block-image"><img src="http://www.shookm.com/wp-content/uploads/2020/03/image-14.png" alt="" class="wp-image-444"/></figure> <!-- /wp:image -->

<!-- wp:heading {"level":3} -->

<h3>3.5 关闭防火墙(所有节点)</h3> <!-- /wp:heading -->

<!-- wp:paragraph -->

<p><strong>查看防火墙状态</strong></p> <!-- /wp:paragraph -->

<!-- wp:code -->

<pre class="wp-block-code"><code>[root@master ~]# systemctl status firewalld.service</code></pre>

<!-- /wp:code -->

<!-- wp:paragraph -->

<p><strong>关闭防火墙</strong></p> <!-- /wp:paragraph -->

<!-- wp:code -->

<pre class="wp-block-code"><code>[root@master ~]# systemctl stop firewalld.service</code></pre>

<!-- /wp:code -->

<!-- wp:paragraph -->

<p><strong>设置开机不启动</strong></p> <!-- /wp:paragraph -->

<!-- wp:code -->

<pre class="wp-block-code"><code>[root@master ~]# systemctl disable firewalld.service</code></pre>

<!-- /wp:code -->

<!-- wp:paragraph -->

<p><strong> 查看是否成功</strong></p> <!-- /wp:paragraph -->

<!-- wp:code -->

<pre class="wp-block-code"><code>[root@master ~]# systemctl is-enabled firewalld.service disabled</code></pre>

<!-- /wp:code -->

<!-- wp:heading {"level":3} -->

<h3>3.6 关闭Selinux和THP(所有节点)</h3> <!-- /wp:heading -->

<!-- wp:heading {"level":4} -->

<h4>3.6.1关闭Selinux</h4> <!-- /wp:heading -->

<!-- wp:paragraph -->

<p>查看Selinux状态</p> <!-- /wp:paragraph -->

<!-- wp:code -->

<pre class="wp-block-code"><code>[root@master ~]# sestatus</code></pre>

<!-- /wp:code -->

<!-- wp:paragraph -->

<p>关闭Selinux,提示没有vim用yum装一个咯或者用vi</p> <!-- /wp:paragraph -->

<!-- wp:code -->

<pre class="wp-block-code"><code>[root@master ~]# vim /etc/sysconfig/selinux # This file controls the state of SELinux on the system. # SELINUX= can take one of these three values: # enforcing - SELinux security policy is enforced. # permissive - SELinux prints warnings instead of enforcing. # disabled - No SELinux policy is loaded. SELINUX=disabled # SELINUXTYPE= can take one of three two values: # targeted - Targeted processes are protected, # minimum - Modification of targeted policy. Only selected processes are protected. # mls - Multi Level Security protection. SELINUXTYPE=targeted </code></pre>

<!-- /wp:code -->

<!-- wp:image {"id":446} -->

<figure class="wp-block-image"><img src="http://www.shookm.com/wp-content/uploads/2020/03/image-15.png" alt="" class="wp-image-446"/></figure> <!-- /wp:image -->

<!-- wp:heading {"level":4} -->

<h4 id="mce_265"> 3.6.2关闭THP</h4> <!-- /wp:heading -->

<!-- wp:paragraph -->

<p>查看状态</p> <!-- /wp:paragraph -->

<!-- wp:code -->

<pre class="wp-block-code"><code>[root@yum ~]# cat /sys/kernel/mm/transparent_hugepage/defrag [always] madvise never [root@yum ~]# cat /sys/kernel/mm/transparent_hugepage/enabled [always] madvise never</code></pre>

<!-- /wp:code -->

<!-- wp:paragraph -->

<p>关闭THP并给予文件权限</p> <!-- /wp:paragraph -->

<!-- wp:code -->

<pre class="wp-block-code"><code>[root@yum ~]# vim /etc/rc.d/rc.local #!/bin/bash # THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES # # It is highly advisable to create own systemd services or udev rules # to run scripts during boot instead of using this file. # # In contrast to previous versions due to parallel execution during boot # this script will NOT be run after all other services. # # Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure # that this script will be executed during boot. touch /var/lock/subsys/local if test -f /sys/kernel/mm/transparent_hugepage/enabled; then echo never > /sys/kernel/mm/transparent_hugepage/enabled fi if test -f /sys/kernel/mm/transparent_hugepage/defrag; then echo never > /sys/kernel/mm/transparent_hugepage/defrag fi [root@yum ~]# chmod +x /etc/rc.d/rc.local</code></pre>

<!-- /wp:code -->

<!-- wp:image {"id":447} -->

<figure class="wp-block-image"><img src="http://www.shookm.com/wp-content/uploads/2020/03/image-16.png" alt="" class="wp-image-447"/></figure> <!-- /wp:image -->

<!-- wp:heading {"level":3} -->

<h3>3.7 修改文件打开最大限制(所有节点)</h3> <!-- /wp:heading -->

<!-- wp:paragraph -->

<p>设置并查看</p> <!-- /wp:paragraph -->

<!-- wp:preformatted -->

<pre class="wp-block-preformatted">[root@master ~]# vim /etc/security/limits.conf <br># End of file <br>* soft nofile 65536 <br>* hard nofile 65536 <br>* soft nproc 131072 <br>* hard nproc 131072<br> <br>[root@master ~]# ulimit -Sn <br>[root@master ~]# ulimit -Hn <br></pre>

<!-- /wp:preformatted -->

<!-- wp:heading {"level":3} -->

<h3>3.8 SSH无密码登陆(主节点)</h3> <!-- /wp:heading -->

<!-- wp:paragraph -->

<p>回车通过,输入密码等确认通过即可</p> <!-- /wp:paragraph -->

<!-- wp:code -->

<pre class="wp-block-code"><code>[root@master ~]# ssh-keygen -t rsa [root@master ~]# ssh-copy-id slave1 root@slave1's password: Number of key(s) added: 1 Now try logging into the machine, with: "ssh 'slave1'" and check to make sure that only the key(s) you wanted were added. [root@master ~]# ssh-copy-id slave2 Are you sure you want to continue connecting (yes/no)? yes root@slave2's password: Number of key(s) added: 1 [root@master ~]# ssh-copy-id slave3 Are you sure you want to continue connecting (yes/no)? yes root@slave3's password: Number of key(s) added: 1 [root@master ~]# ssh-copy-id master Are you sure you want to continue connecting (yes/no)? yes root@master's password: Number of key(s) added: 1 Now try logging into the machine, with: "ssh 'master'" and check to make sure that only the key(s) you wanted were added</code></pre>

<!-- /wp:code -->

<!-- wp:paragraph -->

<p> 测试是否实现无密码登录 ,无输入密码即可通过</p> <!-- /wp:paragraph -->

<!-- wp:code -->

<pre class="wp-block-code"><code>[root@master ~]# ssh slave1 date ;ssh slave2 date;ssh slave3 date;ssh master date; Tue Mar 3 16:32:07 CST 2020 Tue Mar 3 16:32:07 CST 2020 Tue Mar 3 16:32:07 CST 2020 Tue Mar 3 16:32:08 CST 2020 </code></pre>

<!-- /wp:code -->

<!-- wp:image {"id":449} -->

<figure class="wp-block-image"><img src="http://www.shookm.com/wp-content/uploads/2020/03/image-17.png" alt="" class="wp-image-449"/></figure> <!-- /wp:image -->

<!-- wp:paragraph -->

<p>将刚刚创建的秘钥拷出来,后面ambari安装的时候需要上传这个秘钥。创建秘钥是在隐藏文件夹/root/.ssh/下面的,所以需要先把秘钥拷贝到可见区域,然后拷贝到本机上。</p> <!-- /wp:paragraph -->

<!-- wp:code -->

<pre class="wp-block-code"><code>[root@master ~]# cd /root/.ssh/ [root@master .ssh]# ls authorized_keys id_rsa id_rsa.pub known_hosts [root@master .ssh]# cp id_rsa /root/ [root@master .ssh]# ls /root/ ambari ambari-2.7.4.0-centos7.tar.gz id_rsa anaconda-ks.cfg install.sh jdk-8u201-linux-x64.rpm </code></pre>

<!-- /wp:code -->

<!-- wp:image {"id":451} -->

<figure class="wp-block-image"><img src="http://www.shookm.com/wp-content/uploads/2020/03/image-18.png" alt="" class="wp-image-451"/></figure> <!-- /wp:image -->

<!-- wp:paragraph -->

<p>到这里我们先reboot重启一下</p> <!-- /wp:paragraph -->

<!-- wp:heading -->

<h2> 4. 实现离线安装,更换yum源</h2> <!-- /wp:heading -->

<!-- wp:heading {"level":3} -->

<h3>4.1 文件目录展示</h3> <!-- /wp:heading -->

<!-- wp:paragraph -->

<p> 由于我这里主机已经安装了Nginx,所以文件目录的方式我这里写了两种展示目录的方式 ,4.1.1和4.1.2选择一种即可</p> <!-- /wp:paragraph -->

<!-- wp:heading {"level":4} -->

<h4>4.1.1 http服务方式<br></h4> <!-- /wp:heading -->

<!-- wp:code -->

<pre class="wp-block-code"><code>[root@master ~]# yum -y install httpd [root@master ~]# service httpd restart Redirecting to /bin/systemctl restart httpd.service [root@master ~]# chkconfig httpd on</code></pre>

<!-- /wp:code -->

<!-- wp:paragraph -->

<p> 安装完成后,会生成 /var/www/html目录(相当于Tomcat的webapps目录) </p> <!-- /wp:paragraph -->

<!-- wp:paragraph -->

<p>将之前下的Ambari、HDP、HDP-UTILS三个包放到 /var/www/html 下</p> <!-- /wp:paragraph -->

<!-- wp:code -->

<pre class="wp-block-code"><code>[root@master ~]# cd /var/www/html/ [root@master html]# mkdir ambari 拷贝文件到ambari下面 [root@master html]# cd ambari/ [root@master ambari]# ls ambari-2.7.4.0-centos7.tar.gz HDP-3.1.4.0-centos7-rpm.tar.gz HDP-UTILS-1.1.0.22-centos7.tar.gz [root@master ambari]# tar -zxvf ambari-2.7.4.0-centos7.tar.gz [root@master ambari]# tar -zxvf HDP-3.1.4.0-centos7-rpm.tar.gz [root@master ambari]# mkdir HDP-UTILS [root@master ambari]# tar -zxvf HDP-UTILS-1.1.0.22-centos7.tar.gz -C HDP-UTILS [root@master ambari]# rm -rf ambari--2.7.4.0-centos7.tar.gz HDP-2.6.3.0-centos7-rpm.tar.gz HDP-UTILS-1.1.0.22-centos7.tar.gz [root@master ambari]# ls ambari HDP HDP-UTILS</code></pre>

<!-- /wp:code -->

<!-- wp:heading {"level":4} -->

<h4>4.1.2 nginx服务方式</h4> <!-- /wp:heading -->

<!-- wp:paragraph -->

<p>找到nginx的配置, 在nginx server中的location中增加: </p> <!-- /wp:paragraph -->

<!-- wp:code -->

<pre class="wp-block-code"><code> server { listen 8001; location / { root /www//html/ambari/; autoindex on; autoindex_localtime on; autoindex_exact_size off; } } </code></pre>

<!-- /wp:code -->

<!-- wp:paragraph -->

<p>参数说明:<br> root /data/image/<br> 你需要开启浏览的目录,放访问<br> http://IP 时候显示的就是/data/image目录下的内容</p> <!-- /wp:paragraph -->

<!-- wp:paragraph -->

<p>autoindex_localtime on;<br> 默认为off,显示的文件时间为GMT时间。<br> 改为on后,显示的文件时间为文件的服务器时间</p> <!-- /wp:paragraph -->

<!-- wp:paragraph -->

<p>autoindex_exact_size off;<br> 默认为on,显示出文件的确切大小,单位是bytes。<br> 改为off后,显示出文件的大概大小,单位是kB或者MB或者GB<br></p> <!-- /wp:paragraph -->

<!-- wp:paragraph -->

<p>listen 8001;<br>访问端口号,</p> <!-- /wp:paragraph -->

<!-- wp:code -->

<pre class="wp-block-code"><code>[root@master ~]# cd /var/www/ [root@master html]# mkdir ambari 拷贝文件到ambari下面 [root@master html]# cd ambari/ [root@master ambari]# ls ambari-2.7.4.0-centos7.tar.gz HDP-3.1.4.0-centos7-rpm.tar.gz HDP-UTILS-1.1.0.22-centos7.tar.gz [root@master ambari]# tar -zxvf ambari-2.7.4.0-centos7.tar.gz [root@master ambari]# tar -zxvf HDP-3.1.4.0-centos7-rpm.tar.gz [root@master ambari]# mkdir HDP-UTILS [root@master ambari]# tar -zxvf HDP-UTILS-1.1.0.22-centos7.tar.gz -C HDP-UTILS [root@master ambari]# rm -rf ambari--2.7.4.0-centos7.tar.gz HDP-2.6.3.0-centos7-rpm.tar.gz HDP-UTILS-1.1.0.22-centos7.tar.gz [root@master ambari]# ls ambari HDP HDP-UTILS</code></pre>

<!-- /wp:code -->

<!-- wp:image {"id":452} -->

<figure class="wp-block-image"><img src="http://www.shookm.com/wp-content/uploads/2020/03/image-19.png" alt="" class="wp-image-452"/></figure> <!-- /wp:image -->

<!-- wp:paragraph -->

<p> 访问 http://192.168.105.137/ambari/ 看是否能访问</p> <!-- /wp:paragraph -->

<!-- wp:image {"id":454} -->

<figure class="wp-block-image"><img src="http://www.shookm.com/wp-content/uploads/2020/03/image-21.png" alt="" class="wp-image-454"/></figure> <!-- /wp:image -->

<!-- wp:heading {"level":3} -->

<h3>4.2 制作本地源</h3> <!-- /wp:heading -->

<!-- wp:heading {"level":4} -->

<h4>4.2.1 安装本地源制作相关工具(主节点)</h4> <!-- /wp:heading -->

<!-- wp:code -->

<pre class="wp-block-code"><code>[root@master ambari]# yum install yum-utils createrepo yum-plugin-priorities -y [root@master ambari]# createrepo ./</code></pre>

<!-- /wp:code -->

<!-- wp:heading {"level":4} -->

<h4>4.2.2 修改文件里面的源地址(主节点)</h4> <!-- /wp:heading -->

<!-- wp:paragraph -->

<p>注意文件路径,以自己为准</p> <!-- /wp:paragraph -->

<!-- wp:code -->

<pre class="wp-block-code"><code>[root@master ambari]# vi ambari/centos7/2.7.4.0-118/ambari.repo #VERSION_NUMBER=2.7.4.0-118 [ambari-2.7.4.0] #json.url = http://public-repo-1.hortonworks.com/HDP/hdp_urlinfo.json name=ambari Version - ambari-2.7.4.0 baseurl=http://192.168.105.137:8001/ambari/centos7/2.7.4.0-118 gpgcheck=1 gpgkey=http://192.168.105.137:8001/ambari/centos7/2.7.4.0-118/RPM-GPG-KEY/RPM-GPG-KEY-Jenkins enabled=1 priority=1 [root@master ambari]# cp ambari/centos7/2.7.4.0-118/ambari.repo /etc/yum.repos.d/ [root@master ambari]# vi HDP/centos7/3.1.4.0-315/hdp.repo #VERSION_NUMBER=3.1.4.0-315 [HDP-3.1.4.0] name=HDP Version - HDP-3.1.4.0 baseurl=http://192.168.105.137:8001/HDP/centos7/3.1.4.0-315 gpgcheck=1 gpgkey=http://192.168.105.137:8001/HDP/centos7/3.1.4.0-315/RPM-GPG-KEY/RPM-GPG-KEY-Jenkins enabled=1 priority=1 [HDP-UTILS-1.1.0.22] name=HDP-UTILS Version - HDP-UTILS-1.1.0.22 baseurl=http://192.168.105.137:8001/HDP-UTILS/HDP-UTILS/centos7/1.1.0.22 gpgcheck=1 gpgkey=http://192.168.105.137:8001/HDP-UTILS/HDP-UTILS/centos7/1.1.0.22/RPM-GPG-KEY/RPM-GPG-KEY-Jenkins enabled=1 priority=1 [root@master ambari]# cp HDP/centos7/3.1.4.0-315/hdp.repo /etc/yum.repos.d/</code></pre>

<!-- /wp:code -->

<!-- wp:paragraph -->

<p>以上就已经创建好了</p> <!-- /wp:paragraph -->

<!-- wp:paragraph -->

<p>使用yum的命令清一下缓存</p> <!-- /wp:paragraph -->

<!-- wp:code -->

<pre class="wp-block-code"><code>[root@master ambari]# yum clean all [root@master ambari]# yum makecache [root@master ambari]# yum repolist</code></pre>

<!-- /wp:code -->

<!-- wp:heading {"level":4} -->

<h4>4.2.3 将创建好的源文件拷贝到子节点(主节点)</h4> <!-- /wp:heading -->

<!-- wp:code -->

<pre class="wp-block-code"><code>[root@master ambari]#cd /etc/yum.repos.d [root@master yum.repos.d]# scp ambari.repo slave1:/etc/yum.repos.d/ ambari.repo 100% 274 24.8KB/s 00:00 [root@master yum.repos.d]# scp ambari.repo slave2:/etc/yum.repos.d/ ambari.repo 100% 274 294.9KB/s 00:00 [root@master yum.repos.d]# scp ambari.repo slave3:/etc/yum.repos.d/ ambari.repo 100% 274 541.7KB/s 00:00 [root@master yum.repos.d]# scp hdp.repo slave1:/etc/yum.repos.d/ hdp.repo 100% 482 603.6KB/s 00:00 [root@master yum.repos.d]# scp hdp.repo slave2:/etc/yum.repos.d/ hdp.repo 100% 482 541.9KB/s 00:00 [root@master yum.repos.d]# scp hdp.repo slave3:/etc/yum.repos.d/ hdp.repo</code></pre>

<!-- /wp:code -->

<!-- wp:heading -->

<h2> 5. 安装ambari-server</h2> <!-- /wp:heading -->

<!-- wp:paragraph -->

<p>这里介绍两种模式,一种是默认postgresql数据库的安装方式,这种不推荐生产环境使用,但是在安装中不会出现问题,还有就是mysql方式,这里我们用到的是mysql,大家根据自身选一种即可</p> <!-- /wp:paragraph -->

<!-- wp:paragraph -->

<p>无论是用哪种,首先都要安装ambari-server</p> <!-- /wp:paragraph -->

<!-- wp:code -->

<pre class="wp-block-code"><code>[root@master yum.repos.d]# yum -y install ambari-server</code></pre>

<!-- /wp:code -->

<!-- wp:heading {"level":3} -->

<h3>5.1默认数据库PostgreSQL安装方式(不推荐)(主节点)</h3> <!-- /wp:heading -->

<!-- wp:code -->

<pre class="wp-block-code"><code>[root@master yum.repos.d]# ambari-server setup Using python /usr/bin/python Setup ambari-server Checking SELinux... SELinux status is 'disabled' Customize user account for ambari-server daemon [y/n] (n)? n Adjusting ambari-server permissions and ownership... Checking firewall status... Checking JDK... [1] Oracle JDK 1.8 + Java Cryptography Extension (JCE) Policy Files 8 [2] Custom JDK ============================================================================== Enter choice (1): 2 WARNING: JDK must be installed on all hosts and JAVA_HOME must be valid on all hosts. WARNING: JCE Policy files are required for configuring Kerberos security. If you plan to use Kerberos,please make sure JCE Unlimited Strength Jurisdiction Policy Files are valid on all hosts. Path to JAVA_HOME: /usr/java/jdk1.8.0_202 Validating JDK on Ambari Server...done. Completing setup... Configuring database... Enter advanced database configuration [y/n] (n)? n Configuring database... Default properties detected. Using built-in database. Configuring ambari database... Checking PostgreSQL... Running initdb: This may take up to a minute. Initializing database ... OK About to start PostgreSQL Configuring local database... Configuring PostgreSQL... Restarting PostgreSQL Creating schema and user... done. Creating tables... done. Extracting system views... ambari-admin-2.7.4.0-118.jar ........... Adjusting ambari-server permissions and ownership... Ambari Server 'setup' completed successfully.</code></pre>

<!-- /wp:code -->

<!-- wp:paragraph -->

<p>启动ambari</p> <!-- /wp:paragraph -->

<!-- wp:code -->

<pre class="wp-block-code"><code>[root@master yum.repos.d]# ambari-server start Using python /usr/bin/python Starting ambari-server Ambari Server running with administrator privileges. Organizing resource files at /var/lib/ambari-server/resources... Ambari database consistency check started... Server PID at: /var/run/ambari-server/ambari-server.pid Server out at: /var/log/ambari-server/ambari-server.out Server log at: /var/log/ambari-server/ambari-server.log Waiting for server start........................................... Server started listening on 8080 DB configs consistency check: no errors and warnings were found. Ambari Server 'start' completed successfully.</code></pre>

<!-- /wp:code -->

<!-- wp:paragraph -->

<p>成功启动后在浏览器输入Ambari地址: <br><a href="http://192.168.12.101:8080/">http://192.168.105.137:8080</a> 即可看到</p> <!-- /wp:paragraph -->

<!-- wp:heading {"level":3} -->

<h3 id="mce_371">5.2 MySql安装方式(主节点)</h3> <!-- /wp:heading -->

<!-- wp:heading {"level":4} -->

<h4>5.2.1 安装MySql</h4> <!-- /wp:heading -->

<!-- wp:code -->

<pre class="wp-block-code"><code>[root@master ~]# wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm [root@master ~]# rpm -ivh mysql-community-release-el7-5.noarch.rpm [root@master ~]# yum install mysql-community-serve</code></pre>

<!-- /wp:code -->

<!-- wp:heading {"level":4} -->

<h4>5.2.2 启动mysql,设置开机启动</h4> <!-- /wp:heading -->

<!-- wp:code -->

<pre class="wp-block-code"><code>[root@master ~]# service mysqld start [root@master ~]# vi /etc/rc.local #添加service mysqld start</code></pre>

<!-- /wp:code -->

<!-- wp:heading {"level":4} -->

<h4 id="mce_383">5.2.3 登录进mysql,初始化设置root密码 </h4> <!-- /wp:heading -->

<!-- wp:code -->

<pre class="wp-block-code"><code>[root@master ~]# mysql -uroot 设置登录密码 mysql> set password for 'root'@'localhost' = password('yourPassword'); 添加远程登录用户 mysql> grant all privileges on *.* to 'root'@'%' identified by 'yourPassword'; 远程登录 #mysql -uroot -h ip(远程的ip地址) -p </code></pre>

<!-- /wp:code -->

<!-- wp:heading {"level":4} -->

<h4>5.2.4登录mysql,执行以下的语句</h4> <!-- /wp:heading -->

<!-- wp:code -->

<pre class="wp-block-code"><code>CREATE DATABASE ambari; use ambari; CREATE USER 'ambari'@'%' IDENTIFIED BY 'ambari'; GRANT ALL PRIVILEGES ON *.* TO 'ambari'@'%'; CREATE USER 'ambari'@'localhost' IDENTIFIED BY 'ambar'; GRANT ALL PRIVILEGES ON *.* TO 'ambari'@'localhost'; CREATE USER 'ambari'@'master' IDENTIFIED BY 'ambari'; GRANT ALL PRIVILEGES ON *.* TO 'ambari'@'master'; FLUSH PRIVILEGES; source /var/lib/ambari-server/resources/Ambari-DDL-MySQL-CREATE.sql show tables; use mysql; select Host User Password from user where user='ambari'; CREATE DATABASE hive; use hive; CREATE USER 'hive'@'%' IDENTIFIED BY 'hive'; GRANT ALL PRIVILEGES ON *.* TO 'hive'@'%'; CREATE USER 'hive'@'localhost' IDENTIFIED BY 'hive'; GRANT ALL PRIVILEGES ON *.* TO 'hive'@'localhost'; CREATE USER 'hive'@'master' IDENTIFIED BY 'hive'; GRANT ALL PRIVILEGES ON *.* TO 'hive'@'master'; FLUSH PRIVILEGES; CREATE DATABASE oozie; use oozie; CREATE USER 'oozie'@'%' IDENTIFIED BY 'oozie'; GRANT ALL PRIVILEGES ON *.* TO 'oozie'@'%'; CREATE USER 'oozie'@'localhost' IDENTIFIED BY 'oozie'; GRANT ALL PRIVILEGES ON *.* TO 'oozie'@'localhost'; CREATE USER 'oozie'@'master' IDENTIFIED BY 'oozie'; GRANT ALL PRIVILEGES ON *.* TO 'oozie'@'master'; FLUSH PRIVILEGES;</code></pre>

<!-- /wp:code -->

<!-- wp:heading {"level":4} -->

<h4 id="mce_391">5.2.5 建立mysql与ambari-server的jdbc连接 </h4> <!-- /wp:heading -->

<!-- wp:code -->

<pre class="wp-block-code"><code>[root@master yum.repos.d]# yum install mysql-connector-java [root@master yum.repos.d]# ls /usr/share/java [root@master yum.repos.d]# cp /usr/share/java/mysql-connector-java.jar /var/lib/ambari-server/resources/mysql-jdbc-driver.jar [root@master yum.repos.d]# vi /etc/ambari-server/conf/ambari.properties 添加server.jdbc.driver.path=/usr/share/java/mysql-connector-java.jar</code></pre>

<!-- /wp:code -->

<!-- wp:heading {"level":3} -->

<h3>5.2.6设置ambari-server</h3> <!-- /wp:heading -->

<!-- wp:code -->

<pre class="wp-block-code"><code>[root@master yum.repos.d]# ambari-server setup Using python /usr/bin/python Setup ambari-server Checking SELinux... SELinux status is 'enabled' SELinux mode is 'permissive' WARNING: SELinux is set to 'permissive' mode and temporarily disabled. OK to continue [y/n] (y)? y Customize user account for ambari-server daemon [y/n] (n)? y Enter user account for ambari-server daemon (root):ambari #ambari-server 账号。如果直接回车就是默认选择root用户 如果输入已经创建的用户就会显示: Adjusting ambari-server permissions and ownership... Checking firewall status... WARNING: iptables is running. Confirm the necessary Ambari ports are accessible. Refer to the Ambari documentation for more details on ports. OK to continue [y/n] (y)? y Checking JDK... #设置JDK。输入:2 [1] Oracle JDK 1.8 + Java Cryptography Extension (JCE) Policy Files 8 [2] Custom JDK ============================================================================== Enter choice (1): 2 #输入你自己的jdk位置/usr/java/jdk1.8.0_201-amd64 WARNING: JDK must be installed on all hosts and JAVA_HOME must be valid on all hosts. WARNING: JCE Policy files are required for configuring Kerberos security. If you plan to use Kerberos,please make sure JCE Unlimited Strength Jurisdiction Policy Files are valid on all hosts. Path to JAVA_HOME: /usr/java/jdk1.8.0_201-amd64 Validating JDK on Ambari Server...done. Check JDK version for Ambari Server... JDK version found: 8 Minimum JDK version is 8 for Ambari. Skipping to setup different JDK for Ambari Server. Checking GPL software agreement... GPL License for LZO: https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html Enable Ambari Server to download and install GPL Licensed LZO packages [y/n] (n)? n Completing setup... Configuring database... Enter advanced database configuration [y/n] (n)? y #数据库配置。选择:y Configuring database... ============================================================================== Choose one of the following options: [1] - PostgreSQL (Embedded) [2] - Oracle [3] - MySQL / MariaDB [4] - PostgreSQL [5] - Microsoft SQL Server (Tech Preview) [6] - SQL Anywhere [7] - BDB ============================================================================== Enter choice (1): 3 #选择mysql数据库类型。输入:3 # 设置数据库的具体配置信息,根据实际情况输入,如果和括号内相同,则可以直接回车。 Hostname (localhost): Port (3306): Database name (ambari): Username (ambari): ambari Enter Database Password (bigdata): ambari Re-enter password: ambari Configuring ambari database... Configuring remote database connection properties... WARNING: Before starting Ambari Server, you must run the following DDL directly from the database shell to create the schema: /var/lib/ambari-server/resources/Ambari-DDL-MySQL-CREATE.sql Proceed with configuring remote database connection properties [y/n] (y)? y Extracting system views... ambari-admin-2.7.4.0.118.jar .... Ambari repo file contains latest json url http://public-repo-1.hortonworks.com/HDP/hdp_urlinfo.json, updating stacks repoinfos with it... Adjusting ambari-server permissions and ownership... Ambari Server 'setup' completed successfully. [root@master yum.repos.d]# ambari-server start Using python /usr/bin/python Starting ambari-server Ambari Server running with administrator privileges. Organizing resource files at /var/lib/ambari-server/resources... Ambari database consistency check started... Server PID at: /var/run/ambari-server/ambari-server.pid Server out at: /var/log/ambari-server/ambari-server.out Server log at: /var/log/ambari-server/ambari-server.log Waiting for server start........................................... Server started listening on 8080 DB configs consistency check: no errors and warnings were found. Ambari Server 'start' completed successfully.</code></pre>

<!-- /wp:code -->

<!-- wp:paragraph -->

<p>如果启动失败 建议查看 <br>日志在/var/log/ambari-server/ambari-server.log里面 <br>重置 ambari-server </p> <!-- /wp:paragraph -->

<!-- wp:code -->

<pre class="wp-block-code"><code>[root@master ~]# ambari-server stop [root@master ~]# ambari-server reset [root@master ~]# ambari-server setup</code></pre>

<!-- /wp:code -->

<!-- wp:paragraph -->

<p> 如果选择的是mysql方式,就需要先执行上面的语句,然后手动将mysql里面创建的数据库进行删除 </p> <!-- /wp:paragraph -->

<!-- wp:code -->

<pre class="wp-block-code"><code>[root@master ~]# mysql -uroot -p mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | ambari | | hive | | oozie | | performance_schema | +--------------------+ rows in set (0.00 sec) mysql> drop database ambari; mysql> drop database hive; mysql> drop database oozie;</code></pre>

<!-- /wp:code -->

<!-- wp:paragraph -->

<p> 如果在安装的过程中出现了错误,又想重新安装,可以在ambari-server开启的情况下,执行下面的语句来移除已安装的包,然后再通过不同的情况选择上面两种方式的一种对ambari-server进行重置 </p> <!-- /wp:paragraph -->

<!-- wp:code -->

<pre class="wp-block-code"><code>python /usr/lib/python2.6/site-packages/ambari_agent/HostCleanup.py --silent</code></pre>

<!-- /wp:code -->

<!-- wp:heading -->

<h2> 6. 安装配置部署HDP集群</h2> <!-- /wp:heading -->

<!-- wp:heading {"level":3} -->

<h3>6.1 登录过程</h3> <!-- /wp:heading -->

<!-- wp:paragraph -->

<p>如果你以上安装成功<br>输入主机ip:8080则会看到如下界面 <br>账户:admin 密码:admin </p> <!-- /wp:paragraph -->

<!-- wp:image {"id":455} -->

<figure class="wp-block-image"><img src="http://www.shookm.com/wp-content/uploads/2020/03/image-22-1024x402.png" alt="" class="wp-image-455"/><figcaption><br><br></figcaption></figure> <!-- /wp:image -->

<!-- wp:heading {"level":3} -->

<h3>5.2 安装向导</h3> <!-- /wp:heading -->

<!-- wp:paragraph -->

<p>登录后点击进入流程</p> <!-- /wp:paragraph -->

<!-- wp:image {"id":460} -->

<figure class="wp-block-image"><img src="http://www.shookm.com/wp-content/uploads/2020/03/image-25-1024x530.png" alt="" class="wp-image-460"/></figure> <!-- /wp:image -->

<!-- wp:heading {"level":4} -->

<h4>6.2.1 配置及群名字 </h4> <!-- /wp:heading -->

<!-- wp:paragraph -->

<p>我这用到的是hadoop</p> <!-- /wp:paragraph -->

<!-- wp:image {"id":461} -->

<figure class="wp-block-image"><img src="http://www.shookm.com/wp-content/uploads/2020/03/image-26-1024x447.png" alt="" class="wp-image-461"/></figure> <!-- /wp:image -->

<!-- wp:heading {"level":4} -->

<h4>6.2.2 选择版本并修改为本地源地址</h4> <!-- /wp:heading -->

<!-- wp:image {"id":462} -->

<figure class="wp-block-image"><img src="http://www.shookm.com/wp-content/uploads/2020/03/image-27-1024x535.png" alt="" class="wp-image-462"/><figcaption><br></figcaption></figure> <!-- /wp:image -->

<!-- wp:paragraph -->

<p>放一张机翻的配置</p> <!-- /wp:paragraph -->

<!-- wp:image {"id":463} -->

<figure class="wp-block-image"><img src="http://www.shookm.com/wp-content/uploads/2020/03/image-28-1024x506.png" alt="" class="wp-image-463"/></figure> <!-- /wp:image -->

<!-- wp:paragraph -->

<p>ambari确认过了就next继续了</p> <!-- /wp:paragraph -->

<!-- wp:heading {"level":4} -->

<h4>6.2.3 安装配置</h4> <!-- /wp:heading -->

<!-- wp:paragraph -->

<p>上传之前存好的秘钥文件id_rsa </p> <!-- /wp:paragraph -->

<!-- wp:image {"id":464} -->

<figure class="wp-block-image"><img src="http://www.shookm.com/wp-content/uploads/2020/03/image-29-1024x547.png" alt="" class="wp-image-464"/></figure> <!-- /wp:image -->

<!-- wp:paragraph -->

<p>机翻页面</p> <!-- /wp:paragraph -->

<!-- wp:image {"id":465} -->

<figure class="wp-block-image"><img src="http://www.shookm.com/wp-content/uploads/2020/03/image-30-1024x590.png" alt="" class="wp-image-465"/></figure> <!-- /wp:image -->

<!-- wp:heading {"level":4} -->

<h4>6.2.4 确认安装ambari的agent</h4> <!-- /wp:heading -->

<!-- wp:paragraph -->

<p>确认安装ambari的agent,并检查出现的问题,这个地方经常出现错误</p> <!-- /wp:paragraph -->

<!-- wp:image {"id":466} -->

<figure class="wp-block-image"><img src="http://www.shookm.com/wp-content/uploads/2020/03/image-31-1024x488.png" alt="" class="wp-image-466"/></figure> <!-- /wp:image -->

<!-- wp:paragraph -->

<p>如图就出现了错误,点击Failed的查看错误日志</p> <!-- /wp:paragraph -->

<!-- wp:image {"id":467} -->

<figure class="wp-block-image"><img src="http://www.shookm.com/wp-content/uploads/2020/03/image-32-1024x467.png" alt="" class="wp-image-467"/></figure> <!-- /wp:image -->

<!-- wp:image {"id":468} -->

<figure class="wp-block-image"><img src="http://www.shookm.com/wp-content/uploads/2020/03/image-33-1024x527.png" alt="" class="wp-image-468"/></figure> <!-- /wp:image -->

<!-- wp:paragraph -->

<p>像我这里的错误是ambari的8040等端口无法访问的问题,我放开了8000-9000的端口就可以了,我之前也遇到很多其他的问题,具体问题具体分析,多查谷歌,百度,国外的网站更容易解决问题</p> <!-- /wp:paragraph -->

<!-- wp:image {"id":469} -->

<figure class="wp-block-image"><img src="http://www.shookm.com/wp-content/uploads/2020/03/image-34-1024x464.png" alt="" class="wp-image-469"/></figure> <!-- /wp:image -->

<!-- wp:paragraph -->

<p>机翻</p> <!-- /wp:paragraph -->

<!-- wp:image {"id":471} -->

<figure class="wp-block-image"><img src="http://www.shookm.com/wp-content/uploads/2020/03/image-36-1024x443.png" alt="" class="wp-image-471"/></figure> <!-- /wp:image -->

<!-- wp:paragraph -->

<p>检查主机可能会发现之前漏下的问题,比如说我这里防火墙没关他就会出现提示</p> <!-- /wp:paragraph -->

<!-- wp:image {"id":472} -->

<figure class="wp-block-image"><img src="http://www.shookm.com/wp-content/uploads/2020/03/image-37-1024x498.png" alt="" class="wp-image-472"/></figure> <!-- /wp:image -->

<!-- wp:image {"id":473} -->

<figure class="wp-block-image"><img src="http://www.shookm.com/wp-content/uploads/2020/03/image-38-1024x470.png" alt="" class="wp-image-473"/></figure> <!-- /wp:image -->

<!-- wp:paragraph -->

<p>检查无误,NEXT→通过即可</p> <!-- /wp:paragraph -->

<!-- wp:paragraph -->

<p>如果这个步骤失败了错误,记得多看日志,多找问题,如果还不行的话,回档咯</p> <!-- /wp:paragraph -->

<!-- wp:code -->

<pre class="wp-block-code"><code>[root@master ~]# # ambari-server stop #停止命令 [root@master ~]# # ambari-server reset #重置命令 [root@master ~]# # ambari-server setup #重新设置 [root@master ~]# # ambari-server start #启动命令</code></pre>

<!-- /wp:code -->

<!-- wp:heading {"level":4} -->

<h4>6.2.5 大数据服务组件安装</h4> <!-- /wp:heading -->

<!-- wp:paragraph -->

<p>勾选你所需要的</p> <!-- /wp:paragraph -->

<!-- wp:image {"id":478} -->

<figure class="wp-block-image"><img src="http://www.shookm.com/wp-content/uploads/2020/03/image-39-1024x532.png" alt="" class="wp-image-478"/></figure> <!-- /wp:image -->

<!-- wp:heading {"level":4} -->

<h4 id="mce_7">6.2.6 节点分配</h4> <!-- /wp:heading -->

<!-- wp:image {"id":479} -->

<figure class="wp-block-image"><img src="http://www.shookm.com/wp-content/uploads/2020/03/image-40-1024x533.png" alt="" class="wp-image-479"/></figure> <!-- /wp:image -->

<!-- wp:heading {"level":4} -->

<h4>6.2.7 分配主从</h4> <!-- /wp:heading -->

<!-- wp:image {"id":480} -->

<figure class="wp-block-image"><img src="http://www.shookm.com/wp-content/uploads/2020/03/image-41-1024x494.png" alt="" class="wp-image-480"/></figure> <!-- /wp:image -->

<!-- wp:heading {"level":4} -->

<h4>6.2.8 安装配置</h4> <!-- /wp:heading -->

<!-- wp:paragraph -->

<p>hive和oozie的数据库用户密码填上之前创建好的</p> <!-- /wp:paragraph -->

<!-- wp:image {"id":481} -->

<figure class="wp-block-image"><img src="http://www.shookm.com/wp-content/uploads/2020/03/image-42-1024x476.png" alt="" class="wp-image-481"/></figure> <!-- /wp:image -->

<!-- wp:paragraph -->

<p>如果安装了hive,ooize等,需要修改成我们本地建好的库,jdbc-mysql也要配置好</p> <!-- /wp:paragraph -->

<!-- wp:image {"id":486} -->

<figure class="wp-block-image"><img src="http://www.shookm.com/wp-content/uploads/2020/03/image-47-1024x510.png" alt="" class="wp-image-486"/></figure> <!-- /wp:image -->

<!-- wp:image {"id":487} -->

<figure class="wp-block-image"><img src="http://www.shookm.com/wp-content/uploads/2020/03/image-48-1024x492.png" alt="" class="wp-image-487"/></figure> <!-- /wp:image -->

<!-- wp:image {"id":482} -->

<figure class="wp-block-image"><img src="http://www.shookm.com/wp-content/uploads/2020/03/image-43-1024x498.png" alt="" class="wp-image-482"/></figure> <!-- /wp:image -->

<!-- wp:image {"id":483} -->

<figure class="wp-block-image"><img src="http://www.shookm.com/wp-content/uploads/2020/03/image-44-1024x493.png" alt="" class="wp-image-483"/></figure> <!-- /wp:image -->

<!-- wp:image {"id":484} -->

<figure class="wp-block-image"><img src="http://www.shookm.com/wp-content/uploads/2020/03/image-45-1024x480.png" alt="" class="wp-image-484"/></figure> <!-- /wp:image -->

<!-- wp:image {"id":485} -->

<figure class="wp-block-image"><img src="http://www.shookm.com/wp-content/uploads/2020/03/image-46-1024x480.png" alt="" class="wp-image-485"/></figure> <!-- /wp:image -->

<!-- wp:heading {"level":4} -->

<h4>6.2.9 概况部署</h4> <!-- /wp:heading -->

<!-- wp:image {"id":488} -->

<figure class="wp-block-image"><img src="http://www.shookm.com/wp-content/uploads/2020/03/image-49-1024x478.png" alt="" class="wp-image-488"/></figure> <!-- /wp:image -->

<!-- wp:image {"id":489} -->

<figure class="wp-block-image"><img src="http://www.shookm.com/wp-content/uploads/2020/03/image-50-1024x486.png" alt="" class="wp-image-489"/></figure> <!-- /wp:image -->

<!-- wp:image {"id":490} -->

<figure class="wp-block-image"><img src="http://www.shookm.com/wp-content/uploads/2020/03/image-51-1024x472.png" alt="" class="wp-image-490"/></figure> <!-- /wp:image -->

<!-- wp:image {"id":494} -->

<figure class="wp-block-image"><img src="http://www.shookm.com/wp-content/uploads/2020/03/image-52-1024x472.png" alt="" class="wp-image-494"/></figure> <!-- /wp:image -->

<!-- wp:paragraph -->

<p>警告这里我这就忽略掉了,后期我们再修复</p> <!-- /wp:paragraph -->

<!-- wp:image {"id":495} -->

<figure class="wp-block-image"><img src="http://www.shookm.com/wp-content/uploads/2020/03/image-53-1024x471.png" alt="" class="wp-image-495"/></figure> <!-- /wp:image -->

<!-- wp:paragraph -->

<p>哈哈,这红的心慌,把他们变绿吧</p> <!-- /wp:paragraph -->

<!-- wp:image {"id":496} -->

<figure class="wp-block-image"><img src="http://www.shookm.com/wp-content/uploads/2020/03/image-54-1024x522.png" alt="" class="wp-image-496"/></figure> <!-- /wp:image -->

原文出处:https://www.cnblogs.com/shook/p/12409759.html

展开阅读全文
打赏
0
0 收藏
分享
加载中
更多评论
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部