Cloudera Manager 是一个用于管理 CDH 集群的端到端应用程序。Cloudera Manager 设定了标准 通过提供对 CDH 集群每个部分的精细可见性和控制,实现企业部署,使运营商能够提高性能、提高服务质量、增加 合规性并降低管理成本。借助 Cloudera Manager,您可以轻松部署和集中操作完整的 CDH 堆栈和其他托管服务。该应用程序自动执行 安装过程,将部署时间从几周缩短到几分钟;为您提供集群范围内正在运行的主机和服务的实时视图;提供单个中央控制台来制定配置 集群中的更改;并集成了全套报告和诊断工具,可帮助您优化性能和利用率。本入门书介绍了基本概念、结构、 和Cloudera Manager的功能。
Cloudera Manager Server 可与其他几个组件配合使用:
Cloudera Manager Overview | 6.2.x:https://docs.cloudera.com/documentation/enterprise/6/6.2/topics/cm_intro_primer.html
Cloudera Installation Guide | 6.2.x:https://docs.cloudera.com/documentation/enterprise/6/6.2/topics/installation.html
CDH 6.2.1 Packaging:https://docs.cloudera.com/documentation/enterprise/6/release-notes/topics/rg_cdh_62_packaging.html#cdh_621_packaging
CentOS基础操作命令:https://blog.csdn.net/u011424614/article/details/94555916
CentOS7安装部署Doris:https://blog.csdn.net/u011424614/article/details/132419397
机器名 | IP | 角色 | 硬件配置 |
---|---|---|---|
cdh001 | 192.168.249.121 | 主节点 | 4核 16G |
cdh002 | 192.168.249.122 | 从节点 | 4核 8G |
cdh003 | 192.168.249.123 | 从节点 | 4核 8G |
链接: https://pan.baidu.com/s/1ToePLghssMMxFnk-AiEkhQ
提取码: xvgx
mkdir /root/download
执行机器:所有节点
#-- cdh001
hostnamectl set-hostname cdh001 --static
hostnamectl set-hostname cdh001 --transient
#-- cdh002
hostnamectl set-hostname cdh002 --static
hostnamectl set-hostname cdh002 --transient
#-- cdh003
hostnamectl set-hostname cdh003 --static
hostnamectl set-hostname cdh003 --transient
执行机器:所有节点
systemctl stop firewalld
systemctl disable firewalld
# 状态
systemctl status firewalld
执行机器:所有节点
setenforce 0
vim /etc/selinux/config
编辑内容
# SELINUX=enforcing 改为 SELINUX=disabled
SELINUX=disabled
执行机器:所有节点
cat > /etc/hosts <<EOF
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.249.121 cdh001
192.168.249.122 cdh002
192.168.249.123 cdh003
EOF
执行机器:所有节点
cat > /etc/security/limits.conf <
sysctl -p
执行机器:所有节点
cat /proc/sys/vm/swappiness
echo 10 > /proc/sys/vm/swappiness
echo "vm.swappiness = 0" >> /etc/sysctl.conf
执行机器:所有节点
echo never > /sys/kernel/mm/transparent_hugepage/enabled
echo never > /sys/kernel/mm/transparent_hugepage/defrag
echo "echo never > /sys/kernel/mm/transparent_hugepage/defrag" >> /etc/rc.local
echo "echo never > /sys/kernel/mm/transparent_hugepage/enabled" >> /etc/rc.local
#避免重启后不生效,设置执行权限
chmod +x /etc/rc.d/rc.local
执行机器:zdb001
# 生成公钥和私钥;如果不设置密码,三次回车
ssh-keygen -t rsa
# 复制公钥和私钥,输入对应机器的root用户密码
ssh-copy-id root@cdh001
ssh-copy-id root@cdh002
ssh-copy-id root@cdh003
执行机器:所有节点
yum -y install chkconfig python bind-utils psmisc libxslt zlib sqlite cyrus-sasl-plain cyrus-sasl-gssapi fuse fuse-libs redhat-lsb httpd mod_ssl
yum -y install bind-utils psmisc cyrus-sasl-plain libaio cyrus-sasl-gssapi fuse portmap fuse-libs /lib/lsb/init-functions httpd mod_ssl openssl-devel python-psycopg2 MySQL-python libxslt
执行机器:所有节点
# 拷贝到 192.168.249.122
scp /root/download/cdh6.2.1/cloudera-repos-6.2.1/oracle-j2sdk1.8-1.8.0+update181-1.x86_64.rpm [email protected]:/root/download/oracle-j2sdk1.8-1.8.0+update181-1.x86_64.rpm
# 拷贝到 192.168.249.123
scp /root/download/cdh6.2.1/cloudera-repos-6.2.1/oracle-j2sdk1.8-1.8.0+update181-1.x86_64.rpm [email protected]:/root/download/oracle-j2sdk1.8-1.8.0+update181-1.x86_64.rpm
# 查询已安装的java
rpm -qa | grep java
# 卸载
yum -y remove java*
# cdh001执行
cd /root/download/cdh6.2.1/cloudera-repos-6.2.1/
rpm -ivh oracle-j2sdk1.8-1.8.0+update181-1.x86_64.rpm
# cdh002 和 cdh003 执行
cd /root/download
rpm -ivh oracle-j2sdk1.8-1.8.0+update181-1.x86_64.rpm
vim /etc/profile
export JAVA_HOME=/usr/java/jdk1.8.0_181-cloudera
export PATH=$PATH:$JAVA_HOME/bin
source /etc/profile
执行机器:所有节点
rpm -qa | grep lrzsz
# 如果已安装,可忽略
yum -y install lrzsz
1)设置中国时区
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
date
2)安装 ntp
执行机器:所有节点
rpm -qa | grep ntp
# 如果已安装,可忽略
yum -y install ntp
# 启动
systemctl start ntpd.service
systemctl enable ntpd.service
# 重启
systemctl restart ntpd.service
# 关闭
systemctl stop ntpd.service
systemctl disable ntpd.service
# 状态
systemctl status ntpd.service
3)选一台机器作为 ntp 服务端
执行机器:cdh001
vim /etc/ntp.conf
# server 0.centos.pool.ntp.org iburst
# server 1.centos.pool.ntp.org iburst
# server 2.centos.pool.ntp.org iburst
# server 3.centos.pool.ntp.org iburst
server 127.127.1.0
fudge 127.127.1.0 stratum 10
4)其它机器作为 ntp 客户端,同步服务端的时间
执行机器:cdh002、cdh003
crontab -e
30 * * * * /usr/sbin/ntpdate cdh001; /sbin/hwclock -w
* * * * * command
分 时 日 月 周 命令
执行机器:cdh001
# 创建目录
mkdir -p /usr/share/java
# 安装包目录
cd /root/download/cdh6.2.1
# 解压
tar -zxvf mysql-5.7/mysql-connector-java-5.1.47.tar.gz
# 移动到新建目录下,并改文件名为 mysql-connector-java.jar
cd mysql-connector-java-5.1.47
mv mysql-connector-java-5.1.47.jar /usr/share/java/mysql-connector-java.jar
# 设置权限
chmod 755 /usr/share/java/mysql-connector-java.jar
# 检查 mariadb 是否安装
rpm -qa|grep mariadb
# 卸载 mariadb
rpm -e --nodeps mariadb-libs-5.5.56-2.el7.x86_64
# 解压 MySQL 安装包
cd /root/download/cdh6.2.1
tar -xvf mysql-5.7/mysql-5.7.26-1.el7.x86_64.rpm-bundle.tar
# rpm 安装
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-server-5.7.26-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-compat-5.7.26-1.el7.x86_64.rpm
cat > /etc/my.cnf <
# 注意保存初始化生成的临时密码
# [Note] A temporary password is generated for root@localhost: q5TP/wdFjN?i
mysqld --initialize --user=mysql
# 启动
systemctl start mysqld.service
systemctl enable mysqld
mysql -u root -p
# 设置密码
set password for root@localhost = password('cdh123Z');
# 设置远程权限
use mysql;
update user set host='%' where user='root' and host='localhost';
flush privileges;
# 备用
quit;
CREATE DATABASE scm DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
CREATE DATABASE amon DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
CREATE DATABASE rman DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
CREATE DATABASE hue DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
CREATE DATABASE metastore DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
CREATE DATABASE sentry DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
CREATE DATABASE nav DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
CREATE DATABASE navms DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
CREATE DATABASE oozie DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
CREATE DATABASE hive DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
show databases;
执行机器:cdh001
yum install httpd
# 启动
service httpd start
systemctl enable httpd.service
# 创建 yum 源目录
mkdir -p /var/www/html/cloudera-repos/repodata
# 安装包目录
cd /root/download/cdh6.2.1
# 复制 CM 的文件夹
cp -r cloudera-repos-6.2.1/. /var/www/html/cloudera-repos/
cd /var/www/html/cloudera-repos/
# 安装 createrepo
yum -y install yum-utils createrepo
# 创建 repodata
createrepo .
# yum 清理
yum clean all
如无法访问,请注意配置 Hosts 文件
执行机器:cdh001
# 创建 parcel 包存放目录
mkdir -p /opt/cloudera/parcel-repo
# 安装包目录
cd /root/download/cdh6.2.1
cp -r parcel-6.2.1/. /opt/cloudera/parcel-repo
# 创建 cloudera-scm 用户
useradd --system --home=/opt/cloudera-manager/cm-6.2.1/run/cloudera-scm-server --no-create-home --shell=/bin/false --comment "Cloudera SCM User" cloudera-scm
# 修改用户组
chown -R cloudera-scm:cloudera-scm /opt/cloudera/parcel-repo/
cd /opt/cloudera/parcel-repo
#校验 parcel 文件
sha1sum CDH-6.2.1-1.cdh6.2.1.p0.1425774-el7.parcel
# 查看.sha1 内容
cat CDH-6.2.1-1.cdh6.2.1.p0.1425774-el7.parcel.sha1
# 如果一样,直接将后缀 .sha1 改为 .sha
# 如果不一样,将 sha1sum 后的值替换到 .sha1 文件中 并改为 .sha
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
执行机器:cdh001
# 主节点(cdh001)导入 GPGkey
rpm --import http://cdh001/cloudera-repos/RPM-GPG-KEY-cloudera
# 顺序安装
# 所有节点安装 daemons
yum -y localinstall http://cdh001/cloudera-repos/cloudera-manager-daemons-6.2.1-1426065.el7.x86_64.rpm
# 主节点(cdh001)安装 server
yum -y localinstall http://cdh001/cloudera-repos/cloudera-manager-server-6.2.1-1426065.el7.x86_64.rpm
# 所有节点安装 agent
yum -y localinstall http://cdh001/cloudera-repos/cloudera-manager-agent-6.2.1-1426065.el7.x86_64.rpm
# 主节点(cdh001)初始化数据库
# /opt/cloudera/cm/schema/scm_prepare_database.sh 数据库类型 数据库名 用户名 密码
/opt/cloudera/cm/schema/scm_prepare_database.sh mysql scm root cdh123Z
执行机器:cdh002、cdh003
# 配置CM Server的Host
sed -i '/server_host=/cserver_host=cdh001' /etc/cloudera-scm-agent/config.ini
# 启动server(主节点 cdh001 执行)
systemctl start cloudera-scm-server
systemctl enable cloudera-scm-server
# 启动agent(所有节点执行)
systemctl start cloudera-scm-agent
systemctl enable cloudera-scm-agent
# 服务状态
systemctl status cloudera-scm-server
systemctl status cloudera-scm-agent
执行机器:cdh001
CM管理端配置CDH集群
zookeeper
实例
- 添加角色实例
选择主机
rm -rf /dfs/nn
HDFS
操作
- 启用 HighAvailability
添加服务
# 集群配置 - 数据库设置
JDBC driver cannot be found. Unable to find the JDBC database jar on host : cdh003.
方案一:查看 Hive、Activity Monitor、Hue 是否已选择 cdh001,因为 cdh001 安装了 MySQL
方案二:/usr/share/java/mysql-connector-java.jar
是否有 MySQL 连接驱动
对当前 NameNode 的名称目录进行格式化。如果名称目录不为空,此操作将失败。
rm -rf /dfs/nn
Failed to start namenode.
java.io.IOException: NameNode is not formatted.
at org.apache.hadoop.hdfs.server.namenode.FSImage.recoverTransitionRead(FSImage.java:237)
at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.loadFSImage(FSNamesystem.java:1084)
at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.loadFromDisk(FSNamesystem.java:709)
at org.apache.hadoop.hdfs.server.namenode.NameNode.loadNamesystem(NameNode.java:665)
at org.apache.hadoop.hdfs.server.namenode.NameNode.initialize(NameNode.java:727)
at org.apache.hadoop.hdfs.server.namenode.NameNode.(NameNode.java:950)
at org.apache.hadoop.hdfs.server.namenode.NameNode.(NameNode.java:929)
at org.apache.hadoop.hdfs.server.namenode.NameNode.createNameNode(NameNode.java:1653)
at org.apache.hadoop.hdfs.server.namenode.NameNode.main(NameNode.java:1720)
hdfs namenode -format
场景说明:终端执行 hdfs dfs -ls /tmp
时,提示一下信息
ls: Operation category READ is not supported in state standby. Visit https://s.apache.org/sbnn-error
HDFS 高可用模式下,执行的 NameNode 处于 standby 状态
vim /etc/hadoop/conf/core-site.xml
vim /etc/hadoop/conf.cloudera.hdfs/core-site.xml
fs.defaultFS
hdfs://cdh002:8020
不良 : Canary 测试无法为 /tmp/.cloudera_health_monitoring_canary_files 创建父目录。
创建 /tmp
目录;
创建完成后,HDFS 会自动创建 .cloudera_health_monitoring_canary_files
文件夹
hdfs dfs -ls /tmp
sudo -u hdfs hdfs dfs -mkdir /tmp
场景说明:在 NameNode 的 Web UI 中创建文件夹时,提示一下信息
Permission denied: user=dr.who, access=WRITE, inode="/":hdfs:supergroup:drwxr-xr-x
HDFS = 配置
- 搜索 hdfs-site
- hdfs-site.xml 的 HDFS 服务高级配置代码段(安全阀)
配置 dfs.permissions.enabled = false