本文介绍: cdh5,cdh6进行部署,非常详细,

CDH(Cloudera)——大数据组件管理

唉,在吗? 本人对繁杂的cdh部署进行了归纳和规范,根据本文内容可以轻松全面的部署cdh
上干货~

安装

安装cdh5
安装cdh6
cdh扩展节点增加机器

准备

三台linux主机

修改 IP, 修改主机名, 配置域名解析关闭防火墙设置主机之间无密登陆时间同步安装java jdk

#step1 : 修改ip =============================================================
vim /etc/sysconfig/network-scripts/ifcfg-ens33
	#略

#step2 : 修改主机名 ==========================================================
vim /etc/hostname
cat /etc/hostname
	#删除里面内容, 写上新的主机名,即可

#step3 : 配置域名解析 ========================================================
vim /etc/hosts
	# 添加如下,如下例:
    192.168.1.101 cm1
    192.168.1.102 cm2
    192.168.1.103 cm3
    
cat /etc/hosts

#step4 : 关闭防火墙 ========================================================
	#关闭防火墙==========
	sudo systemctl stop firewalld
	sudo systemctl disable firewalld
	sudo systemctl status firewalld
	
	#关闭安全写入检查=====
	vi /etc/selinux/config
		#将SELINUX=enforcing 改成 SELINUX=disabled
	#关闭按却写入检查可以用如下命令直接操作
		sudo sed -i "s/SELINUX=enforcing/SELINUX=disabled/" /etc/selinux/config
	
	#重启查看=========
	命令:	getenforce
		显示 : Disabled
	命令:	sestatus -v
		显示 : SELinux status:                 disabled

#step5 : 设置主机之间无密码登陆 ================================================
	#如下命令,每个机子输入一遍,
	ssh-keygen -t rsa
	ssh-copy-id cm1
	ssh-copy-id cm2
	ssh-copy-id cm3

#step6 : 时间同步(如果是虚拟机, 选做)=========================================使用以前记录方法#######=============下面这个方法有待考究。
	#在此就不使用时间同步
	#三台机子选择时区
	timedatectl set-timezone Asia/Shanghai
	#在crontab设置时间同步(选取一台机子作为时间基准配置另外两台)
	1 * * * * /usr/sbin/ntpdate 192.168.1.102
		

#step7 : 安装jdk (这里安装rpm版本呗)==========================================
	
	#配置环境变量
    JAVA_HOME=/usr/java/jdk1.8.0_251
    JRE_HOME=/usr/java/jdk1.8.0_251/jre
    CLASS_PATH=.:$JAVA_HOME/bin/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib
    PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
    export JAVA_HOME JRE_HOME CLASS_PATH PATH


得到如下:

ip hostname 角色 任务
10.109.3.234 cm1
10.109.3.235 cm2 mysql
10.109.3.236 cm3

安装mysql

在此我们选择安装位置为:cm2

安装方法:略。

#配置mysql开机启动 
chkconfig mysql on

创建组件需要mysql数据库

创建安装cloudera manager及部分组件需要mysql数据库

mysql -u rootp

--删除语句(一般用不到,只有从装才用)
drop database hivedb;
drop database cmdb;
drop database huedb;
drop database ooziedb;
drop database scmdb;
drop database rmdb;

create database hivedb DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
create database cmdb DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
create database huedb DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
create database ooziedb DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
create database rmdb DEFAULT CHARSET utf8 COLLATE utf8_general_ci;

master机上编写分发脚本

cd /usr/local/bin

vim ync.sh 文件分发。 eg: ync.sh /home/ln/a.txt

#!/bin/bash

# 1 get the number of input parameters, if there is no parameter, quit directly
pcount=$#
if((pcount==0)); then
echo no args;
exit;
fi

# 2 get the file name
p1=$1
fname=`basename $p1`
echo fname=$fname

# 3 get the upper directory to the absolute path
pdir=`cd -P $(dirname $p1); pwd`
echo pdir=$pdir

