官方要求:https://docs.cloudera.com/documentation/enterprise/6/release-notes/topics/rg_requirements_supported_versions.html
Linux发行版本:CentOS 7.6
公网IP | 内网IP | Host | CPU | Memory | Disk |
---|---|---|---|---|---|
106.12.158.185 | 192.168.16.15 | hadoop01.baicdt.com | 2cores | 16G | 100G |
180.76.51.226 | 192.168.16.17 | hadoop02.baicdt.com | 2cores | 8G | 100G |
180.76.140.152 | 192.168.16.18 | hadoop03.baicdt.com | 2cores | 8G | 100G |
CM6.3.1
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-agent-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
CDH6.3.2 Parcel
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-el6.parcel.sha256
https://archive.cloudera.com/cdh6/6.3.2/parcels/manifest.json
MySQL JDBC jar
http://central.maven.org/maven2/mysql/mysql-connector-java/5.1.46/mysql-connector-java-5.1.46.jar
ext-2.2.zip解决oozie web UI报错问题
http://archive.cloudera.com/gplextras/misc/ext-2.2.zip
以上软件已打包到网盘中,可自取:
链接:https://pan.baidu.com/s/1Fiz4BglGV8r6kUIp0yTIPQ
提取码:ti2k
下载后上传这些文件到hadoop01主节点的/root目录
所有节点先安装一些实用的小工具
#1.安装vim编辑器
yum install -y vim
#2.安装lrzsz文件传输工具
yum -y install lrzsz
#3.安装wget文件下载工具
yum -y install wget
#4.安装netstat,查看端口监听状况: netstat -ntlp | grep 端口号
yum -y install net-tools
#5.下载unzip解压工具,解压命令: uzip 压缩包.zip -d 解压目录
yum install -y unzip zip
所有节点都要执行
#1.查看防火墙状态
firewall-cmd --state
#2.临时关闭防火墙
systemctl stop firewalld
#3.永久关闭防火墙
systemctl disable firewalld
#4.临时开启防火墙
#systemctl start firewalld
#5.开机启用防火墙
#systemctl enable firewalld
#临时关闭selinux
setenforce 0
#永久关闭selinux
vim /etc/selinux/config
#将SELINUX=enforcing改为
SELINUX=disabled
#查看selinux状态
getenforce 0
所有节点都要执行,修改后需重启节点
vim /etc/hostname
#分别改名为
hadoop01.baicdt.com
hadoop02.baicdt.com
hadoop03.baicdt.com
vim /etc/hosts
所有节点都要配置
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.16.15 hadoop01.baicdt.com hadoop01
192.168.16.17 hadoop02.baicdt.com hadoop02
192.168.16.18 hadoop03.baicdt.com hadoop03
第一步:三台节点生成公钥与私钥
在三台机器执行以下命令,生成公钥与私钥
#执行下面的命令之后,要连续按三个回车
cd ~
ssh-keygen -t rsa
第二步:拷贝公钥到同一台节点
三台机器将拷贝公钥到第一台服务器,三台服务器执行命令:
ssh-copy-id hadoop01
第三步:复制第一台服务器的认证到其他服务器
将第一台机器的公钥拷贝到其他机器上,在第一台机器上面执行以下命令
scp /root/.ssh/authorized_keys hadoop02:/root/.ssh
scp /root/.ssh/authorized_keys hadoop03:/root/.ssh
#设置时区为Asia/Shanghai
timedatectl set-timezone Asia/Shanghai
#查看是否安装了ntpd的服务
rpm -qa | grep ntpd
#如果没有安装,可以进行在线安装
yum -y install ntp
#启动ntpd的服务
service ntpd start
#设置ntpd的服务开机启动
systemctl enable ntpd.service
#查看ntpd的服务是否启动
service ntpd status
#设置定时任务
#与阿里云服务器进行时钟同步
crontab -e
#设置的内容如下
*/1 * * * * /usr/sbin/ntpdate -u ntp4.aliyun.com;
设置成功后会一直出现You have new mail in /var/spool/mail/root
的邮件提示,可使用下面命令关闭邮件提示
echo "unset MAILCHECK" >> /etc/profile
source /etc/profile
1.使用以下命令查看当前安装mysql情况,查找以前是否装有mysql
rpm -qa|grep -i mysql
2.如果查询到已安装mysql需停止mysql服务并删除之前安装的mysql
#停止mysql服务
systemctl stop mysqld
#删除软件命令
rpm -e –nodeps 包名
#如果上面命令提示依赖包错误,则使用以下命令尝试:
rpm -ev 包名 --nodeps
#如果还报错:error: %preun(xxxxxx) scriptlet failed, exit status 1,则用以下命令尝试:
rpm -e --noscripts 包名
#最终再使用rpm -qa|grep -i mysql命令,查询不到结果则证明mysql已卸载
3.查找之前老版本mysql的目录、并且删除老版本mysql的文件和库
#查找卸载残留的mysql的目录
find / -name mysql #然后使用 rm -rf 将查询到的目录全部删除
#删除老版本mysql的配置文件
rm -rf /etc/my.cnf
rm -rf /etc/my.cnf.d
使用阿里的镜像源安装MySQL时下载速度比较快
#1.备份原镜像文件,便于后期恢复
cd /etc/yum.repos.d/
mv CentOS-Base.repo CentOS-Base.repo.backup
#2.下载阿里云的CentOS-Base.repo 到/etc/yum.repos.d/
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
#3. 清除缓存
yum clean all
#4. 生成缓存
yum makecache
mkdir -p /baicdt/softwares/mysql_rpm
cd /baicdt/softwares/mysql_rpm
#1.下载rpm包
wget https://repo.mysql.com//mysql80-community-release-el7-3.noarch.rpm
#2.安装myaql源
yum localinstall -y mysql80-community-release-el7-3.noarch.rpm
#3.检查MySQL源是否安装成功,此时查到的安装包的版本都是mysql5.8版本的
yum repolist enabled | grep "mysql.*-community.*"
#4.修改yum源配置文件,获取自己想要安装的mysql5.7版本
vim /etc/yum.repos.d/mysql-community.repo
#需要编辑的内容参考下图
#5.检查MySQL源是否选择的是5.7版本,此时查到的安装包的版本都是mysql5.7版本的
yum repolist enabled | grep "mysql.*-community.*"
#下载速度较慢,需等待一段时间
yum -y install mysql-community-server
#1.临时启动mysql服务
systemctl start mysqld
#2.开机启动mysql服务
systemctl enable mysqld
#3.查看MySQL的启动状态
systemctl status mysqld
#4.查看mysql进程是否正常开启
ps -le | grep mysqld
mysql安装完成之后,在/var/log/mysqld.log
文件中给root用户生成了一个默认密码。通过以下命令找到密码:
grep 'temporary password' /var/log/mysqld.log
-- 登录MySQL,使用刚才找到的密码
mysql -u root -p
-- 修改root用户密码(二选一)
ALTER USER 'root'@'localhost' IDENTIFIED BY 'Wsygzgr_2020';
vim /etc/my.cnf
在配置文件中添加下面的内容:
#因为服务器是测试环境,为了方便记mysql密码,关闭了密码策略。如果是生产环境,则不建议修改密码策略
validate_password=off
character_set_server=utf8
init_connect='SET NAMES utf8'
重新启动mysql服务使配置生效:
systemctl restart mysqld
#重新设置mysql密码为123456
mysql -u root -pWsygzgr_2020
修改root用户密码
ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';
MySQL默认配置文件路径:
配置文件: /etc/my.cnf
日志文件: /var/log//var/log/mysqld.log
服务启动脚本: /usr/lib/systemd/system/mysqld.service
socket文件: /var/run/mysqld/mysqld.pid
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;
FLUSH PRIVILEGES;
以下内容了解
-- 指定特定的IP,开启root用户远程连接
GRANT ALL PRIVILEGES ON *.* TO 'root'@'指定的IP' IDENTIFIED BY 'root用户的密码' WITH GRANT OPTION;
-- 一般为了安全起见,会创建专用的远程访问用户
GRANT ALL PRIVILEGES ON *.* TO 'dadeity'@'%' IDENTIFIED BY 'daDeity@163.com' WITH GRANT OPTION;
CREATE DATABASE scm DEFAULT CHARACTER SET utf8;
CREATE USER 'scm'@'%'IDENTIFIED BY 'scm';
GRANT ALL PRIVILEGES ON scm.* TO 'scm'@'%' IDENTIFIED BY 'scm';
GRANT ALL PRIVILEGES ON *.* TO 'scm'@'%' IDENTIFIED BY 'scm' WITH GRANT OPTION;
CREATE DATABASE amon DEFAULT CHARACTER SET utf8;
CREATE USER 'amon'@'%'IDENTIFIED BY 'amon';
GRANT ALL PRIVILEGES ON amon.* TO 'amon'@'%' IDENTIFIED BY 'amon';
GRANT ALL PRIVILEGES ON *.* TO 'amon'@'%' IDENTIFIED BY 'amon' WITH GRANT OPTION;
CREATE DATABASE hive DEFAULT CHARACTER SET utf8;
CREATE USER 'hive'@'%'IDENTIFIED BY 'hive';
GRANT ALL PRIVILEGES ON hive.* TO 'hive'@'%' IDENTIFIED BY 'hive';
GRANT ALL PRIVILEGES ON *.* TO 'hive'@'%' IDENTIFIED BY 'hive' WITH GRANT OPTION;
CREATE DATABASE hue DEFAULT CHARACTER SET utf8;
CREATE USER 'hue'@'%'IDENTIFIED BY 'hue';
GRANT ALL PRIVILEGES ON hue.* TO 'hue'@'%' IDENTIFIED BY 'hue';
GRANT ALL PRIVILEGES ON *.* TO 'hue'@'%' IDENTIFIED BY 'hue' WITH GRANT OPTION;
CREATE DATABASE oozie DEFAULT CHARACTER SET utf8;
CREATE USER 'oozie'@'%'IDENTIFIED BY 'oozie';
GRANT ALL PRIVILEGES ON oozie.* TO 'oozie'@'%' IDENTIFIED BY 'oozie';
GRANT ALL PRIVILEGES ON *.* TO 'oozie'@'%' IDENTIFIED BY 'oozie' WITH GRANT OPTION;
-- 刷新mysql的权限列表
FLUSH PRIVILEGES;
确保已经把cm6.3.1、cdh6.3.2、mysql-connector-java-5.1.46.jar和ext-2.2.zip已经上传到了hadoop01服务器的/root目录下
yum install -y createrepo
cd /root/cm6.3.1/
#注意:下面的命令最后带一个点,最后会生成一个repodata目录
createrepo .
配置Web服务器
将cdh6.3.2目录和cm6.3.1目录 移动到/var/www/html目录下, 使得用户可以通过HTTP访问这些rpm包。
#在hadoop01服务器下操作
cd /root/cdh6.3.2
mv CDH-6.3.2-1.cdh6.3.2.p0.1605554-el6.parcel.sha256 CDH-6.3.2-1.cdh6.3.2.p0.1605554-el6.parcel.sha
cd /root
mkdir -p /var/www/html
mv cdh6.3.2 /var/www/html
mv cm6.3.1 /var/www/html
#安装httpd服务
yum install -y httpd
#启动httpd服务
systemctl start httpd
#设置httpd服务开机启动
systemctl enable httpd
#查看httpd服务是否启动
ps -ef | grep httpd
vim /etc/yum.repos.d/os.repo
#以下为文件内容
[osrepo]
name=os_repo
baseurl=http://hadoop01.baicdt.com/cm6.3.1
enabled=true
gpgcheck=false
#将os.repo文件copy到另外两台服务器上
scp /etc/yum.repos.d/os.repo hadoop02:/etc/yum.repos.d/os.repo
scp /etc/yum.repos.d/os.repo hadoop03:/etc/yum.repos.d/os.repo
#所有服务器都执行
yum repolist
#hadoop01主节点执行
vim /etc/httpd/conf/httpd.conf
#在中修改以下内容
#把第284行的 AddType application/x-gzip .gz .tgz 修改为:
AddType application/x-gzip .gz .tgz .parcel
#重启httpd服务
systemctl restart httpd
经过以上配置,下面网址可正常访问
http://hadoop01.baicdt.com/cdh6.3.2/
http://hadoop01.baicdt.com/cm6.3.1/
第一步: 安装官方提供的JDK
yum install -y oracle-j2sdk1.8-1.8.0+update181-1.x86_64
第二步: 配置jdk的环境变量
vim /etc/profile
export JAVA_HOME=/usr/java/jdk1.8.0_181-cloudera
export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=:$JAVA_HOME/bin:$PATH
source /etc/profile
第三步: 添加mysql驱动包
mkdir -p /usr/share/java
mv /root/mysql-connector-java-5.1.46.jar /usr/share/java/
cd /usr/share/java/
mv mysql-connector-java-5.1.46.jar mysql-connector-java.jar
注意:以上三步在所有服务器都要配置
#安装python27,解决安装过程中Hue无法访问数据库问题
yum install -y centos-release-scl
yum install -y python27 python27-devel
yum -y install cloudera-manager-daemons
yum -y install cloudera-manager-agent
#仅hadoop01服务器安装cloudera-manager-server
yum -y install cloudera-manager-server
vim /etc/cloudera-scm-agent/config.ini
#修改文件中server_host的属性值
server_host=hadoop01.baicdt.com
#hadoop01主节点执行
/opt/cloudera/cm/schema/scm_prepare_database.sh mysql scm scm scm
结果为:All done, your SCM database is configured correctly!
,表示初始化成功。
#hadoop01主节点启动CM server
systemctl start cloudera-scm-server
#启动日志目录为/var/log/cloudera-scm-server/
cd /var/log/cloudera-scm-server/
tail cloudera-scm-server.log
#所有节点启动CM agent
systemctl start cloudera-scm-agent
web页面: http://hadoop01:7180/
默认登录账号: admin
默认登录密码: admin