cdh 大数据平台搭建

教程 犀牛 ⋅ 于 2021-06-04 15:18:52 ⋅ 最后回复由 jazz156 2023-12-05 13:29:15 ⋅ 3371 阅读

安装包下载

链接: https://pan.baidu.com/s/1dyvSej5tSrUC4ja8-usqvA 提取码: a9hx

上传压缩包

上传cdh6.3.2.tar安装包到linux服务器,并解压

tar -xvf cdh6.3.2.tar -C /tmp/

file

组件安装

  • 安装 expect 命令,实现脚本交互
#所有节点
yum install expect -y

file

  • rhel 7 默认没有pstree命令,使用以下命令进行安装
#所有节点
yum install psmisc -y

file

  • rhel 7 如果为最小安装时,全报客户端部署错误,此时一般是由于缺程序引起的,常见的是缺perl
#所有节点
yum install perl -y

file

  • hue 需要使用到 httpd
#所有节点
yum install httpd mod_ssl -y

file

  • kudu 需要以下组件
#所有节点
yum install gcc python-devel -y
yum install cyrus-sasl* -y

file

调整host文件

#所有节点
cat >> /etc/hosts <<EOF
192.168.88.220 worker-1
192.168.88.221 worker-2
192.168.88.222 worker-3
EOF

file

关闭selinux

#所有节点
grep ^SELINUX= /etc/selinux/config
sed -i 's/^SELINUX=.*/SELINUX=disabled/g' /etc/selinux/config
setenforce 0
getenforce

file

关闭iptables

#所有节点
systemctl disable firewalld
systemctl stop firewalld

file

ssh互信

#所有节点
ssh-keygen -t rsa   

file

  • 在每台机器械上执行
#逐条执行
ssh-copy-id root@worker-1
ssh-copy-id root@worker-2
ssh-copy-id root@worker-3

file

  • 主节点执行
scp ~/.ssh/authorized_keys root@worker-1:/root/.ssh/
scp ~/.ssh/authorized_keys root@worker-2:/root/.ssh/
scp ~/.ssh/authorized_keys root@worker-3:/root/.ssh/

file

验证ssh效果

file

  • 调整系统使用swap的策略
    调整系统使用swap的策略,设置为1,即最大限度使用物理内存,少使用swap空间
#所有节点执行

#检查当前设置值
sysctl -a | grep vm.swappiness
echo 1 > /proc/sys/vm/swappiness
sysctl -a | grep vm.swappiness
#更改默认配置
cat >> /etc/sysctl.conf <<EOF
vm.swappiness=1
EOF
#设置立即生效
sysctl vm.swappiness=1
#设置下次启动生效
cat >> /etc/rc.d/rc.local <<EOF
if test -f /sys/kernel/mm/transparent_hugepage/enabled; then
    echo never > /sys/kernel/mm/transparent_hugepage/enabled
fi
if test -f /sys/kernel/mm/transparent_hugepage/defrag; then
    echo never > /sys/kernel/mm/transparent_hugepage/defrag
fi
EOF
#配置即刻生效
echo never > /sys/kernel/mm/transparent_hugepage/enabled
echo never > /sys/kernel/mm/transparent_hugepage/defrag
#检查配置是否生效
cat /sys/kernel/mm/transparent_hugepage/enabled
cat /sys/kernel/mm/transparent_hugepage/defrag
#赋予执行权限
chmod 755 /etc/rc.d/rc.local

file

修改sudoers

#所有节点执行
unalias cp
cp -n /etc/sudoers /etc/sudoers.bak && \
cp -f /etc/sudoers.bak /etc/sudoers && \
chmod 740 /etc/sudoers && \
sed -i 's/^\(Defaults requiretty\)/# \1/g' /etc/sudoers && \
chmod 440 /etc/sudoers
grep requiretty /etc/sudoers

file

配置ntp时间同步

