一、基础环境搭建

1. 下载包:
    https://archive.cloudera.com/cdh6/6.2.1/parcels/     https://archive.cloudera.com/cm6/6.2.1/redhat7/yum/RPMS/x86_64/
    
2. 安装依赖包
    yum install -y cyrus-sasl-plain cyrus-sasl-gssapi portmap fuse-libs bind-utils libxslt fuse
    yum install -y /lib/lsb/init-functions createrepo deltarpm python-deltarpm
    yum install -y mod_ssl openssl-devel python-psycopg2 MySQL-python
    
3. 安装httpd(只需要在部署本地yum源的机器上安装即可)
    yum install httpd
    yum install createrepo
    
4. 配置host
vim /etc/hosts
127.0.0.1   localhost
192.168.231.111 s111
192.168.231.112 s112
192.168.231.113 s113

5. 关闭防火墙
查看防火墙状态: systemctl status firewalld.service
绿的running表示防火墙开启
执行关闭命令: systemctl stop firewalld.service
再次执行查看防火墙命令:systemctl status firewalld.service
执行开机禁用防火墙自启命令  : systemctl disable firewalld.service
完成

6. 关闭selinux(在配置文件中第一次设置时需要重启服务器)
setenforce 0

vim /etc/selinux/config
将SELINUX=enforcing改为SELINUX=disabled

reboot

7. 安装httpd服务
yum install httpd -y(已安装过)
systemctl start httpd.service 启动httpd服务

cd /var/www/html/
mkdir -p cm6/6.2.1/redhat7/yum/RPMS/x86_64/
上传cmd6中的文件到此目录,上传allkeys.asc文件到/var/www/html/cm6/6.2.1/目录下

访问测试:http://192.168.231.111/cm6/6.2.1/redhat7/yum/RPMS/x86_64/

8. 生成repodata目录(便于通过yum源找到文件)
cd /var/www/html/cm6/6.2.1/redhat7/yum
createrepo .

9. 配置本地yum源
cd /etc/yum.repos.d/
vim cloudera-manager.repo
填写:
[cloudera-manager]
name=Cloudera Manager
baseurl=http://192.168.231.111/cm6/6.2.1/redhat7/yum/
gpgcheck=0
enabled=1

执行命令:
yum clean all
yum list | grep cloudera

10. 创建cloudera-scm用户(centos7要求必须有,centos6没有要求)
useradd cloudera-scm
passwd cloudera-scm
test123456
--免密钥登录
echo "cloudera-scm ALL=(root)NOPASSWD:ALL" >> /etc/sudoers
su - cloudera-scm
exit

11. 安装mysql服务
第一步:下载repo,并安装mysql-server
wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
--wget http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
--wget http://repo.mysql.com/mysql57-community-release-el7-10.noarch.rpm
yum -y install mysql57-community-release-el7-10.noarch.rpm
yum -y install mysql-community-server
这个步骤需要网络,并根据网速会花些时间,安装完成后会覆盖之前的mariadb。
如果提示-bash: wget: 未找到命令,则:yum -y install wget

第二步:mysql设置
启动:
systemctl start mysqld.service
查看运行情况:
systemctl status mysqld.service

第三步:登录mysql
查看mysql密码
grep "password" /var/log/mysqld.log
登录mysql
mysql -uroot -p

第四步:修改密码
取消mysql密码规范限制(正式环境保留强密码)
set global validate_password_policy=0;
set global validate_password_length=1;
重设密码
alter user 'root'@'localhost' identified by '123456';
flush privileges;

第五步:卸载repo包
此时还有一个问题,因为安装了yum repository,以后每次yum都会自动更新,耗费时间,所以卸载掉:
yum -y remove mysql57-community-release-el7-10.noarch

第六步:安装mysql(后续作为元数据库)
create database scm DEFAULT CHARACTER SET utf8;
grant all PRIVILEGES on *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;
grant all PRIVILEGES on *.* TO 'root'@'localhost' IDENTIFIED BY '123456' WITH GRANT OPTION;
grant all PRIVILEGES on *.* TO 'root'@'hadoop01' IDENTIFIED BY '123456' WITH GRANT OPTION;
flush privileges;

 

二、配置server和agent

1、安装Server服务
yum install -y oracle-j2sdk1.8-1.8.0+update181-1.x86_64
yum install -y enterprise-debuginfo-6.2.1-1426065.el7.x86_64
yum install -y cloudera-manager-server-6.2.1-1426065.el7.x86_64
yum install -y cloudera-manager-server-db-2-6.2.1-1426065.el7.x86_64

注意:如果在yum源中添加了新的包时:
(1).需要删除之前的repodata文件后,重新生成;
(2).重启httpd服务
(3).清除yum缓存 yum clean all

2、设置元数据库为mysql
设置元数据库为mysql--前提是安装ClouderaManager Server服务
/opt/cloudera/cm/schema/scm_prepare_database.sh -h localhost mysql scm root 123456
旧版本:/usr/share/cmf/schema/scm_prepare_database.sh -h localhost mysql scm root 123456

提示ERROR JDBC Driver com.mysql.jdbc.Driver not found.
需要上传mysql驱动包jar到/opt/cloudera/cm/lib目录下。

查看:cat /etc/cloudera-scm-server/db.properties

3、启动server服务进程(查看7180端口)
systemctl start cloudera-scm-server
查看启动日志:
tail -f /var/log/cloudera-scm-server/cloudera-scm-server.log
查看启动状态:
systemctl status cloudera-scm-server

netstat -an | grep 7180

4、配置本地parcel包
注意:必须要在数据库初始化后,将parcel文件放置到/opt/cloudera/parcel-repo目录中
4.1 上传cdh6的parcel等文件到opt/cloudera/parcel-repo
4.2 重命名密钥文件名
mv CDH-6.2.1-1.cdh6.2.1.p0.1425774-el7.parcel.sha1 CDH-6.2.1-1.cdh6.2.1.p0.1425774-el7.parcel.sha

5、开始安装
访问Server:http://192.168.231.111:7180/cmf/login
账号密码均为admin

设置Parcel 更新频率为1分钟

6、swappiness和透明化

cdh上安装spark2 cdh安装配置_上传


临时生效:

sysctl -w vm.swappiness=10

echo never > /sys/kernel/mm/transparent_hugepage/defrag

echo never > /sys/kernel/mm/transparent_hugepage/enabled

永久生效:

echo "vm.swappiness=10" >> /etc/sysctl.conf

echo "echo never > /sys/kernel/mm/transparent_hugepage/defrag" >> /etc/rc.local

echo "echo never > /sys/kernel/mm/transparent_hugepage/enabled" >> /etc/rc.local