(史上最全傻瓜式教程)CM+CDH安装搭建全过程
一、安装前准备1.1、官网教程文档地址:https://docs.cloudera.com/documentation/enterprise/6/6.3/topics/install_cm_cdh.html1.2、安装环境主机名操作系统角色IP地址cdh100Centos 7.6主节点192.168.3.10
目录
2.1、在VMWare Workstation Pro下安装Centos7.6虚拟机
2.2.1、将虚拟机网络配置设置为NAT模式
一、安装前准备
1.1、官网教程
https://docs.cloudera.com/documentation/enterprise/6/6.3/topics/install_cm_cdh.html
1.2、安装环境
主机名 | 操作系统 | 角色 | IP地址 |
cdh100 | Centos 7.6 | 主节点 | 192.168.3.100 |
cdh101 | Centos 7.6 | 从节点 | 192.168.3.101 |
cdh102 | Centos 7.6 | 从节点 | 192.168.3.102 |
软件名 | 软件版本 |
CM | 6.3.1 |
CDH | 6.3.2 |
VM Workerstation Pro | 15.0.0 |
MySQL | 5.7.30 |
MySQL JDBC Driver | 5.1.27 |
JDK | 1.8.144 |
1.3、安装包准备
1.3.1、下载CM安装包
https://archive.cloudera.com/cm6/6.3.1/redhat7/yum/RPMS/x86_64/
https://archive.cloudera.com/cm6/6.3.1/redhat7/yum/RPMS/x86_64/cloudera-manager-agent-6.3.1-1466458.el7.x86_64.rpm
https://archive.cloudera.com/cm6/6.3.1/redhat7/yum/RPMS/x86_64/cloudera-manager-daemons-6.3.1-1466458.el7.x86_64.rpm
https://archive.cloudera.com/cm6/6.3.1/redhat7/yum/RPMS/x86_64/cloudera-manager-server-6.3.1-1466458.el7.x86_64.rpm
https://archive.cloudera.com/cm6/6.3.1/redhat7/yum/RPMS/x86_64/cloudera-manager-server-db-2-6.3.1-1466458.el7.x86_64.rpm
https://archive.cloudera.com/cm6/6.3.1/redhat7/yum/RPMS/x86_64/enterprise-debuginfo-6.3.1-1466458.el7.x86_64.rpm
https://archive.cloudera.com/cm6/6.3.1/redhat7/yum/RPMS/x86_64/oracle-j2sdk1.8-1.8.0+update181-1.x86_64.rpm
1.3.2、下载 CDH 安装包
https://archive.cloudera.com/cdh6/6.3.2/parcels/CDH-6.3.2-1.cdh6.3.2.p0.1605554-el7.parcel https://archive.cloudera.com/cdh6/6.3.2/parcels/CDH-6.3.2-1.cdh6.3.2.p0.1605554-el7.parcel.sha1 https://archive.cloudera.com/cdh6/6.3.2/parcels/CDH-6.3.2-1.cdh6.3.2.p0.1605554-el7.parcel.sha256 https://archive.cloudera.com/cdh6/6.3.2/parcels/manifest.json
二、环境配置
2.1、在VMWare Workstation Pro下安装Centos7.6虚拟机
2.2、配置cdh100的网络
2.2.1、将虚拟机网络配置设置为NAT模式
2.2.2、修改hostname
hostname
hostnamectl set-hostname cdh100
2.2.3、配置静态ip
ip addr
vim /etc/sysconfig/network-scripts/ifcfg-ens33
TYPE="Ethernet"
PROXY_METHOD="none"
BROWSER_ONLY="no"
BOOTPROTO="static"
DEFROUTE="yes"
IPV4_FAILURE_FATAL="no"
IPV6INIT="yes"
IPV6_AUTOCONF="yes"
IPV6_DEFROUTE="yes"
IPV6_FAILURE_FATAL="no"
IPV6_ADDR_GEN_MODE="stable-privacy"
NAME="ens33" UUID="90da2d6f-a610-487e-8b04-b0555c26150a"
DEVICE="ens33"
ONBOOT="yes"
IPADDR=192.168.3.100
NETMASK=255.255.255.0
GATEWAY=192.168.3.2
DNS1=114.114.114.114
2.2.4、验证网络通畅
systemctl restart network.service service network restart
ping www.baidu.com
2.2.5、修改hosts文件
vim /etc/hosts
192.168.3.100 cdh100
192.168.3.101 cdh101
192.168.3.102 cdh102
2.2.6、永久关闭防火墙
systemctl stop firewalld
systemctl disable firewalld
2.3、关闭 selinux
setenforce 0
sed -i "s/^SELINUX=enforcing/SELINUX=disabled/g" /etc/selinux/config
2.4、安装JDK 1.8
cd /opt
mkdir module
mkdir software
rpm -qa | grep java
sudo rpm -e 软件包
which java
cd software/ ls
tar -zxvf jdk-8u144-linux-x64.tar.gz -C /opt/module/
pwd
vim /etc/profile
#JAVA_HOME
export JAVA_HOME=/opt/module/jdk1.8.0_144
export PATH=$PATH:$JAVA_HOME/bin
source /etc/profile
java -version
注意:重启(如果java -version可以用就不用重启)
2.5、克隆虚拟机
2.6、配置cdh101、cdh102
2.7、免密码SSH
1、各节点执行ssh-keygen -t rsa命令后,连续回车生成/root/.ssh/id_rsa.pub文件;
2、各个节点执行cat /root/.ssh/id_rsa.pub命令,将内容拷贝汇总到一个文本后,将本文本内容拷贝到各节点的/root/.ssh/authorized_keys中;
3、每个节点分别ssh cdh100~cdh102,选择yes后,确保能够无密码跳转到目的节点。
2.8、部署 NTP 服务器进行时间同步
yum install -y ntp
systemctl start ntpd
systemctl enable ntpd
systemctl status ntpd
cdh100配置:
vim /etc/ntp.conf
# 日志配置
logfile /var/log/ntpd.log
# 允许网段内客户端连接此服务器同步时间,但是拒绝让他们修改服务器上的时间
restrict 192.168.3.0 mask 192.168.3.255 nomodify notrap
# 配置时间服务器(阿里云)
https://www.ntppool.org/zone/asia
server ntp1.aliyun.com
server ntp2.aliyun.com
server ntp3.aliyun.com
# 在 /ntp.conf 中定义的 server 都不可用时,将使用 local 时间作为 ntp 服务提供给 ntp 客户端。
# 建议配置,否则 ntp 服务器无法与公网 ntp 服务器同步时,其客户端也会无法同步
server 127.0.0.1
fudge 127.0.0.1 stratum 10
cdh101、cdh102配置:
vim /etc/ntp.conf
# 日志配置
logfile /var/log/ntpd.log
# 配置时间服务器
server 192.168.3.100
2.9、MySQL 5.7安装
rpm -qa | grep -i mysql
rpm -qa | grep -i mariadb
注意:在新版本的CentOS7中,默认的数据库已更新为了Mariadb,而非 MySQL,所以执行 yum install mysql 命令只是更新Mariadb数据库,并不会安装 MySQL
2、卸载已安装的 Mariadb 数据库(如果有安装时才进行卸载)
rpm -e postfix-2:2.10.1-7.el7.x86_64
rpm -e mariadb-libs-5.5.60-1.el7_5.x86_64
//rpm -e [安装包名]
3、再次查看已安装的 Mariadb 数据库版本,确认是否卸载完成
rpm -qa | grep -i mysql
rpm -qa | grep -i mariadb
4、安装libaio、perl、net-tools库,要不就会报错
yum -y install libaio perl net-tools
mkdir -p /opt/module/MySQL-5.7.30
tar -xvf mysql-5.7.30-1.el7.x86_64.rpm-bundle.tar -C /opt/module/MySQL-5.7.30
cd /opt/module/MySQL-5.7.30
开始安装,-ivh 其中i表示安装,v表示显示安装过程,h表示显示进度
rpm -ivh mysql-community-common-5.7.30-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-5.7.30-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-5.7.30-1.el7.x86_64.rpm
rpm -ivh mysql-community-server-5.7.30-1.el7.x86_64.rpm
6、启动MySQL
systemctl start mysqld
systemctl enable mysqld
systemctl status mysqld
systemctl stop mysqld
systemctl restart mysqld
systemctl disable mysqld
grep "password" /var/log/mysqld.log
mysql -uroot -p
//Enter password: (输入查询到的临时密码)
设置密码校验策略(0 or LOW),要不密码太LOW不让你过
set global validate_password_policy=0;
set global validate_password_length=6;
set password = password("123456");
quit
配置只要是root用户+密码,在任何主机上都能登录MySQL数据库
mysql -uroot -p
show databases;
use mysql;
show tables;
desc user;
update user set host='%' where host='localhost';
delete from user where Host='hadoop100';
delete from user where Host='127.0.0.1';
delete from user where Host='::1';
flush privileges;
quit;
2.10、配置MySQL JDBC Driver
注意:默认位置 /usr/share/java/ ,默认驱动名 mysql-connector-java.jar
mkdir -p /usr/share/java/
cd /usr/share/java/
3、 将安装包mysql-connector-java-5.1.27-bin.jar上传到本目录下
cp mysql-connector-java-5.1.27-bin.jar /usr/share/java/mysql-connector-java.jar
三、CM安装
3.1、配置本地CM仓库
mkdir -p /var/www/html/cloudera-repos/cm6/
2、上传下载好的 CM 安装包放入 /var/www/html/cloudera-repos/cm6/ 目录
yum -y install httpd createrepo
systemctl start httpd && systemctl enable httpd
cd /var/www/html/cloudera-repos/cm6/ && createrepo .
http://192.168.3.100/cloudera-repos/cm6/
3.2、配置本地CDH仓库
mkdir -p /var/www/html/cloudera-repos/cdh6/
2、上传下载好的 CDH 安装包放入 /var/www/html/cloudera-repos/cdh6/ 目录
cd /var/www/html/cloudera-repos/cdh6/ && createrepo .
http://192.168.3.100/cloudera-repos/cdh6/
3.3、构建yum源
vim /etc/yum.repos.d/cloudera-repo.repo
[cloudera-repo]
name=cloudera-repo
baseurl=http://192.168.3.100/cloudera-repos/cm6/
enabled=1
gpgcheck=0
3.4、在MySQL创建数据库
Service | Database | User |
Cloudera Manager Server | scm | scm |
Activity Monitor | amon | amon |
Reports Manager | rman | rman |
Hue | hue | hue |
Hive Metastore Server | metastore | hive |
Sentry Server | sentry | sentry |
Cloudera Navigator Audit Server | nav | nav |
Cloudera Navigator Metadata Server | navms | navms |
Oozie | oozie | oozie |
mysql -uroot -p
CREATE DATABASE scm DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
GRANT ALL ON scm.* TO 'scm'@'%' IDENTIFIED BY 'Scm@#123';
CREATE DATABASE amon DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
GRANT ALL ON amon.* TO 'amon'@'%' IDENTIFIED BY 'Amon@#123';
CREATE DATABASE rman DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
GRANT ALL ON rman.* TO 'rman'@'%' IDENTIFIED BY 'Rman@#123';
CREATE DATABASE hue DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
GRANT ALL ON hue.* TO 'hue'@'%' IDENTIFIED BY 'Hue@#123';
CREATE DATABASE metastore DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
GRANT ALL ON metastore.* TO 'metastore'@'%' IDENTIFIED BY 'Metastore@#123';
CREATE DATABASE sentry DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
GRANT ALL ON sentry.* TO 'sentry'@'%' IDENTIFIED BY 'Sentry@#123';
CREATE DATABASE nav DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
GRANT ALL ON nav.* TO 'nav'@'%' IDENTIFIED BY 'Nav@#123';
CREATE DATABASE navms DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
GRANT ALL ON navms.* TO 'navms'@'%' IDENTIFIED BY 'Navms@#123';
CREATE DATABASE oozie DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
GRANT ALL ON oozie.* TO 'oozie'@'%' IDENTIFIED BY 'Oozie@#123';
flush privileges;
drop database scm;
drop database amon;
drop database rman;
drop database hue;
drop database metastore;
drop database sentry;
drop database nav;
drop database navms;
drop database oozie;
flush privileges;
3.5、安装 CM Server 和 CM Agent
yum install cloudera-manager-daemons cloudera-manager-agent cloudera-manager-server
错误:软件包:MySQL-python-1.2.5-1.el7.x86_64 (base)
需要:libmysqlclient.so.18()(64bit)
错误:软件包:2:postfix-2.10.1-9.el7.x86_64 (base)
需要:libmysqlclient.so.18(libmysqlclient_18)(64bit)
错误:软件包:2:postfix-2.10.1-9.el7.x86_64 (base)
需要:libmysqlclient.so.18()(64bit)
错误:软件包:MySQL-python-1.2.5-1.el7.x86_64 (base)
需要:libmysqlclient.so.18(libmysqlclient_18)(64bit)
您可以尝试添加 --skip-broken 选项来解决该问题
您可以尝试执行:rpm -Va --nofiles --nodigest
原因是在安装过程中,我们会卸载centos自带的mariadb安装自己的MySQL,这样就会报上面这个错
解决办法是下载Percona-XtraDB-Cluster-shared-55-5.5.37-25.10.756.el6.x86_64.rpm 包并安装就可以了
rpm -ivh Percona-XtraDB-Cluster-shared-55-5.5.37-25.10.756.el6.x86_64.rpm
yum install cloudera-manager-daemons cloudera-manager-agent
3.6、建立CM的数据库
/opt/cloudera/cm/schema/scm_prepare_database.sh mysql scm scm
[main] DbCommandExecutor INFO Unable to find JDBC driver for database type: MySQL
[main] DbCommandExecutor ERROR JDBC Driver com.mysql.jdbc.Driver not found.
[main] DbCommandExecutor ERROR Exiting with exit code 3
将mysql-connector-java-5.1.27-bin.jar改名为mysql-java-connector.jar放到指定目录/usr/share/java/下
或者手动将驱动包复制到Executing: /usr/java/jdk1.8.0_181-cloudera/bin/java -cp :命令后每个文件夹中,如/opt/cloudera/cm/lib目录
3.7、启动 CM Server
systemctl start cloudera-scm-server
systemctl status cloudera-scm-server
journalctl -xe
/var/log/cloudera-scm-server
3.8、访问CM
启动了CM Server后,需要等待几分钟,后可以浏览器访问:
http://192.168.3.100:7180
四、CDH安装
4.1、用户登录
4.2、选择版本
2、接受最终用户许可条款和条件
3、选择免费版本
4.3、群集安装
2、群集名称
3、扫描主机,输入主机名称点击搜索
4、选择存储库
http://192.168.3.100/cloudera-repos/cm6/
远程 Parcel 存储库 URL :
http://192.168.3.100/cloudera-repos/cdh6/
保存更改
5、JDK 安装选项,跳过不需要勾选
6、提供 SSH 登录凭据
7、Install Agents ,自动安装
8、Install Parcels,自动安装
9、Inspect Cluster检查
先点击 Inspect Network Performance 再点击 Inspect Hosts
警告,点击 显示检查器结果
1、已启用透明大页面压缩,可能会导致重大性能问题。请运行“echo never > /sys/kernel/mm/transparent_hugepage/defrag”和“echo never > /sys/kernel/mm/transparent_hugepage/enabled”以禁用此设置,然后将同一命令添加到 /etc/rc.local 等初始化脚本中,以便在系统重启时予以设置
echo never>/sys/kernel/mm/transparent_hugepage/defrag
echo never>/sys/kernel/mm/transparent_hugepage/enabled
2、Cloudera 建议将 /proc/sys/vm/swappiness 设置为最大值 10。当前设置为 30。使用 sysctl 命令在运行时更改该设置并编辑 /etc/sysctl.conf,以在重启后保存该设置。您可以继续进行安装,但 Cloudera Manager 可能会报告您的主机由于交换而运行状况不良。
echo 'vm.swappiness=10'>> /etc/sysctl.conf sysctl -p
点击重新运行
4.4、群集设置
2、自定义角色分配
3、数据库设置
Databases for Cloudera Software 参考如下:
报错:
JDBC driver cannot be found. Unable to find the JDBC database jar on host : cdh102.
Unexpected error. Unable to verify database connection.
进入到cdh100,将MySQL驱动分别复制到cdh101和cdh102:
scp mysql-connector-java-5.1.27-bin.jar root@cdh101:/opt/software/
scp mysql-connector-java-5.1.27-bin.jar root@cdh102:/opt/software/
进入到cdh101、cdh102,配置MySQL安装包:
cp /opt/software/mysql-connector-java-5.1.27-bin.jar /opt/cloudera/cm/lib
cp /opt/software/mysql-connector-java-5.1.27-bin.jar /usr/share/java/mysql-connector-java.jar
点击测试连接
4、审核更改,默认设置
首次运行hdfs报错解决:(会同时报错Hive和Hue的错误,但我把HDFS这个错处理成功后就没有再报)
是由于之前初始化 namenode 在 /dfs/nn 留下了残留数据(失效数据),从而影响再次初始化
解决方法1:清空残留数据后,重新初始化
rm -rf /dfs/nn
rm -rf /dfs/dn
解决方法2:手动初始化NameNode
hdfs namenode -format
sudo -u hdfs hdfs namenode -format
之后再次报此错,但重新运行后就没有报错了
6、汇总
开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!
更多推荐
所有评论(0)