#所有节点执行
yum install ntp -y
#主节点执行
mv -n /etc/ntp.conf /etc/ntp.conf.bak
cat > /etc/ntp.conf << EOF
server 127.127.1.0
fudge 127.127.1.0 stratum 10
EOF
#从节点执行,且只能填写ip不能使用hostname,对应的ip为主节点的ip地址
mv -n /etc/ntp.conf /etc/ntp.conf.bak
cat > /etc/ntp.conf << EOF
server 192.168.88.220 iburst
EOF
#禁用chronyd服务,RHEL 7中默认启用了,这会导致ntpd服务无法开机启动
systemctl disable chronyd
#所有节点启动ntp服务
chmod 644 /etc/ntp.conf
systemctl restart ntpd.service
systemctl status ntpd.service
systemctl enable ntpd.service
#检查ntp是否生效
ntpdate -u 192.168.88.220
ntpq -p
  • ntp安装

file

  • 主节点配置

file

  • 从节点配置

file

file

  • 禁用chronyd

file

  • 服务启动

file

  • 服务检查

file

调整后

file

安装jdk

# 所有节点执行

#所有的都删除掉
rpm -qa | grep java
#安装jdk
cd /tmp/
#包分发到其他节点上
scp oracle-j2sdk1.8-1.8.0+update181-1.x86_64.rpm root@worker-2:/tmp/
scp oracle-j2sdk1.8-1.8.0+update181-1.x86_64.rpm root@worker-3:/tmp/
yum install oracle-j2sdk1.8-1.8.0+update181-1.x86_64.rpm -y
ln -s /usr/java/jdk1.8.0_181-cloudera /usr/java/latest
#配置环境变量
cat >> /etc/profile <<EOF
export JAVA_HOME=/usr/java/latest
export JRE_HOME=\$JAVA_HOME/jre
export CLASSPATH=.:\$CLASSPATH:\$JAVA_HOME/lib:\$JRE_HOME/lib
export PATH=\$PATH:\$JAVA_HOME/bin:\$JRE_HOME/bin
EOF
#source环境变量及验证是否生效
source /etc/profile
java -version

安装、配置mysql

#主节点执行即可

#安装mariadb软件
#所有的都删除掉
rpm -qa | grep mysql
#安装
yum install -y mariadb
yum install -y mariadb-server
#启动
systemctl enable mariadb
systemctl start mariadb
#初始化配置
mysql_secure_installation

file

创建cm元数据库

mysql -uroot -p
create database metastore default character set utf8;
create user 'hive'@'%' identified by 'hivedemima';
grant all privileges on metastore.* to 'hive'@'%';

create database cm default character set utf8;
create user 'cm'@'%' identified by 'cmdemima';
grant all privileges on cm.* to 'cm'@'%';

create database am default character set utf8;
create user 'am'@'%' identified by 'amdemima';
grant all privileges on am.* to 'am'@'%';

create database rm default character set utf8;
create user 'rm'@'%' identified by 'rmdemima';
grant all privileges on rm.* to 'rm'@'%';

create database hue default character set utf8;
create user 'hue'@'%' identified by 'huedemima';
grant all privileges on hue.* to 'hue'@'%';

create database oozie default character set utf8;
create user 'oozie'@'%' identified by 'ooziedemima';
grant all privileges on oozie.* to 'oozie'@'%';

create database sentry default character set utf8;
create user 'sentry'@'%' identified by 'sentrydemima';
grant all privileges on sentry.* to 'sentry'@'%';

create database nas default character set utf8;
create user 'nas'@'%' identified by 'nasdemima';
grant all privileges on nas.* to 'nas'@'%';

create database nms default character set utf8;
create user 'nms'@'%' identified by 'nmsdemima';
grant all privileges on nms.* to 'nms'@'%';

flush privileges;
exit;

配置http服务

#所有节点安装

#安装及开启http服务
yum install httpd -y
systemctl start httpd
systemctl enable httpd
systemctl status httpd

file

