CDH 5.13.1安装,整合kylin

参考:微信公众号 Hadoop 实操(强烈推荐)
https://mp.weixin.qq.com/s/dLM3WF0Mr178Girs0tJc9g

补充代码地址:https://github.com/fayson/cdhproject

一,安装环境

    1)JDK 1.8

   2)Centos6.5

   3) mysql 5.6  在节点master上

   4) CDH 5.13 

   5)总共是3个节点 master slave1 slave2

二,前提工作

    CDH环境要安装Hive,Hbase ,需要将mysql的驱动拷贝到3个地方,

   这个地方告诉我们安装的组件一些数据信息保存在地方: 我们也可以自己更改地址。

CDH安装前置准备

  Fayson  Hadoop实操  2017-11-01

温馨提示:要看高清无码套图,请使用手机打开并单击图片放大查看。


1.文档编写目的



每次安装CDH集群时都需要做很多前置条件准备,以确保安装成功以及运行主机检查时能顺利通过。本篇文章主要讲述安装Cloudera Manager和CDH前的准备工作。Fayson将这一部分独立出来,主要是为了方面后面再讲安装相关的文章时不用重复这部分内容。


  • 内容概述

1.环境前置确认

2.CDH安装前配置


  • 测试环境

1.CentOS6.5

2.使用root用户操作


  • 测试环境

1.操作系统CentOS6.5


2.环境前置确认

2.1节点数量



最小规模,建议最少4台服务器,一台用作管理节点Cloudera ManagerNameNode等,另外三台用作工作节点,该规模仅用于开发和测试。如果是生产系统,最少6台,3台管理节点包括1Cloudera Manager2NameNode启用高可用,3个工作节点。常见的较小规模的生产系统一般为10-20台。


2.2操作系统选择



CDH支持在主流的64Linux操作系统上部署运行,包括但不限于:

  • Red Hat Enterprise Linux5.75.106.46.56.66.77.17.2

  • CentOS5.75.106.46.56.66.77.17.2

  • SUSE Linux Enterprise ServerSLES):11SP2SP3SP4

  • Oracle Linux5.75.106.46.56.66.77.17.2

  • Ubuntu12.0414.04

  • Debian7.07.17.8

目前常见部署选择Redhat6.57.2,为安装CDSW安装考虑推荐7.2。参考:

https://www.cloudera.com/documentation/enterprise/release-notes/topics/rn_consolidated_pcm.html#concept_bhn_wwg_lbb


2.3安装用户



可以使用root用户安装,或者具有sudu权限的其他用户。


2.4OS目录要求



一般OS磁盘建议raid1或者raid10,对于目录大小,简单点,如果只有一个根目录/建议最少100GB,无论是Cloudera MangerNameNode还是DataNode节点,因为Cloudera Manager节点往往还存放着MySQL,以及一些监控数据,可以选择200GB


或者:

可以默认比如10GB

/opt 大于50GB

/usr 大于50GB

/var 大于20GB

/var/log大于50GB

/var/lib大于50GB

/tmp 大于20GB


或者:

可以默认比如10GB

/opt 大于50GB

/usr 大于50GB

/var 大于50GB

/tmp 大于20GB


2.5硬件要求



以下Cloudera ManagerNameNodeDataNode相同


CPU:最少4 cores,推荐28核,210核,212

内存:最小16GB,推荐128GB-256GB

网络:最小千兆,推荐两张万兆绑定

磁盘:OS参考2.3章节,DataNode数据盘推荐121TB-4TBSATA/SAS


2.6磁盘要求



1.DataNode/NodeManagerOS盘可以使用raid1或者raid10,数据盘不要使用raid,应该为JBOD

管理节点(NameNodeZookeeperJournalNode),可以使用raid或者JBOD,因为管理节点对I/O延迟比较敏感,建议将NNZKJN存放数据的目录配置为不同的目录,并且对应到不同的磁盘。

[root@ip-172-31-6-148~]# df –h
[root@ip-172-31-6-148 ~]# lsblk


2.DataNode数据盘建议选择ext4xfs,并配置noatime,比如:

[root@ip-172-31-6-148~]# cat /etc/fstab
/dev/sda1  /data/1    xfs   defaults,noatime      1 2
/dev/sdb1  /data/2    xfs   defaults,noatime      1 2
/dev/sdc1  /data/3    xfs   defaults,noatime      1 2
/dev/sdd1  /data/4    xfs   defaults,noatime      1 2
/dev/sde1  /data/5    xfs   defaults,noatime      1 2
/dev/sdf1  /data/6    xfs   defaults,noatime      1 2
...
/dev/sdx1  
/data/x    xfs    defaults,noatime      1 2

[root@ip-172-31-6-148 ~]# fdisk -l

注意:noatime隐含了nodiratime