# 4 get the current user name
user=`whoami`

# 5 cycle
for((host=3; host>=1; host--)); do
        #echo $pdir/$fname $user@hadoop$host:$pdir
        echo ---------- cm$host -----------
        rsync -rvl $pdir/$fname $user@cm$host:$pdir
done

vi call.sh #命令共同执行脚本 eg : call.sh ls

#!/bin/bash
pcount=$#
if((pcount==0));then
        echo no args;
        exit;
fi
#echo -------------localhost----------
#$@
for((host=1; host<=3; host++)); do
        echo ----------cm$host---------
        ssh cm$host $@
done

安装cloudera manage(CDH5)

#========================================安装教程======================================
#Centos6.5 离线搭建CDH5.11(带软件
	https://blog.csdn.net/chshgod1/article/details/80475596
#如果不想输入sudo , 接下来全程在root用户操作
#step1 :安装CDH依赖(可略)========================================================
	sudo yum -y install chkconfig 
    sudo yum -y install python 
    sudo yum -y install bind-utils 
    sudo yum -y install psmisc 
    sudo yum -y install libxslt 
    sudo yum -y install zlib 
    sudo yum -y install sqlite 
    sudo yum -y install cyrus-sasl-plain 
    sudo yum -y install cyrus-sasl-gssapi 
    sudo yum -y install fuse  
    sudo yum -y install portmap 
    sudo yum -y install fuse-libs 
    sudo yum -y install redhat-lsb

#step2 : 解压cm包到指定目录所有服务器都要(或者在主节点解压好,然后通过分发工具到其节点同一目录下)====
rm -rf /opt/cloudera*
mkdir /opt/cloudera-manager
tar -zxvf /opt/software/cloudera-manager-centos7-cm5.11.1_x86_64.tar.gz  -C /opt/cloudera-manager/
ync.sh /opt/cloudera-manager/

#step3 : (所有节点)创建cloudera-scm用户(所有节点) =================================
userdel cloudera-scm
useradd 
--system 
--home=/opt/cloudera-manager/cm-5.11.1/run/cloudera-scm-server 
--no-create-home 
--shell=/bin/false 
--comment "Cloudera SCM User" cloudera-scm

#step4 : (主节点)在主节点创建cloudera-manager-server本地数据保存目录================
rm -rf /var/cloudera-scm-server
mkdir /var/cloudera-scm-server
chown cloudera-scm.cloudera-scm -R /var/cloudera-scm-server/
chown cloudera-scm.cloudera-scm -R /opt/cloudera-manager/

#step5 : (所有节点)配置从节点cloudera-manger-agent指向主节点服务器(所有agent)===========
  vi /opt/cloudera-manager/cm-5.11.1/etc/cloudera-scm-agent/config.ini	
  #将server_host改为CMS所在的主机名即cm1 (既, server_host=localhost改成server_host=cm1)


#step6 : (主节点)主节点中创建parcel-repo仓库目录
rm -rf /opt/cloudera/parcel-repo
mkdir -p /opt/cloudera/parcel-repo
chown cloudera-scm.cloudera-scm -R /opt/cloudera
cd /opt/software/
cp CDH-5.11.1-1.cdh5.11.1.p0.4-el7.parcel*  manifest.json  /opt/cloudera/parcel-repo/
#注:其中CDH-5.10.2-1.cdh5.10.2.p0.18-el7.parcel.sha1 后缀要把1去掉
mv CDH-6.3.2-1.cdh6.3.2.p0.1605554-el7.parcel.sha1 CDH-6.3.2-1.cdh6.3.2.p0.1605554-el7.parcel.sha