#主节点执行
#配置http服务
#移动两个文件夹到html目录下
mkdir -p /var/www/html/cm6.3.1
mkdir -p /var/www/html/cdh6.3.2
cd /tmp
mv CDH-6.3.2-1.cdh6.3.2.p0.1605554-el7.parcel* manifest.json /var/www/html/cdh6.3.2/
mv allkeys.asc cloudera-manager-* enterprise-debuginfo-6.3.1-1466458.el7.x86_64.rpm /var/www/html/cm6.3.1/
  • 使用浏览器测试访问

http://worker-1/cm6.3.1/

http://worker-1/cdh6.3.2/

  • 创建cm的repo
#主节点执行
yum install createrepo -y
cd /var/www/html/cm6.3.1
createrepo .
cat > /etc/yum.repos.d/cloudera.repo <<EOF
[Cloudera_Manager]
name=Cloudera Manager 6.3.1
baseurl=http://worker-1/cm6.3.1/
enabled=1
gpgcheck=0
EOF
yum clean all
yum repolist

file

安装CDH6

#所有节点

#复制MySQL的JDBC包
mkdir /usr/share/java
#主节点执行
scp /tmp/mysql-connector-java-5.1.35.jar root@worker-2:/tmp/
scp /tmp/mysql-connector-java-5.1.35.jar root@worker-3:/tmp/
#所有节点执行
mv /tmp/mysql-connector-java-5.1.35.jar /usr/share/java/
ln -s /usr/share/java/mysql-connector-java-5.1.35.jar /usr/share/java/mysql-connector-java.jar
  • 安装CM
#只在主节点执行
yum install cloudera-manager-server -y

file

  • 初始化CM元数据库
/opt/cloudera/cm/schema/scm_prepare_database.sh mysql -h 192.168.88.220 cm cm cmdemima

file

  • 启动cm服务
#主节点执行
systemctl start cloudera-scm-server
systemctl status cloudera-scm-server
#检查端口状态
yum install net-tools -y
netstat -apn | grep 7180

file

  • 网页登陆

登录cloudera manager管理页面,默认的账号、密码为:admin/admin

http://worker-1:7180

"同意协议" -> "选择Cloudera Express" -> "选择节点" -> ...

file

集群安装时库选择

parcel的远程安装库为:http://worker-1/cdh6.3.2/

agent的远程安装库为:http://worker-1/cm6.3.1/

file

file

file

file

file

file

file

file

file

file

Kudu在安装时需要填写以下几项内容:

Kudu Master WAL Directory: /kudu_master/fs_wal_dir

Kudu Master Data Directories: /kudu_master/fs_data_dirs

Kudu Tablet Server WAL Directory: /kudu_tablet/fs_wal_dir

Kudu Tablet Server Data Directories: /kudu_tablet/fs_data_dirs

file

file

file

单机版问题解决

单点部署时HDFS 副本不足告警:Under-Replicated Blocks

修改 dfs.replication 参数为1,之后在HDFS下执行以下命令将所有文件副本数设置为1:

hadoop fs -setrep -R 1 /
回复帖子,然后刷新页面即可查看隐藏内容

版权声明:原创作品,允许转载,转载时务必以超链接的形式表明出处和作者信息。否则将追究法律责任。来自海汼部落-犀牛,http://hainiubl.com/topics/75615
成为第一个点赞的人吧 :bowtie:
回复数量: 17
  • WinJay
    2023-11-25 16:25:26

    感谢大佬分享,已经安装成功,但是集群内还是有好多报错。。。

  • jazz156
    2023-12-05 13:29:15

    的时间

暂无评论~~
  • 请注意单词拼写,以及中英文排版,参考此页
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`, 更多语法请见这里 Markdown 语法
  • 支持表情,可用Emoji的自动补全, 在输入的时候只需要 ":" 就可以自动提示了 :metal: :point_right: 表情列表 :star: :sparkles:
  • 上传图片, 支持拖拽和剪切板黏贴上传, 格式限制 - jpg, png, gif,教程
  • 发布框支持本地存储功能,会在内容变更时保存,「提交」按钮点击时清空
Ctrl+Enter