CDH
简介
• Cloudera’s Distribution, including Apache Hadoop
• 是Hadoop众多分支中的一种,由Cloudera维护,基于稳定版本的Apache Hadoop构建
• 提供了Hadoop的核心
– 可扩展存储
– 分布式计算
• 基于Web的用户界面
本次测试主机为一台服务器
主机名:CDH1 IP:192.168.1.254
账号:root 密码:CDH1test
主机系统为:centos7x
安装版本:Cloudera Manager-5.12.1、CDH-5.12.1、jdk-1.8.0_261、mysql-5.7.16、spak2-2.4.0、kafka-4.1.0
网盘下载
提取码:flod
以上文件使用ftp工具上传到centos7的/root/CDH1目录(这个目录随意)
主机映射(单机可有可无)
vim /etc/hosts
末尾插入以下内容
192.168.1.254 CDH1
Windows下操作
C:\Windows\System32\drivers\etc\hosts
192.168.1.254 CDH1
关闭防火墙
systemctl status firewalld.service #查看状态
systemctl stop firewalld.service #关闭
systemctl disable firewalld.service #禁止自启
关闭Selinux
getenforce #查看
setenforce 0 #临时关闭
永久关闭
查看 sestatus
修改配置文件(重启生效)
vim /etc/selinux/config
将SELINUX=enforcing 改为SELINUX=disabled
安装jdk
解压
tar -zxvf jdk-8u261-linux-x64.tar.gz -C /usr/local
mv jdk***/ java/
配置环境变量
vim /etc/profile
#末尾添加
export JAVA_HOME=/usr/local/java
export PATH=$PATN:$JAVA_HOME/bin
source /etc/profile #刷新
查看是否配置成功
jps
java -version
安装依赖
yum ‐y install gcc python‐devel cyrus‐sasl* chrony iotop yum‐utils yum‐pl ugin‐downloadonly psmisc ntp ntpdate httpd createrepo wget git rsync mod_ss l cyrus‐sasl‐plain cyrus‐sasl‐devel cyrus‐sasl‐gssapi libxslt krb5‐devel cy rus‐sasl‐gssapi cyrus‐sasl‐devel libxml2‐devel libxslt‐devel openldap‐devel python‐devel python‐simplejson sqlite‐devel
卸载mariadb数据库
yum -y remove mariadb-libs
yum localinstall mysql
好处是不用下载更多的rpm包,会自动安装所需要的rpm包(网上看到的)
yum -y localinstall mysql-community-common-5.7.16-1.el7.x86_64.rpm
yum -y localinstall mysql-community-libs-5.7.16-1.el7.x86_64.rpm
yum -y localinstall mysql-community-libs-compat-5.7.16-1.el7.x86_64.rpm
yum -y localinstall mysql-community-client-5.7.16-1.el7.x86_64.rpm
yum -y localinstall mysql-community-server-5.7.16-1.el7.x86_64.rpm
mysql
安装好后操作
启动mysqld服务
systemctl start mysqld
查看默认密码
cat /var/log/mysqld.log | grep password
登录
mysql -uroot -p'******'
首次登陆修改密码
set password=password('MySQL123...');
quit
登陆设置允许外网访问当前的MySQL
mysql -uroot -p'MySQL123...'
use mysql;
update user set host='%' where host='localhost';
delete from user where host != '%';
flush privileges;
quit
创建ClouderaManager需要用到的几个数据库
mysql -uroot -p'MySQL123...'
create database cmf default character set = 'utf8';
create database amon default character set = 'utf8';
create database hive default character set = 'utf8';
quit
安装cm前操作
创建文件目录
mkdir -p /opt/cloudera/parcel-repo
mkdir -p /opt/cloudera/parcel-cache
mkdir -p /opt/cloudera/parcels
mkdir -p /opt/cloudera/csd
mkdir -p /opt/cloudera-manager
mkdir -p /usr/share/java
mysql jdbc
驱动
mv mysql-connector-java-5.1.49.jar /usr/share/java/
cd /usr/share/java/
mv mysql-connector-java-5.1.49.jar mysql-connector-java.jar
安装Cloudera Manager
解压
tar -zxf cloudera-manager-centos7-cm5.12.1_x86_64.tar.gz -C /opt/cloudera-manager/
编辑agent配置文件
cd /opt/cloudera-manager/cm-5.12.1/etc/cloudera-scm-agent
vim config.ini
server_host=CDH1
编辑server配置文件
cd /opt/cloudera-manager/cm-5.12.1/etc/cloudera-scm-server
vim db.properties
com.cloudera.cmf.db.host=CDH1
com.cloudera.cmf.db.name=cmf
com.cloudera.cmf.db.user=root
com.cloudera.cmf.db.password=MySQL123...
com.cloudera.cmf.db.setupType=EXTERNAL
第一次运行server服务
/opt/cloudera-manager/cm-5.12.1/etc/init.d/cloudera-scm-server start
连接数据库查看cmf库会创建很多表
查看server日志
cd /opt/cloudera-manager/cm-5.12.1/log/cloudera-scm-server
tail -200f cloudera-scm-server.log
直到看到0.0.0.0:7180与startedjetty server,代表运行成功如图:
也可通过netstat -tlunp、netstat -anp | grep 7180查询7180端口是否开放,如图:
运行成功后关闭服务
/opt/cloudera-manager/cm-5.12.1/etc/init.d/cloudera-scm-server stop
把需要用到的parcel包放到对应目录
mv CDH-5.12.1-1.cdh5.12.1.p0.3-el7.parcel /opt/cloudera/parcel-repo/
mv CDH-5.12.1-1.cdh5.12.1.p0.3-el7.parcel.sha /opt/cloudera/parcel-repo/
mv SPARK2-2.4.0.cloudera2-1.cdh5.13.3.p0.1041012-el7.parcel /opt/cloudera/parcel-repo/
mv SPARK2-2.4.0.cloudera2-1.cdh5.13.3.p0.1041012-el7.parcel.sha /opt/cloudera/parcel-repo/
mv KAFKA-4.1.0-1.4.1.0.p0.4-el7.parcel /opt/cloudera/parcel-repo/
mv KAFKA-4.1.0-1.4.1.0.p0.4-el7.parcel.sha /opt/cloudera/parcel-repo/
mv manifest.json /opt/cloudera/parcel-repo/
mv SPARK2_ON_YARN-2.4.0.cloudera2.jar /opt/cloudera/csd
创建用户和组
useradd --system --home=/opt/cloudera-manager/cm-5.12.1/run/cloudera-scm-server/ --no-create-home --shell=/bin/false cloudera-scm
chown -R cloudera-scm:cloudera-scm /opt/cloudera
chown -R cloudera-scm:cloudera-scm /opt/cloudera-manager
设置相关参数
sysctl vm.swappiness=10
echo 'vm.swappiness=10'>> /etc/sysctl.conf
echo never > /sys/kernel/mm/transparent_hugepage/defrag
echo never > /sys/kernel/mm/transparent_hugepage/enabled
echo 'echo never > /sys/kernel/mm/transparent_hugepage/defrag' >> /etc/rc.local
echo 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' >> /etc/rc.local
启动server及agent节点
/opt/cloudera-manager/cm-5.12.1/etc/init.d/cloudera-scm-server start
/opt/cloudera-manager/cm-5.12.1/etc/init.d/cloudera-scm-agent start
Agent节点可能一次起不来,没关系再次启动就好
查看运行状态
/opt/cloudera-manager/cm-5.12.1/etc/init.d/cloudera-scm-server status
/opt/cloudera-manager/cm-5.12.1/etc/init.d/cloudera-scm-agent status
Windows下打开浏览器输入网址CDH1:7180或者192.168.1.254:7180,用户名密码都是admin
添加服务界面
选择安装的主机(启动agent主机),我已经添加过了所以这里不显示
下面直接到主界面讲
下面是parcel管理界面我们上传的parcel包,点击分配然后激活就可以安装服务了。(注意一点,从下载下来parcel包的哈希文件后缀是sha1一定要更改为sha不然会导致此界面显示未找到哈希文件)
把SPARK2_ON_YARN-2.4.0.cloudera2.jar放在/opt/cloudera/csd添加服务界面才会显示spark2,不然CDH5x仅有spark。
添加服务界面就不详细展开了,web界面每一个服务安装过程都会指定安装主机,本次单机安装全部装在本机上,下一步根据需要调配置安装就好。
下面是已经添加服务的几个web界面