#step6 : (所有节点,其实指的是cm1/2/3三个从节点)所有从节点创建parcels目录===================
rm -rf /opt/cloudera/parcels
mkdir -p /opt/cloudera/parcels
chown cloudera-scm:cloudera-scm /opt/cloudera/parcels
#解释:Clouder-Manager将CDHs从主节点的/opt/cloudera/parcel-repo目录中抽取出来,分发解压激活各个节点的/opt/cloudera/parcels目录
	cp /opt/cloudera/parcel-repo/* /opt/cloudera/parcels/
	

#step7 : (主节点)初始脚本配置数据库scm_prepare_database.sh(在主节点上)===================
#注意这里mysql位置,是不是cm1
/opt/cloudera-manager/cm-5.11.1/share/cmf/schema/scm_prepare_database.sh mysql -hcm1 -uroot -p123456 --scm-host cm1 scmdb scmdbu scmdbp
#**报错1**


#step8 : (主节点)启动主节点 cloudera-manager-server=================================
rm -rf /etc/init.d/cloudera-scm-server
cp /opt/cloudera-manager/cm-5.11.1/etc/init.d/cloudera-scm-server /etc/init.d/cloudera-scm-server
chkconfig cloudera-scm-server on
vi /etc/init.d/cloudera-scm-server
	#CMF_DEFAULTS=${CMF_DEFAULTS:-/etc/default} 改为	如下:
	#CMF_DEFAULTS=/opt/cloudera-manager/cm-5.11.1/etc/default	
#同时为了保证在每次服务器重启的时候都能启动cloudera-scm-server,应该开机启动脚本/etc/rc.local中加入命令:service cloudera-scm-server restart


#step9 : (所有节点)启动所有节点 cloudera-manager-agent===============================
rm -rf /etc/init.d/cloudera-scm-agent
mkdir /opt/cloudera-manager/cm-5.11.1/run/cloudera-scm-agent
cp /opt/cloudera-manager/cm-5.11.1/etc/init.d/cloudera-scm-agent /etc/init.d/cloudera-scm-agent
chkconfig cloudera-scm-agent on
vi /etc/init.d/cloudera-scm-agent		#模仿主节点
	#CMF_DEFAULTS=${CMF_DEFAULTS:-/etc/default} 改为	如下:
	#CMF_DEFAULTS=/opt/cloudera-manager/cm-5.11.1/etc/default	
#同时为了保证在每次服务器重启的时候都能启动cloudera-scm-agent,应该在开机启动脚本/etc/rc.local中加入命令:service cloudera-scm-agent restart 	

#step10 : 启动主节点和从节点的命令 =====================================================
/opt/cloudera-manager/cm-5.11.1/etc/init.d/cloudera-scm-server restart
#下面这行代码,好像每个从机都要弄
/opt/cloudera-manager/cm-5.11.1/etc/init.d/cloudera-scm-agent restart

# cm1:7180 进入cloundera-manger控制web =============================================
	#注意:如果迟迟进不去,检查是否是防火墙没关闭。



安装cloudera manage(CDH6)

数据库

create database hivedb DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
create database cmdb DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
create database huedb DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
create database ooziedb DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
create database rmdb DEFAULT CHARSET utf8 COLLATE utf8_general_ci;

create database cmf DEFAULT CHARACTER SET utf8;
create database amon DEFAULT CHARACTER SET utf8;
grant all on cmf.* TO 'cmf'@'%' IDENTIFIED BY '123456';
grant all on amon.* TO 'amon'@'%' IDENTIFIED BY '123456';
FLUSH PRIVILEGES;
#step1 : 解压cm6.3.1-redhat7.tar.gz 得到: =========================================
	#在./RPMS/x86_64:下
	cloudera-manager-agent-6.3.1-1466458.el7.x86_64.rpm
	cloudera-manager-daemons-6.3.1-1466458.el7.x86_64.rpm
	cloudera-manager-server-6.3.1-1466458.el7.x86_64.rpm
	cloudera-manager-server-db-2-6.3.1-1466458.el7.x86_64.rpm

#tep2 : 创建cm目录,解压文件。=======================================================
mkdir /usr/cloudera-manager
tar -zxvf ./cm6.3.1-redhat7.tar.gz  -C /usr/cloudera-manager/
ync.sh /usr/cloudera-manager/

#step3 : (主节点)安装cloudera-server (master)=====================================
#–nodeps检查依赖离线安装,网络问题造成拉不下依赖失败
cd /usr/cloudera-manager/cm6.3.1/RPMS/x86_64/
rpm -ivh cloudera-manager-daemons-6.3.1-1466458.el7.x86_64.rpm --nodeps --force
rpm -ivh cloudera-manager-server-6.3.1-1466458.el7.x86_64.rpm --nodeps --force
rpm -ivh cloudera-manager-agent-6.3.1-1466458.el7.x86_64.rpm --nodeps --force

#step4 : 修改server配置文件========================================================
vim /etc/cloudera-scm-server/db.properties
	com.cloudera.cmf.db.type=mysql 
	com.cloudera.cmf.db.host=cm1		
	com.cloudera.cmf.db.name=cmf 
	com.cloudera.cmf.db.user=cmf 
	com.cloudera.cmf.db.password=123456
	com.cloudera.cmf.db.setupType=EXTERNAL

#step5 : (从节点)安装cloudera-agent()======================================
    cd /usr/cloudera-manager/cm6.3.1/RPMS/x86_64
    #注意这个 daemons 已经在master上安装过了
    rpm -ivh cloudera-manager-daemons-6.3.1-1466458.el7.x86_64.rpm --nodeps --force  
    rpm -ivh cloudera-manager-agent-6.3.1-1466458.el7.x86_64.rpm --nodeps --force

#step6 :(所有节点)安装完成后,修改所有节点的agant配置文件指向server节点master=========
vim /etc/cloudera-scm-agent/config.ini
	#把 server_host=localhost 改成 server_host=cm1

#step7 : 启动server和agent服务====================================================
    # 启动命令
        service cloudera-scm-server restart 
    # 查看日志
        cd /var/log/cloudera-scm-server/ 
        ll
        tail -F cloudera-scm-server.log 
    # 等一分钟,查看启动状态
    	service cloudera-scm-server status

    #agent启动(所有机子都要)
        service cloudera-scm-agent restart 
    # 查看启动状态
        service cloudera-scm-agent status

#
cp CDH-6.3.1-1.cdh6.3.1.p0.1470567-el7.parcel /opt/cloudera/parcel-repo
cp CDH-6.3.1-1.cdh6.3.1.p0.1470567-el7.parcel.sha1 /opt/cloudera/parcel-repo/CDH-6.3.1-1.cdh6.3.1.p0.1470567-el7.parcel.sha
cp manifest.json /opt/cloudera/parcel-repo
ync.sh /opt/cloudera/parcel-repo
call.sh chmod 777 /opt/cloudera/parcel-repo/*  #意思是给三台机子这里777权限

当安装失败,重装需要删除

rm -rf /usr/cloudera-manager/
rm -rf /var/lib/cloudera-scm-agent
rm -rf /dfs
rm -rf /var/log/*
rm -rf /etc/cloudera-scm-server/
rm -rf /etc/cloudera-scm-agent/
rm -rf /opt/*

CDH6.3新增机器

步骤
1. 修改主机2. 配置新节点hosts和各结点映射(/etc/hosts3. 关闭防火墙
4. 配置ntp。与集群相同,从节点都同步主节点时间
5. 免密登录
6. 安装JDK
7. 禁用透明大页面压缩
9. 禁用tuned系统调优服务
10. 离线rpm安装daemons和agent
11. agent修改/etc/cloudera-scm-agent/config.ini
12. 上传CDH至/opt/cloudera/parcel-repo/
13. 配置新从机config.ini

cdh添加节点具体操作如下:

#step1 : 修改主机名 ==========================================================
    vim /etc/hostname
    cat /etc/hostname
        #删除里面内容, 写上新的主机名,即可

#step2. 配置新节点hosts和各结点映射(/etc/hosts)	===============================================
	新旧节点都配置一下。
	vim /etc/hosts

#step3 : 关闭防火墙 ========================================================
	#新节点关闭防火墙==========
	sudo systemctl stop firewalld
	sudo systemctl disable firewalld
	sudo systemctl status firewalld
	
	#关闭安全写入检查=====
	vi /etc/selinux/config
		#将SELINUX=enforcing 改成 SELINUX=disabled
	#关闭按却写入检查可以用如下命令直接操作
		sudo sed -i "s/SELINUX=enforcing/SELINUX=disabled/" /etc/selinux/config
	
	#重启后查看=========
	命令:	getenforce
		显示 : Disabled
	命令:	sestatus -v
		显示 : SELinux status:                 disabled

#step4. 配置ntp。与集群相同,从节点都同步主节点时间    ===============================================

#step5. 免密登录=================================================================================master和新slove之间配置
	ssh-keygen -t rsa
	ssh-copy-id xxxx
	
	
#step6. 安装JDK=================================================================================
	#安装java
	-
	#配置环境变量
    JAVA_HOME=/usr/java/jdk1.8.0_251
    JRE_HOME=/usr/java/jdk1.8.0_251/jre
    CLASS_PATH=.:$JAVA_HOME/bin/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib
    PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
    export JAVA_HOME JRE_HOME CLASS_PATH PATH

#step7(选).禁用透明大页面压缩===================================================================https://blog.csdn.net/qq_33887096/article/details/114532935】
	#首先查看透明大页是否启用,[always] never表示已启用,always [never]表示已禁用
	cat /sys/kernel/mm/transparent_hugepage/enabled
	[always] madvise never
	
	#如果是启用状态,修改/etc/rc.d/rc.local文件并添加以下两行
	echo never > /sys/kernel/mm/transparent_hugepage/defrag
	echo never > /sys/kernel/mm/transparent_hugepage/enabled
 	
 	#上述修改要重启才能生效
	#检查是否关闭透明大页的命令:
	grep Huge /proc/meminfo


#step9(选). 禁用tuned系统调优服务=====================================================================
	#关闭tuned服务
	tuned-adm off
	确保没有激活的配置
	tuned-adm list
	如果输出内容包含No current active profile表示关闭成功:
	
	#关闭并且禁用tuned服务
	systemctl stop tuned
	systemctl disable tuned


#step10. 安装agent,新增节点创建用户cloudera-scm============================================

	#注意,如下生产上是直接放在/opt/下
	mkdir /opt/cloudera-manager
	tar -zxvf cloudera-manager-centos7-cm5.11.1_x86_64.tar.gz -C /opt/cloudera-manager/
	
	
    userdel cloudera-scm
    useradd 
    --system 
    --home=/opt/cloudera-manager/cm-5.11.1/run/cloudera-scm-server 
    --no-create-home 
    --shell=/bin/false 
    --comment "Cloudera SCM User" cloudera-scm


#step11. 上传CDH至/opt/cloudera/parcel-repo/ ====================================================
    CDH-6.0.1-1.cdh6.0.1.p0.590678-el7.parcel 
    #修改.sha256文件后缀为.sha,在manifest.json中查看el7的序列输入到.sha文件
    CDH-6.0.1-1.cdh6.0.1.p0.590678-el7.parcel.sha256
    manifest.json
    
    
#step12 : 配置从节点cloudera-manger-agent指向主节点服务器(所有agent)==================================
  #新从节点。
  vi /opt/cloudera-manager/cm-5.11.1/etc/cloudera-scm-agent/config.ini	
  #将server_host改为CMS所在的主机名即主节点主机名 (既, server_host=localhost改成server_host=主节点主机名)
  
 
#step13 : 启动 CM Agent==========================================================================
/opt/cloudera-manager/cm-5.16.1/etc/init.d/cloudera-scm-agent start

原文地址:https://blog.csdn.net/myself_ning/article/details/125920206

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任

如若转载,请注明出处:http://www.7code.cn/show_13493.html

如若内容造成侵权/违法违规/事实不符,请联系代码007邮箱:suwngjj01@126.com进行投诉反馈,一经查实,立即删除!

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注