3.DataNode数据盘确保没有配置分区卷LogicalVolume Manager (LVM)

[root@ip-172-31-6-148~]# df –h
[root@ip-172-31-6-148 ~]# lsblk
[root@ip-172-31-6-148 ~]# lvdisplay

Additionally, look for/dev/mapper or /dev/XX (where XX isnot sd).


4.确保BIOS配置正确,比如你如果使用的是SATA,请确保没有开启IDE emulation


5.确保controller firmware是最新的,校验磁盘是否有一些潜在的问题。

[root@ip-172-31-6-148~]# dmesg | egrep -i 'sense error'
[root@ip-172-31-6-148~]# dmesg | egrep -i 'ata bus error'


6.目前常见的SATA读写速度大概在150MB/S-180MB/SSAS或者SSD会更快,如果磁盘读写速度小于70MB/S,肯定是有问题的,需要检查硬件。以下为测试读写的命令,这里我们将/data/01挂载到/dev/sda1

[root@ip-172-31-6-148~]# hdparm –t /dev/sda1
[root@ip-172-31-6-148 
~]# ddbs=1M count=1024 if=/dev/zero of=/data/01 oflag=direct conv=fdatasync
[root@ip-172-31-6-148~]# dd bs=1M count=1024 of=/dev/null if=/data/01 iflag=direct conv=fdatasync


7.确保磁盘没有坏的扇区:

[root@ip-172-31-6-148~]# badblocks -v /dev/sda1
[root@ip-172-31-6-148~]# badblocks -v /dev/sdb1
...
[root@ip-172-31-6-148 
~]#badblocks -v /dev/sdx1


2.7网络要求



1.确保没有启用IPv6

[root@ip-172-31-6-148~]# lsmod | grep ipv6 
(todisable add the following to /etc/sysctl.conf)

#disable ipv6
net.ipv6.conf.all.disable_ipv61
net.ipv6.conf.default.disable_ipv61
net.ipv6.conf.lo.disable_ipv61

如果是RHEL/CentOS,可以把以下内容补充到/etc/sysconfig/network:

NETWORKING_IPV6=no
IPV6INIT=no


2.静态IP

确保所有服务器已配置静态IP,如下:

[root@ip-172-31-6-148~]# cat/etc/sysconfig/network-scripts/ifcfg-eth* (RHEL)

以上文件需包含以下内容:

·     BOOTPROTO=static(RHEL/SLES);

·     iface <iface> inet static (Ubuntu);

·     IPADDR or address should match the output of ifconfig;


2.8主机名



确保所有服务器的hostname已经配置,比如cdh1, cdh2, cdh3…

[root@ip-172-31-6-148~]# grep HOSTNAME /etc/sysconfig/network (RHEL)


2.9网卡- Network Interface Cards (NICs)



确保网卡的双工(duplex)模式已开启,并保证速度正常:

[root@ip-172-31-6-148~]# ifconfig
[root@ip-172-31-6-148 ~]# ethtool 
<interface>| grep Speed
[root@ip-172-31-6-148 ~]# ethtool -S 
<interface> | grep collision
[root@ip-172-31-6-148 ~]# ethtool -S 
<interface> | grep drop 
[root@ip-172-31-6-148 ~]# netperf

可以使用iperf测试服务器两两之间的速度。


2.10JDK



CDH支持JDK包括JDK7以及JDK8Cloudera提供相应JDK包,并可有CM自动在集群中部署安装。CDH的版本都能提供对Oracle JDK7的支持,而JDK8的支持则需要CDH5.3之后的版本。目前在CDH发行版中自带的JDK版本为1.7.0_67版本。


2.11外部数据库选择



CM底层自动部署安装数据库进行系统配置、schema等并进行相应管理。同时CM也支持使用外部数据库作为系统配置、数据表结构等的底层存储,具体支持的数据库包括:

  • MySQL5.15.55.65.7

  • PostgreSQL8.18.38.49.19.29.39.4

  • Oracle11gR212c

    一般来说外部元数据库都会采用系统自带的MySQL服务。 确保以下配置:


为了元数据存放相互隔离,部署Cloudera Hadoop集群需要建立以下的数据库,同同时建议为每个数据库建立单独的用户,隔离相互之间的访问。Cloudera提供的组件中需要使用到元数据库的,以及建议的对应命名的规则和用户,如下表中所示。其中实际的数据库和用户名,需要最终进行确认。


角色

database/Schema

User

Password

Cloudera  Manager

cm

cm

********

Reports  Manager

rman

rman

********

Hive Metastore

metastore

hive

********

Sentry Server

sentry

sentry

********

Cloudera  Navigator Audit Server

nav

nav

********

Cloudera Navigator Metadata Server

navms

navms

********

Oozie Server

oozie

oozie

********

Hue Server

hue

hue

********


2.12OS安装包



