一:CM架构
二:环境准备
1:服务器准备
准备三台服务器,配置好对应主机的网络IP、主机名称、关闭防火墙、
122、121、120
#所有节点都需要安装
#会直接修改hostname里面的名字,并且不需要重启
hostnamectl set-hostname cdh001
vim /etc/hosts
192.168.33.122 cdh001
192.168.33.121 cdh002
192.168.33.120 cdh003
#重启网卡,立即生效
sudo /etc/init.d/network restart
#安装一些依赖以及删除部分依赖
yum -y install bind-utils
yum -y install chkconfig
yum -y install cyrus-sasl-gssapi
yum -y install cyrus-sasl-plain
yum -y install fuse
yum -y install fuse-libs
yum -y install gcc
yum -y install libxslt
yum -y install mod_ssl
yum -y install MySQL-python
yum -y install openssl
yum -y install openssl-devel
yum -y install perl
yum -y install portmap
yum -y install postgresql-server
yum -y install psmisc
yum -y install python-devel
yum -y install python-psycopg2
yum -y install python-setuptools
yum -y install sed
yum -y install sqlite
yum -y install swig
yum -y install zlib
yum -y install httpd
yum -y install ntp
yum -y install net-tools
yum -y install vim
yum -y install lrzsz
yum -y install iptables-services
yum install -y taselect
内网配置实现时间同步
检查时间是否为北京时间,如已经操作第一步时间同步后,此步可省略
#检查ntp主机时间是否为当前北京时间
date
#如不是:
date -s "2020-05-15 16:11:00"
#修改系统时间date后加clock -w 理由-->为了保险,需要使用 clock -w 把当前系统时间写入到CMOS中
clock -w
1.1确认是否存在chrony
每台都需要安装,我这边用SecureCRT通过命令窗口,同时发送控制多个服务器
rpm -qa |grep chrony
---
chrony-3.4-1.el7.x86_64
1.2主服务器配置(cdh001)
备份文件,并且修改文件
#备份
cp /etc/chrony.conf /etc/chrony.conf_bak
#修改
vi /etc/chrony.conf
在server部分添加一下部分,并注释掉server 0 ~ n,新增内容:
#新增
server 127.0.0.1 iburst
#允许那些网段
allow all
# allow 192.168.0.0/16
local stratum 10
1.3从服务器配置(cdh002\cdh003)
在server部分添加一下部分,并注释掉server 0 ~ n,新增内容:
#新增
server cdh001 iburst #写服务端IP地址
1.4重启服务(所有节点)
systemctl restart chronyd
#这个时候只需要在服务端设置正确的时间,客户端就会同步服务端的时间。
1.5开机自启(所有节点)
#查询状态
systemctl status chronyd
#设置开机启动
systemctl enable chronyd
#查询ntp是否设置开机自启
systemctl is-enabled chronyd
1.6常用命令
立即手工同步
chronyc -a makestep
查看时间同步源
chronyc sources -v
查看时间同步源状态:
chronyc sourcestats -v
PS:由于端口冲突,chrony和ntpd不能同时启用
1.6.1(所有节点)
#关闭防火墙(生产暂不关闭)
systemctl stop firewalld
systemctl disable firewalld
#关闭selinux
vim /etc/selinux/config
SELINUX=disabled
2:ssh免密登录(cdh001节点)
#配置cdh001对cdh001、cdh002、cdh003免密登录
ssh-keygen -t rsa
ssh-copy-id cdh001
ssh-copy-id cdh002
ssh-copy-id cdh003
3:安装jdk(所有节点)
mkdir -p /usr/java
tar -zxvf jdk-8u144-linux-x64.tar.gz -C /usr/java/
vi /etc/profile
export JAVA_HOME=/usr/java/jdk1.8.0_144
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH
source /etc/profile
jps
#将jdk包scp到 剩余节点,分别进行安装jdk
scp jdk-8u144-linux-x64.tar.gz cdh002:/root
scp jdk-8u144-linux-x64.tar.gz cdh003:/root
4:安装mysql_rpm方式(cdh001)
4.1:#卸载maridb服务器(yum卸载)
yum -y remove mariadb-libs
4.1检查环境
#检查已安装的mariadb
rpm -qa | grep mariadb
mariadb-connector-c-3.0.6-6.ky10.aarch64
mariadb-common-10.3.9-8.ky10.aarch64
mariadb-10.3.9-8.ky10.aarch64
#如果上面命令有结果,要逐个删除对应的rpm,否则下面安装可能会不能成功
rpm -e --nodeps mariadb-10.3.9-8.ky10.aarch64
rpm -e --nodeps mariadb-common-10.3.9-8.ky10.aarch64
rpm -e --nodeps mariadb-connector-c-3.0.6-6.ky10.aarch64
4.2: 解压mysql
tar -xvf mysql-5.7.26-1.el7.x86_64.rpm-bundle.tar
4.3:顺序安装
rpm -ivh mysql-community-common-5.7.26-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-5.7.26-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-5.7.26-1.el7.x86_64.rpm
rpm -ivh mysql-community-devel-5.7.26-1.el7.x86_64.rpm
rpm -ivh mysql-community-embedded-5.7.26-1.el7.x86_64.rpm
rpm -ivh mysql-community-embedded-devel-5.7.26-1.el7.x86_64.rpm
rpm -ivh mysql-community-embedded-compat-5.7.26-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-compat-5.7.26-1.el7.x86_64.rpm
rpm -ivh mysql-community-test-5.7.26-1.el7.x86_64.rpm
rpm -ivh mysql-community-server-5.7.26-1.el7.x86_64.rpm
4.4:修改配置文件
vi /etc/my.cnf
[mysqld]
port=3306 #设置端口
character-set-server=utf8 #设置编码格式
max_connections=1000 #设置最大连接数为1000
max_allowed_packet=67108864 #单次执行sql语句的最大的byte
datadir=/var/lib/mysql #(可能已有)datadir为mysql的 data 包存放路径
lower_case_table_names=1 # 设置表名大小写不敏感
4.5:启动数据库
service mysqld start #开启
systemctl enable mysqld #开机启动
service mysqld stop #停止
service mysqld restart #重启
service mysqld status #查看mysql状态
4.6:创建数据库
查看数据密码
#初始化root密码(mysql5.7以后自动生成随机密码)
grep "password" /var/log/mysqld.log #查看临时密码
:使用上面的临时密码登录MySQL
mysql -uroot -p # 回车键入临时密码
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'eeqRBF5Lf2(X'; #修改为新密码
mysql> GRANT ALL PRIVILEGES ON *.* TO root@localhost IDENTIFIED BY 'eeqRBF5Lf2(X' WITH GRANT OPTION;
mysql> GRANT ALL PRIVILEGES ON *.* TO root@"%" IDENTIFIED BY 'eeqRBF5Lf2(X' WITH GRANT OPTION;
mysql> flush privileges; # 刷新权限
mysql> quit # 退出数据库
service mysqld restart #重启数据库
#创建cm需要用到的几个库
create database cmf default character set = 'utf8';
create database amon default character set = 'utf8';
create database hue default character set = 'utf8';
create database oozie default character set = 'utf8';
create database lyz default character set = 'utf8';
create database hive default character set = 'utf8';
create database sentry default character set = 'utf8';
4.7 mysql 链接包所有节点都要做
mkdir -p /usr/share/java
mv mysql-connector-java.jar /usr/share/java/
scp -r /usr/share/java/mysql-connector-java.jar cdh002:/usr/share/java/
scp -r /usr/share/java/mysql-connector-java.jar cdh003:/usr/share/java/
5:安装cm组件
所有节点都需要安装agent、daemons。cdh001上安装server
#将agent、daemons scp 到其它节点
scp -r cloudera-manager-agent-6.2.0-968826.el7.x86_64.rpm cloudera-manager-daemons-6.2.0-968826.el7.x86_64.rpm cdh002:/root
scp -r cloudera-manager-agent-6.2.0-968826.el7.x86_64.rpm cloudera-manager-daemons-6.2.0-968826.el7.x86_64.rpm cdh003:/root
#所有节点安装agent、daemons
yum -y localinstall cloudera-manager-daemons-6.2.0-968826.el7.x86_64.rpm
yum -y localinstall cloudera-manager-agent-6.2.0-968826.el7.x86_64.rpm
#cdh001上安装server
yum -y localinstall cloudera-manager-server-6.2.0-968826.el7.x86_64.rpm
#主节点cdh001上执行
mv CDH-6.2.0-1.cdh6.2.0.p0.967373-el7.parcel* /opt/cloudera/parcel-repo/
mv PHOENIX-* /opt/cloudera/parcel-repo/
mv manifest.json /opt/cloudera/parcel-repo/
mv /opt/cloudera/parcel-repo/PHOENIX-1.0.jar /opt/cloudera/csd/
cd /opt/cloudera/parcel-repo/
#检验parcel是否完整
[root@cdh001 parcel-repo]# sha1sum CDH-6.2.0-1.cdh6.2.0.p0.967373-el7.parcel
e9c8328d8c370517c958111a3db1a085ebace237 CDH-6.2.0-1.cdh6.2.0.p0.967373-el7.parcel
[root@cdh001 parcel-repo]# cat CDH-6.2.0-1.cdh6.2.0.p0.967373-el7.parcel.sha
e9c8328d8c370517c958111a3db1a085ebace237
[root@cdh001 parcel-repo]# sha1sum PHOENIX-5.0.0-cdh6.2.0.p0.1308267-el7.parcel
d3564f5271969a72cb000caaad336f52efc6ea4a PHOENIX-5.0.0-cdh6.2.0.p0.1308267-el7.parcel
[root@cdh001 parcel-repo]# cat PHOENIX-5.0.0-cdh6.2.0.p0.1308267-el7.parcel.sha
d3564f5271969a72cb000caaad336f52efc6ea4a
到此cm服务安装完毕
6:修改Agent和server配置文件
#修改server配置文件cdh001
[root@cdh001 parcel-repo]# vi /etc/cloudera-scm-server/db.properties
修改Agent节点的配置文件 (所有节点都要做)
[root@cdh001 parcel-repo]# vi /etc/cloudera-scm-agent/config.ini
7:启动CM,开始安装CDH集群
#在cdh001节点启动server
systemctl start cloudera-scm-server
tail -200f /var/log/cloudera-scm-server/cloudera-scm-server.log
#在全部节点启动agent
systemctl start cloudera-scm-agent
#在cdh001节点停止server
systemctl stop cloudera-scm-server
#在全部节点停止agent
systemctl stop cloudera-scm-agent
http://cdh001:7180/cmf/login
默认账号密码admin/admin
(admin /admin)
#如果以上步骤都正确的话 会生成这两个.torrent文件
#开始安装,需要一定的时间 耐心等待即可
7.1 安装zookeeper
7.2:安装hdfs
#关闭hdfs的ec ec是hadoop3.0的新特性
关闭 检查HDFS权限的原因(详情参照https://blog.csdn.net/Yellow_python/article/details/125007739)
#开启hdfs高可用(因只有三台服务器,不用配置HA)
#警告可以忽略
7.3: 添加yarn
#开启ha(因服务器资源问题,暂不开启)
7.4: 安装spark
三:部署CDH进阶教程 (参考)
1:修改YARN配置参数
#在yarn配置项中搜索“yarn.nodemanager.resource.memory-mb”,修改为服务器的一半(测试环境),生产环境例如128G 调整为100G左右
yarn.scheduler.maximum-allocation-mb
重启yarn服务即可
版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
原文链接:https://blog.csdn.net/qq_24141759/article/details/136203104