1、下载相关安装包:
CDH安装相关的包
cloudera manager包 :5.7.2 cloudera-manager-centos7-cm5.7.2_x86_64.tar.gz
CDH-5.7.2-1.cdh5.7.2.p0.11-el7.parcel
CDH-5.7.2-1.cdh5.7.2.p0.11-el7.parcel.sha1
manifest.json
以上三个下载地址在http://archive.cloudera.com/cdh5/parcels/5.7.2/,注意centos要下载el7的,我就因为一开始不清楚下的el6,结果提示parcels不知道redhat7,搞了好久才还原到初始重新来过
CentOS-7-x86_64-Minimal-1804.iso:
jdk:
Mysql:
rpm包:http://dev.mysql.com/get/Downloads/MySQL-5.6/MySQL-5.6.26-1.linux_glibc2.5.x86_64.rpm-bundle.tarjdbc连接包mysql-connector-java-5.1.39-bin.jar: http://dev.mysql.com/downloads/connector/j/
2、安装Centos
这个没什么好说的,内存大小至少5G以上,磁盘至少至少得有30G,否则会出现各种意想不到的错误。
有一点,如果你需要用共享目录,需要手动挂载,
首先需要安装 VBoxLinuxAdditions
mount /dev/cdrom /home/tb/winshare/
yum install gcc kernel-devel kernel-headers dkms make bzip2
sh ./VBoxLinuxAdditions.run
接下来挂载共享目录
mount -t vboxsf sharedFlod /home/zl/sharedFlod/
3、安装jdk
如果有原生的openJDK需要删除掉
[root@cdh1~]$ java -version
[root@cdh1~]$ rpm -qa | grep jdk
java-1.7.0-openjdk-1.7.0.75-2.5.4.2.el7_0.x86_64
java-1.7.0-openjdk-headless-1.7.0.75-2.5.4.2.el7_0.x86_64
[root@cdh1~]# yum -y remove java-1.7.0-openjdk-1.7.0.75-2.5.4.2.el7_0.x86_64
[root@cdh1~]# yum -y remove java-1.7.0-openjdk-headless-1.7.0.75-2.5.4.2.el7_0.x86_64
[root@cdh1~]# java -version
bash: /usr/bin/java: No such file or directory
[root@cdh1~]# rpm -ivh jdk-8u101-linux-x64.rpm
[root@cdh1~]# java -version
java version “1.8.0_101”
Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)
4、配置host
[root@cdh1~]# vi /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=cdh1
[root@cdh1~]# vi /etc/hosts
127.0.0.1 localhost.cdh1
192.168.42.128 cdh1
192.168.42.129 cdh2
192.168.42.130 cdh3
5、关闭selinux(所有节点官方文档要求),机器重启后生效
[root@cdh1~]# vi /etc/sysconfig/selinux
SELINUX=disabled
[root@cdh1~]#sestatus -v
SELinux status: disabled
表示已经关闭了
6、关闭防火墙
[root@cdh1~]# systemctl stop firewalld
[root@cdh1~]# systemctl disable firewalld
rm ‘/etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service’
rm ‘/etc/systemd/system/basic.target.wants/firewalld.service’
[root@cdh1~]# systemctl status firewalld
firewalld.service – firewalld – dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled)
Active: inactive (dead)
7、配置时间服务器
思路是,master作为服务器,从外部获取标准时间,其他slave从matser处获取时间,以达到时间同步的目的。
yum -y install ntp(全部节点)
更改master的节点
vi /etc/ntp.conf(master节点)
注释掉所有server *.*.*的指向,新添加一条可连接的ntp服务器(我选的外部时间服务器)
server ntp.sjtu.edu.cn iburst(master节点)
在其他节点上把ntp指向master服务器地址即可(/etc/ntp.conf下)
server cdh1 iburst(slave节点)
systemctl start ntpd //启动ntp服务 (全部节点)
systemctl status ntpd //查看ntp服务状态(全部节点)
8、免密登录:
生成秘钥:
ssh-keygen -t rsa
设置从129到本机的免密登录:
ssh-copy-id 192.168.42.129
9、MySQL:
首先需要删除Centos自带的mariadb服务
[root@cdh1 /]# rpm -qa | grep mariadb
mariadb-libs-5.5.41-2.el7_0.x86_64
[root@cdh1 /]# rpm -e –nodeps mariadb-libs-5.5.41-2.el7_0.x86_64
[root@cdh1 /]# tar -xvf MySQL-5.6.24-1.linux_glibc2.5.x86_64.rpm-bundle.tar //mysql rpm包拷贝到服务器上然后解压
[root@cdh1 /]# rpm -ivh MySQL-*.rpm //安装释出的全部rpm
[root@cdh1 /]# cp /usr/share/mysql/my-default.cnf /etc/my.cnf
[root@cdh1 /]# vi /etc/my.cnf //在配置文件中增加以下配置并保存
[mysqld]
default-storage-engine = innodb
innodb_file_per_table
collation-server = utf8_general_ci
init-connect = ‘SET NAMES utf8’
character-set-server = utf8
[root@cdh1 /]# yum install -y perl-Module-Install.noarch
[root@cdh1 /]# /usr/bin/mysql_install_db //初始化mysql
[root@cdh1 /]# service mysql restart //启动mysql
ERROR! MySQL server PID file could not be found!
Starting MySQL… SUCCESS!
[root@cdh1 /]# cat /root/.mysql_secret //查看mysql root初始化密码
# The random password set for the root user at Fri Sep 22 11:13:25 2017 (local time): 9mp7uYFmgt6drdq3
[root@cdh1 /]# mysql -u root -p //登录进行去更改密码
mysql> SET PASSWORD=PASSWORD(‘123456’);
mysql> update user set host=’%’ where user=’root’ and host=’localhost’; //允许mysql远程访问
Query OK, 1 row affected (0.05 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
[root@cdh1 /]# chkconfig mysql on //配置开机启动
[root@cdh1 /]# tar -zcvf mysql-connector-java-5.1.44.tar.gz // 解压mysql-connector-java-5.1.44.tar.gz得到mysql-connector-java-5.1.44-bin.jar
[root@cdh1 /]# mkdir /usr/share/java // 在各节点创建java文件夹
[root@cdh1 /]# cp mysql-connector-java-5.1.44-bin.jar /usr/share/java/mysql-connector-java.jar //将mysql-connector-java-5.1.44-bin.jar拷贝到/usr/share/java路径下并重命名为mysql-connector-java.jar
10、创建数据库:
create database hive DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
create database amon DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
create database hue DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
create database monitor DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
create database oozie DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
grant all on *.* to root@”%” Identified by “123456”;
11、安装CDH:
//解压cm tar包到指定目录所有服务器都要(或者在主节点解压好,然后通过scp到各个节点同一目录下)
[root@cdh1 ~]#mkdir /opt/cloudera-manager
[root@cdh1 ~]# tar -axvf cloudera-manager-centos7-cm5.7.2_x86_64.tar.gz -C /opt/cloudera-manager
//创建cloudera-scm用户(所有节点)
[root@cdh1 ~]# useradd –system –home=/opt/cloudera-manager/cm-5.7.2/run/cloudera-scm-server –no-create-home –shell=/bin/false –comment “Cloudera SCM User” cloudera-scm
//在主节点创建cloudera-manager-server的本地元数据保存目录
[root@cdh1 ~]# mkdir /var/cloudera-scm-server
[root@cdh1 ~]# chown cloudera-scm:cloudera-scm /var/cloudera-scm-server
[root@cdh1 ~]# chown cloudera-scm:cloudera-scm /opt/cloudera-manager
//配置从节点cloudera-manger-agent指向主节点服务器
[root@cdh1 ~]# vi /opt/cloudera-manager/cm-5.7.2/etc/cloudera-scm-agent/config.ini
将server_host改为CMS所在的主机名即cdh1
//主节点中创建parcel-repo仓库目录
[root@cdh1 ~]# mkdir -p /opt/cloudera/parcel-repo
[root@cdh1 ~]# chown cloudera-scm:cloudera-scm /opt/cloudera/parcel-repo
[root@cdh1 ~]# cp CDH-5.7.2-1.cdh5.7.2.p0.18-el7.parcel CDH-5.7.2-1.cdh5.7.2.p0.18-el7.parcel.sha manifest.json /opt/cloudera/parcel-repo
注意:其中CDH-5.7.2-1.cdh5.7.2.p0.18-el5.parcel.sha1 后缀要把1去掉
//所有节点创建parcels目录
[root@cdh1 ~]# mkdir -p /opt/cloudera/parcels
[root@cdh1 ~]# chown cloudera-scm:cloudera-scm /opt/cloudera/parcels
解释:Clouder-Manager将CDHs从主节点的/opt/cloudera/parcel-repo目录中抽取出来,分发解压激活到各个节点的/opt/cloudera/parcels目录中
//初始脚本配置数据库scm_prepare_database.sh(在主节点上)
[root@cdh1 ~]# /opt/cloudera-manager/cm-5.7.2/share/cmf/schema/scm_prepare_database.sh mysql -hcdh1 -uroot -p123456 –scm-host cdh1 scmdbn scmdbu scmdbp
说明:这个脚本就是用来创建和配置CMS需要的数据库的脚本。各参数是指:
mysql:数据库用的是mysql,如果安装过程中用的oracle,那么该参数就应该改为oracle。
-cdh1:数据库建立在cdh1主机上面,也就是主节点上面。
-uroot:root身份运行mysql。-123456:mysql的root密码是***。
–scm-host cdh1:CMS的主机,一般是和mysql安装的主机是在同一个主机上,最后三个参数是:数据库名,数据库用户名,数据库密码。
如果报错:
ERROR com.cloudera.enterprise.dbutil.DbProvisioner – Exception when creating/dropping database with user ‘root’ and jdbc url ‘jdbc:mysql://localhost/?useUnicode=true&characterEncoding=UTF-8‘
java.sql.SQLException: Access denied for user ‘root’@’cdh1’ (using password: YES)
运行如下命令:
update user set PASSWORD=PASSWORD(‘123456′) where user=’root’;
GRANT ALL PRIVILEGES ON *.* TO ‘root’@’cdh1’ IDENTIFIED BY ‘123456’ WITH GRANT OPTION;
FLUSH PRIVILEGES;
//启动主节点
[root@cdh1 ~]# cp /opt/cloudera-manager/cm-5.7.2/etc/init.d/cloudera-scm-server /etc/init.d/cloudera-scm-server
[root@cdh1 ~]# chkconfig cloudera-scm-server on
[root@cdh1 ~]# vi /etc/init.d/cloudera-scm-server
CMF_DEFAULTS=${CMF_DEFAULTS:-/etc/default}改为=/opt/cloudera-manager/cm-5.7.2/etc/default
[root@cdh1 ~]# service cloudera-scm-server start
//同时为了保证在每次服务器重启的时候都能启动cloudera-scm-server,应该在开机启动脚本/etc/rc.local中加入命令:service cloudera-scm-server restart
//启动cloudera-scm-agent所有节点
[root@cdhX ~]# mkdir /opt/cloudera-manager/cm-5.7.2/run/cloudera-scm-agent
[root@cdhX ~]# cp /opt/cloudera-manager/cm-5.7.2/etc/init.d/cloudera-scm-agent /etc/init.d/cloudera-scm-agent
[root@cdhX ~]# chkconfig cloudera-scm-agent on
[root@cdhX ~]# vi /etc/init.d/cloudera-scm-agent
CMF_DEFAULTS=${CMF_DEFAULTS:-/etc/default}改为=/opt/cloudera-manager/cm-5.7.2/etc/default
[root@cdhX ~]# service cloudera-scm-agent start
//同时为了保证在每次服务器重启的时候都能启动cloudera-scm-agent,应该在开机启动脚本/etc/rc.local中加入命令:service cloudera-scm-agent restart
12、安装流程:
进入192.168.42.128:7180 默认使用admin admin登录
首先安装Cloudera Management Service
再安装集群Cluster 1,分配角色。
账号密码:
mysql:root/123456
CDH:admin/admin
centos:root/root
关于错误:
问题:无法发出查询:Host Monitor 未运行:
原因:内存太小
问题:Src file /opt/cloudera/parcels/.flood/ INFORMATICA-10.1.0.informatica10.1.0.p1.364-sles11.parcel/ INFORMATICA-10.1.0.informatica10.1.0.p1.364-sles11.parcel does not exist.:
原因:磁盘空间太小
关于日志:
/opt/cloudera-manager/cm-5.7.2/log/
关于网络:
使用 bridge 桥接模式:
vi /etc/sysconfig/network-scripts/ifcfg-enp0s3
可以设置为自动获取IP
BOOTPROTO=dhcp
ONBOOT=yes
或者手动获取:
BOOTPROTO=static
ONBOOT=yes
IPADDR=192.168.1.1
NETMASK=255.255.240.0
GATEWAY=192.168.128.1
重启网络服务:
systemctl restart network.service
查看网络服务状态:
systemctl status network.service
关于失败的节点处理:
关闭agent服务
service cloudera-scm-agent stop
删除agent的uuid
rm -rf /opt/cm-5.13.1/lib/cloudera-scm-agent/*
删除数据库scm
mysql -u root-p
drop database scmdbn
重新配置数据库
/opt/cm-5.13.1/share/cmf/schema/scm_prepare_database.sh mysql cm -hlocalhost -uroot -p123456 –scm-host localhost scm scm scm
关于扩展磁盘大小:
首先需要增加磁盘大小
“C:\Program Files\Oracle\VirtualBox\VBoxManage.exe” clonehd “source.vmdk” “cloned.vdi” –format vdi
//扩展到120G
“C:\Program Files\Oracle\VirtualBox\VBoxManage.exe” modifyhd cloned.vdi –resize 1228800
//转换回原格式
“C:\Program Files\Oracle\VirtualBox\VBoxManage.exe” clonehd cloned.vdi “mac13.vmdk” –format vmdk
fdisk /dev/sda 操作 /dev/sda 的分区表
p –查看已分区数量(我看到有两个 /dev/sda1 /dev/sda2)
n –新增加一个分区
p –分区类型我们选择为主分区
3 –分区号选3(因为1,2已经用过了,见上)
回车 –默认(起始扇区)
回车 –默认(结束扇区)
t –修改分区类型
3 –选分区3
8e –修改为LVM(8e就是LVM)
w –写分区表
shutdown -r now —重启
查看卷大小:
hd -h
格式化:
mkfs.ext3 /dev/sda3
lvm –进入lvm管理
lvm> pvcreate /dev/sda3 –初始化刚才的分区
lvm> vgextend centos /dev/sda3 –将初始化过的分区加入到虚拟卷组
lvm>lvextend -L +29.9G /dev/centos/root –扩展已有卷的容量
lvm>pvdisplay –查看卷容量
lvm>quit –退出
以上只是卷扩容了,下面是文件系统的真正扩容,输入以下命令:
resize2fs /dev/centos/root(xfs要用这个命令:xfs_growfs /dev/centos/root)
再运行下:df -h查看下我们机器