确保OS的安装包,.iso文件一般为~4GB已经准备并放置在服务器磁盘。


2.13Windows客户端安装机器



  • Windows 7+

  • 谷歌/火狐浏览器

  • SSH工具: putty secureCRTXshell或其他

  • FTP上传工具

  • 可以直接通过ssh访问所有CDH节点

  • 可以直接访问CDH所有节点的所有端口

  • Office软件:WordExcel等。

  • 文本编辑器:notepad++editplusultraedit等。

  • Windows的用户有权限编辑Windowshosts文件


2.14端口开放需求



我们在很多情况下操作的Windows客户端机器都是跳板机,没法完全直接访问CDH的服务器,但如果有些服务我们如果不能查看Web UI,没法进行安装或者后期监控集群,比如CM7180用于安装和运维集群,NN50070用于监控HDFS等。那么可以联系您的网络管理员开通以下端口:

Service

Port

Hosts

Cloudera Manager

7180

CM所在主机

Cloudera Navigator Metadata

7187

Navigator所在主机

HDFS

50070

Namenode所在主机

HDFS

8020

Namenode所在主机

ResourceManager

8088

RM所在主机

ResourceManager

19888

JobHistory所在主机

HBase

60010

HMaster所在主机

HBase

60030

可选:RegionServer所在主机

Hive

10002

HiveServer2所在主机

Hue

8888

Hue所在主机

Impala

25010

Impala StateStore所在主机

Impala

25020

Impala Catalog所在主机

Impala

25000

所有ImpalaD所在主机

http

80

httpd服务所在机器,一般是CM那台主机

ssh

22

可以通过终端ssh到CM所在机器

Spark

18088

Spark HistoryServer所在机器

更多端口参考:

https://www.cloudera.com/documentation/enterprise/latest/topics/cm_ig_ports.html


3.CDH安装前配置



以下以Redhat6.5为例进行操作。


3.1安装HTTP服务



安装apachehttpd服务主要用于搭建OSCloudera ManagerCDHyum源。在集群服务器中选择一台服务器来安装httpd服务,命令如下:


1.安装httpd服务

[root@ip-172-31-6-148~]# yum -y install httpd


2.httpd服务加入自启动服务并启动

[root@ip-172-31-6-148~]# chkconfig --add httpd 
[root@ip-172-31-6-148~]# chkconfig httpd on
[root@ip-172-31-6-148~]# service httpd start
Starting httpd: 
[root@ip-172-31-6-148~]#


3.检查服务是否启动成功

在浏览器输入http://hostname看到如上截图则说明启动成功。


3.2配置操作系统yum源



1.首先将操作系统的ISO文件挂载在httpd所在服务器

[root@ip-172-31-6-148~]# mkdir /iso
[root@ip-172-31-6-148~]# mount -o loop CentOS-6.5-x86_64-minimal.iso /iso/
[root@ip-172-31-6-148~]# df -h
Filesystem                           Size  UsedAvail Use% Mounted on
/dev/xvde                             99G  30G   64G  32% /
tmpfs                                7.4G     0  7.4G   0%/dev/shm
cm_processes                         7.4G 9.7M  7.4G   1% /var/run/cloudera-scm-agent/process
/root/CentOS-6.5-x86_64-minimal.iso  398M  398M    100% /iso
[root@ip-172-31-6-148~]# 


2./var/www/html目录下创建centos6.5目录,并将/iso目录下所有文件拷贝至/var/www/html/centos6.5目录

[root@ip-172-31-6-148~]# mkdir -p /var/www/html/centos6.5     
[root@ip-172-31-6-148 ~]# scp -r /iso/* /var/www/html/centos6.5/

[root@ip-172-31-6-148~]# cd /var/www/html/centos6.5/
[root@ip-172-31-6-148 centos6.5]# ls


3.在浏览器访问http://hostname/centos6.5


4./etc/yum.repo.d/目录下增加os.repo文件,内容如下

[root@ip-172-31-6-148yum.repos.d]# pwd
/etc/yum.repos.d
[root@ip-172-31-6-148 
yum.repos.d]#vim os.repo 
[localrepo]
name=CentOS6.5
baseurl=http://ip-172-31-6-148.fayson.com/centos6.5
gpgcheck=false
enabled=true


5.执行命令查看yum源是否配置成功

[root@ip-172-31-6-148yum.repos.d]# yum clean all
[root@ip-172-31-6-148yum.repos.d]# yum repolist
repo id                                   reponame                                                 status
base                                      CentOS-6 - Base                                           6,706
extras                                    CentOS-6- Extras                                             46
localrepo                                 CentOS6.5                                                   248
updates                                   CentOS-6 - Updates                                           722
repolist: 7,736
[root@ip-172-31-6-148yum.repos.d]#

注:需要将os.repo文件同步至集群所有服务器的/etc/yum.repo.d目录。


3.3HOSTS配置



1.hostname修改

修改配置文件/etc/sysconfig/network

[root@ip-172-31-6-148~]# vim /etc/sysconfig/network
NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=ip-172-31-6-148.fayson.com

修改完成后需要重启服务器使其生效。修改集群所有节点的hostname为统一格式方便集群管理。


2.配置/etc/hosts文件

[root@ip-172-31-6-148~]# vim /etc/hosts
127.0.0.1               localhost.localdomain localhost
::1             localhost6.localdomain6 localhost6

172.31.6.148  ip-172-31-6-148.fayson.com
172.31.5.190  ip-172-31-5-190.fayson.com
172.31.10.118 ip-172-31-10-118.fayson.com
172.31.9.33   ip-172-31-9-33.fayson.com

将集群所有服务器的IPHOSTNAME配置到hosts文件,并同步至集群的所有服务器。如果企业有自己的DNS服务则可以使用DNS服务统一管理集群IP和域名,也可以自己搭建私有DNS服务管理CDH集群服务器的IP和域名,可以参考如何利用Dnsmasq构建小型集群的本地DNS服务器如何在Windows Server2008搭建DNS服务并配置泛域名解析

注意:如果使用hosts文件管理集群的IPHOSTNAME则需要确保将hosts文件同步至集群所有节点。


3.4禁用SELinux



1.在集群所有节点执行如下命令

[root@ip-172-31-6-148~]# setenforce 0


2.修改集群所有节点配置文件/etc/selinux/config

[root@ip-172-31-6-148~]# vim /etc/selinux/config 

# This file controls the state ofSELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policyis enforced.
#     permissive - SELinux printswarnings instead of enforcing.
#     disabled - No SELinux policy isloaded.
SELINUX=disabled
# SELINUXTYPE= can take one of thesetwo values:
#     targeted - Targeted processes areprotected,
#     mls - Multi Level Securityprotection.
SELINUXTYPE=targeted


3.验证是否禁用成功

[root@ip-172-31-6-148~]# sestatus -v
SELinux status:                 disabled
[root@ip-172-31-6-148~]# 


3.5关闭防火墙



1.关闭集群所有服务器的防火墙

[root@ip-172-31-6-148~]# chkconfig iptables off

[root@ip-172-31-6-148~]# service iptables stop
iptables: Setting chains to policy ACCEPT: filter          [  OK  ]
iptables: Flushing firewall rules:                         [  OK  ]
iptables: Unloading modules:                               [  OK  ]
[root@ip-172-31-6-148 ~]# 


2.检查集群所有服务器防火墙是否关闭

[root@ip-172-31-6-148~]# service iptables status
iptables: Firewall is not running.
[root@ip-172-31-6-148~]# 


3.6设置SWAP



1.在集群所有节点修改/etc/sysctl.conf配置文件,增加如下配置

 

[root@ip-172-31-6-148~]# vim /etc/sysctl.conf 
# Kernel sysctl configuration filefor Red Hat Linux
#
# For binary values, 0 is disabled, 1 is enabled.  See sysctl(8) and
# sysctl.conf(5) for more details.

# Controls the maximum number ofshared memory segments, in pages
kernel.shmall 4294967296

vm.swappiness 10


2.检查设置是否生效

[root@ip-172-31-6-148~]# sysctl -p

kernel.msgmnb65536
kernel.msgmax65536
kernel.shmmax68719476736
kernel.shmall4294967296
vm.swappiness10
[root@ip-172-31-6-148~]# 


3.7关闭透明大页面



1.在集群所有节点执行如下命令,使其立即生效

[root@ip-172-31-6-148~]# echo never > /sys/kernel/mm/redhat_transparent_hugepage/defrag
[root@ip-172-31-6-148~]# echo never >/sys/kernel/mm/redhat_transparent_hugepage/enabled


2.在集群所有节点/etc/rc.d/rc.local脚本中增加如下代码,使其永久生效

if test -f/sys/kernel/mm/redhat_transparent_hugepage/enabled; then
   
echo never > /sys/kernel/mm/redhat_transparent_hugepage/enabled
fi
if 
test -f /sys/kernel/mm/redhat_transparent_hugepage/defrag; then
   
echo never > /sys/kernel/mm/redhat_transparent_hugepage/defrag
fi


3.赋予rc.local脚本可执行权限

[root@ip-172-31-6-148rc.d]# chmod +x /etc/rc.d/rc.local


3.8配置时钟同步



如果企业有自己的NTP Server则可以集群中所有节点可配置企业NTP Server,如果没有自己的NTP服务器则在集群中选用一台服务器作为NTP Server,其它服务器与其保持同步,配置如下:


1.在集群所有节点安装NTP服务

[root@ip-172-31-6-148~]# yum -y install ntp


2.选择集群一台服务器作为NTP Server,配置如下

[root@ip-172-31-6-148~]# vim /etc/ntp.conf

#server 0.centos.pool.ntp.org iburst
#server 1.centos.pool.ntp.org iburst
#server 2.centos.pool.ntp.org iburst
#server 3.centos.pool.ntp.org iburst
server  127.127.1.0     #local clock
fudge   127.127.1.0 stratum 10


3.集群其它节点与其同步,配置如下:

[ip-172-31-5-190 ~]# vim /etc/ntp.conf

# Use public servers from thepool.ntp.org project.
#server 0.centos.pool.ntp.org iburst
#server 1.centos.pool.ntp.org iburst
#server 2.centos.pool.ntp.org iburst
#server 3.centos.pool.ntp.org iburst
server 172.31.6.148


4.完成以上配置后,在集群所有节点执行如下命令

[root@ip-172-31-6-148~]# chkconfig --add ntpd
[root@ip-172-31-6-148~]# chkconfig ntpd on
[root@ip-172-31-6-148~]# service ntpd restart
Shutting down ntpd:                                        [  OK  ]
Starting ntpd:                                             [  OK  ]
[root@ip-172-31-6-148~]# 


5.验证所有节点NTP是否同步

[root@ip-172-31-5-190~]# ntpq -p
     
remote           refid      st t when pollreach   delay   offset jitter
==============================================================================
*ip-172-31-6-148210.23.25.77     448 1024  377    0.255   3.245   7.859
[root@ip-172-31-5-190~]# 

注:上图标注看到有*号则表示同步成功。


3.9安装MySQL数据库



1.在集群中CM节点安装MySQL服务

[root@ip-172-31-6-148yum.repos.d]# yum -y install mysql mysql-server


2.启动MySQL服务并将mysqld加入开机自启动服务

[root@ip-172-31-6-148~]# chkconfig --add mysqld
[root@ip-172-31-6-148 ~]# chkconfig mysqld on
[root@ip-172-31-6-148 ~]# service mysqld start
Starting mysqld:                                           [  OK  ]
[root@ip-172-31-6-148 ~]# 


3.执行如下脚本初始化MySQL

[root@ip-172-31-9-33~]# mysql_secure_installation 
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FORALL MySQL
      
SERVERS IN PRODUCTION USE!  PLEASE READEACH STEP CAREFULLY!

In order to log into MySQL to secure it, we'll needthe current
password for the root user.  If you'vejust installed MySQL, and
you haven't set the root password yet, the passwordwill be blank,
so you should just press enter here.

Enter current password for root (enter for none): 
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.

Set root password? [Y/n] 
y
New password: 
Re-enter new password: 
Password updated successfully!
Reloading privilege tables..
 ... Success!

By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them.  This is intended only for testing,and to make the installation
go a bit smoother.  You should removethem before moving into a
production environment.

Remove anonymous users? [Y/n] 
y
 ... Success!

Normally, root should only be allowed to connect from '
localhost'. This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] 
n
 ... skipping.

By default, MySQL comes with a database named '
test' that anyone can
access.  This is also intended only fortesting, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] 
y
 - Dropping test database...
 ... Success!
 - Removing privileges on testdatabase...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] 
y
 ... Success!

Cleaning up...

All done!  If you'
ve completed all of the above steps, your MySQL
installationshould now be secure.

Thanks for usingMySQL!

[root@ip-172-31-9-33~]# 


4.登录MySQL验证是否安装成功

[root@ip-172-31-9-33~]# mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 5.1.73 Source distribution

Copyright (c2000, 2013,Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporationand/or its
affiliates.Other names may be trademarks of theirrespective
owners.

Type 
'help;' or '\h' for help. Type '\c' to clear the current inputstatement.

mysql


5.创建CDH所需要的数据库

create database metastore default character set utf8;
CREATE USER 'hive'@'%'IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON metastore.* TO 'hive'@'%';
FLUSH PRIVILEGES;


create database cm default character set utf8;
CREATE USER 'cm'@'%'IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON cm* TO 'cm'@'%';
FLUSH PRIVILEGES;

create database am default character set utf8;
CREATE USER 'am'@'%'IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON am* TO 'am'@'%';
FLUSH PRIVILEGES;

create database rm default character set utf8;  
CREATE USER 'rm'@'%'IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON rm* TO 'rm'@'%';
FLUSH PRIVILEGES;

create database hue default character set utf8;
CREATE USER 'hue'@'%'IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON hue* TO 'hue'@'%';
FLUSH PRIVILEGES;

create database oozie default character set utf8;
CREATE USER 'oozie'@'%' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON oozie* TO 'oozie'@'%';
FLUSH PRIVILEGES;

create database sentry default character set utf8;
CREATE USER 'sentry'@'%' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON sentry.* TO 'sentry'@'%';
FLUSH PRIVILEGES;


3.10配置CM的yum源



1./var/www/html下新增cm5.13目录

[root@ip-172-31-6-148html]# mkdir -p /var/www/html/cm5.13


2.下载CM5.13版本的RPM安装包

http://archive.cloudera.com/cm5/redhat/6/x86_64/cm/5.13/RPMS/x86_64/cloudera-manager-agent-5.13.0-1.cm5130.p0.55.el6.x86_64.rpm
http://archive.cloudera.com/cm5/redhat/6/x86_64/cm/5.13/RPMS/x86_64/cloudera-manager-daemons-5.13.0-1.cm5130.p0.55.el6.x86_64.rpm
http://archive.cloudera.com/cm5/redhat/6/x86_64/cm/5.13/RPMS/x86_64/cloudera-manager-server-5.13.0-1.cm5130.p0.55.el6.x86_64.rpm
http://archive.cloudera.com/cm5/redhat/6/x86_64/cm/5.13/RPMS/x86_64/cloudera-manager-server-db-2-5.13.0-1.cm5130.p0.55.el6.x86_64.rpm
http://archive.cloudera.com/cm5/redhat/6/x86_64/cm/5.13/RPMS/x86_64/enterprise-debuginfo-5.13.0-1.cm5130.p0.55.el6.x86_64.rpm
http://archive.cloudera.com/cm5/redhat/6/x86_64/cm/5.13/RPMS/x86_64/jdk-6u31-linux-amd64.rpm
http://archive.cloudera.com/cm5/redhat/6/x86_64/cm/5.13/RPMS/x86_64/oracle-j2sdk1.7-1.7.0+update67-1.x86_64.rpm

将上述7个地址下载到/var/www/html/cm5.13目录下


3./var/www/html/cm5.13目录下执行命令

[root@ip-172-31-6-148cm5.13]# createrepo .
Spawning worker with 7pkgs
Workers Finished
Gathering worker results

Saving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Sqlite DBs complete
[root@ip-172-31-6-148 cm5.13]# ll


4.验证CM是否部署成功


5.Cloudera Manager所在服务器的/etc/yum.repo.d目录下创建cm.repo文件,内容如下

[root@ip-172-31-6-148yum.repos.d]# vim cm.repo
[cmrepo]
name=Cloudera Manager 5.13
baseurl=http://ip-172-31-6-148.fayson.com/cm5.13
gpgcheck=false
enable=true


6.验证CMyum源是否配置成功

[root@ip-172-31-6-148yum.repos.d]# yum repolist
...
repo 
id                                     reponame                                               status
base                                        CentOS-6 - Base                                          6,706
cmrepo                                      Cloudera Manager 5.13                                        7
extras                                      CentOS-6 - Extras                                           46
localrepo                                   CentOS6.5                                                 248
updates                                     CentOS-6 - Updates                                         722
repolist: 7,729
[root@ip-172-31-6-148yum.repos.d]# 


3.11部署CDH的Parcel



1./var/www/html目录下创建cdh5.13目录

[root@ip-172-31-6-148html]# mkdir -p /var/www/html/cdh5.13


2.下载CDH5.13版本的Parcel

http://archive.cloudera.com/cdh5/parcels/5.13/CDH-5.13.0-1.cdh5.13.0.p0.29-el6.parcel
http://archive.cloudera.com/cdh5/parcels/5.13/CDH-5.13.0-1.cdh5.13.0.p0.29-el6.parcel.sha1
http://archive.cloudera.com/cdh5/parcels/5.13/manifest.json


3.验证是否部署成功


3.12安装MySQL驱动



在集群中需要安装CM服务的节点上安装MySQL的驱动


1.创建目录/usr/share/java,有则不用创建。

[root@ip-172-31-6-148java]# mkdir -p /usr/share/java/


2.将mysql-connector-java-5.1.34.jar拷贝至/usr/share/java目录,并创建软链接

[root@ip-172-31-6-148java]# pwd
/usr/share/java
[root@ip-172-31-6-148 
java]#ll
total 940
-rwxr-xr-x.root root 960372 Aug 3015:16 mysql-connector-java-5.1.34.jar
[root@ip-172-31-6-148java]# ln -s mysql-connector-java-5.1.34.jar mysql-connector-java.jar        
[root@ip-172-31-6-148java]# ll
total 940
-rwxr-xr-x.root root 960372 Aug 3015:16 mysql-connector-java-5.1.34.jar
lrwxrwxrwx  1root root     31 Oct 15 18:00 mysql-connector-java.jar ->mysql-connector-java-5.1.34.jar
[root@ip-172-31-6-148java]#









2.安装Cloudera Manager Server



1.在CM节点使用如下命令安装Cloudera Manager Server服务

[root@ip-172-31-6-148~]# yum -y install cloudera-manager-server


2.初始化CM数据库

[root@ip-172-31-6-148~]#/usr/share/cmf/schema/scm_prepare_database.sh mysql cm cm password
JAVA_HOME=/usr/java/jdk1.7.0_67-cloudera
Verifying that we can write to /etc/cloudera-scm-server
Creating SCM configuration file in /etc/cloudera-scm-server
Executing:  /usr/java/jdk1.7.0_67-cloudera/bin/java-cp/usr/share/java/mysql-connector-java.jar:/usr/share/java/oracle-connector-java.jar:/usr/share/cmf/schema/../lib/*com.cloudera.enterprise.dbutil.DbCommandExecutor/etc/cloudera-scm-server/db.properties com.cloudera.cmf.db.
log4j:ERRORCould not find value for keylog4j.appender.A
log4j:ERRORCould not instantiate appender named "A".
[2017-10-1517:49:38,476] INFO     0[main] -com.cloudera.enterprise.dbutil.DbCommandExecutor.testDbConnection(DbCommandExecutor.java-Successfullyconnected to database.
All done, your SCM database is configured correctly!
[root@ip-172-31-6-148~]# 


3.启动Cloudera Manager Server

[root@ip-172-31-6-148~]# service cloudera-scm-server start
Starting cloudera-scm-server:                              [  OK  ]
[root@ip-172-31-6-148~]#


4.检查端口是否监听

[root@ip-172-31-6-148~]# netstat -apn |grep 7180
tcp        0      0 0.0.0.0:7180                0.0.0.0:*                   LISTEN      20963/java          
[root@ip-172-31-6-148~]#


5.通过http:// 172.31.2.159:7180/cmf/login访问CM


3.CDH安装

3.1CDH集群安装向导



1.登录Cloudera Manager进入Web安装向导界面


2.指定集群安装主机


3.设置CDHParcel地址


4.设置CM存储库地址


5.集群安装JDK选项


6.集群安装模式


7.输入集群SSH登录信息


8.集群安装JDKCloudera Manager Aagent服务


9.向集群所有主机安装并激活Parcel


10.检查主机正确性


3.2CDH集群设置向导



1.设置集群安装的服务组合


2.自定义角色分配


3.数据库设置


4.配置审核更改


5.集群首次运行


6.集群安装成功


7.进入CM首页查看CMCDH版本


3.3Kudu安装



CDH5.13.0版本开始,已经将Kudu集成在CDHParcels包中。因此在安装上相较于之前更简单方便。


1.登录CM进入主页,在相应集群上点击“添加服务”


2.进入服务选择界面,选择“Kudu


3.点击继续,进入Kudu角色分配,分配KuduMasterTablet Server


4.点击继续,配置KuduWALData目录


5.点击“继续”,将Kudu服务添加到集群并启动


6.点击“继续”,完成Kudu服务安装


7.查看CM主页,Kudu服务安装成功


8.配置ImpalaKudu集成

默认Impala即可直接操作Kudu进行SQL操作,但为了省去每次建表都需要在TBLPROPERTIES中添加kudu_master_addresses属性,建议在Impala的高级配置KuduMaster的地址:--kudu_master_hosts=ip-172-31-6-148.fayson.com:7051

保存配置,回到CM主页,根据提示重启相应服务。


4.快速组件服务验证

4.1HDFS验证(mkdir+put+cat+get)



[root@ip-172-31-6-148~]# hadoop fs -mkdir -p /fayson/test_table
[root@ip-172-31-6-148~]# cat a.txt 
1,test
2,fayson
3,zhangsan
[root@ip-172-31-6-148 
~]#hadoop fs -put a.txt /fayson/test_table
[root@ip-172-31-6-148~]# hadoop fs -cat /fayson/test_table/a.txt
1,test
2,fayson
3,zhangsan
[root@ip-172-31-6-148 
~]# rm -rf a.txt
[root@ip-172-31-6-148~]# hadoop fs -get /fayson/test_table/a.txt .
[root@ip-172-31-6-148~]# cat a.txt
1,test
2,fayson
3,zhangsan
[root@ip-172-31-6-148 
~]# 


4.2Hive验证



[root@ip-172-31-6-148~]# hive
hive

    > create 
external table test_table (
    
>    s1 string,
    
>    s2 string
    
)
    
> row format delimited fields terminated by ','
    
> stored as textfilelocation '/fayson/test_table';
OK
Time 
taken: 2.117 seconds
hive
select * from test_table;
OK
1       
test
2       fayson
3       zhangsan
Time taken: 0.683 seconds, Fetched: row(s)
hiveselect count(*from test_table;
...
OK
3
Time 
taken: 26.174 seconds, Fetched: row(s)
hive


4.3MapReduce验证



root@ip-172-31-6-148~]# hadoop jar /opt/cloudera/parcels/CDH/lib/hadoop-0.20-mapreduce/hadoop-examples.jar pi 5 5
...
17/10/31 
07:13:52 INFO mapreduce.Job:  map 100% reduce 100%
17/10/31 07:13:52 INFO mapreduce.Job: Job job_1509333728959_0018 completedsuccessfully
...
Job 
Finished in 22.662 seconds
Estimated value of Pi is 3.68000000000000000000
[root@ip-172-31-6-148 ~]# 


4.4Impala验证



[root@ip-172-31-6-148~]# impala-shell -i ip-172-31-9-33.fayson.com
...
[ip-172-31-9-33.fayson.com:21000] 
> invalidate metadata;
...
Fetched 
row(sin 4.18s
[ip-172-31-9-33.fayson.com:21000] 
> show tables;
Query: show tables
+------------+
name      |
+------------+
test       |
test_table|
+------------+
Fetched 
row(sin 0.01s
[ip-172-31-9-33.fayson.com:21000] select * from test_table;
...
+----+----------+
s1 s2       |
+----+----------+
1  test     |
2  fayson   |
3  zhangsan |
+----+----------+
Fetched 
row(sin 5.42s
[ip-172-31-9-33.fayson.com:21000] select count(*from test_table;
...
+----------+
count(*|
+----------+
3       |
+----------+
Fetched 
row(sin 0.16s
[ip-172-31-9-33.fayson.com:21000] 


4.5Spark验证



[root@ip-172-31-6-148~]# spark-shell
Welcome to
      
____              __
     
__/__  ___ _____/ /__
    _\ \/ _ \/ _ 
`/__/  '_/
   
/___/ .__/\_,_/_/ /_/\_\   version 1.6.0
      
/_/
Using 
Scala version 2.10.5 (Java HotSpot(TM64-Bit ServerVM, Java 1.7.0_67)
...
scala> var textFile=sc.textFile("/fayson/test_table/a.txt")
textFile: org.apache.spark.rdd.RDD[String] =/fayson/test_table/a.txt MapPartitionsRDD[1at textFile at<console>:27

scala> textFile.count()
res0: Long = 3
                                                                 
scala


4.6Kudu验证



[root@ip-172-31-6-148~]# impala-shell -i ip-172-31-9-33.fayson.com
...
[ip-172-31-9-33.fayson.com:21000] 
> CREATE TABLE my_first_table (
                                  
>     id BIGINT,
                                  
>     name STRING,
                                  
>     PRIMARY KEY(id)
                                  
)
                                  
> PARTITION BY HASH PARTITIONS 16
                                  
> STORED AS KUDU;
...
Fetched 
row(sin 2.40s
[ip-172-31-9-33.fayson.com:21000] 
> INSERT INTO my_first_table VALUES (99, "sarah");
...
Modified 
row(s)row error(sin 4.14s
[ip-172-31-9-33.fayson.com:21000] 
> INSERT INTO my_first_table VALUES (1, "john")(2, "jane")(3, "jim");
...
Modified 
row(s)row error(sin 0.11s
[ip-172-31-9-33.fayson.com:21000] select * from my_first_table;
...
+----+-------+
id name  |
+----+-------+
1  john  |
99 sarah |
2  jane  |
3  jim   |
+----+-------+
Fetched 
row(sin 1.12s
[ip-172-31-9-33.fayson.com:21000] 
> delete from my_first_table where id =99;
...
Modified 
row(s)row error(sin 0.17s
[ip-172-31-9-33.fayson.com:21000] select * from my_first_table;
...
+----+------+
id name |
+----+------+
1  john |
2  jane |
3  jim  |
+----+------+
Fetched 
row(sin 0.14s
[ip-172-31-9-33.fayson.com:21000] 
> update my_first_table set name='fayson' where id=1;      
...
Modified 
row(s)row error(sin 0.14s
[ip-172-31-9-33.fayson.com:21000] select * from my_first_table;
...
+----+--------+
id name   |
+----+--------+
2  jane   |
3  jim    |
1  fayson |
+----+--------+
Fetched 
row(sin 0.04s
[ip-172-31-9-33.fayson.com:21000] 
> upsert  into my_first_table values(1, "john")(2, "tom");
...
Modified 
row(s)row error(sin 0.11s
[ip-172-31-9-33.fayson.com:21000] select * from my_first_table;
...
+----+------+
id name |
+----+------+
2  tom  |
3  jim  |
1  john |
+----+------+
Fetched 
row(sin 0.06s
[ip-172-31-9-33.fayson.com:21000] select count(*from my_first_table;
...
+----------+
count(*|
+----------+
3       |
+----------+
Fetched 
row(sin 0.39s
[ip-172-31-9-33.fayson.com:21000] >



  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值