[ 若泽大数据 ] CDH6.3.1 企业集群离线部署
- MySQL离线部署
- CM离线部署
- Parcel⽂件离线源部署
支持的版本:Cloudera Enterprise 6 要求和支持的版本|6.x |Cloudera Documentation
CDH 部署时,系统默认自带的 Python 不要更改,若需要其他版本,进行 Python 多版本控制,Centos 7.x — Python2.7,Centos 6.x — Python 2.6。
不使用官方默认的 postgresql,建议使用 MySQL 5.7。
MySQL 离线部署:
mysql-5.7.11-linux-glibc2.5-x86_64.tar.gzCM:
cm6.3.1-redhat7.tar.gzParcel:
CDH-6.3.1-1.cdh6.3.1.p0.1470567-el7.parcel
CDH-6.3.1-1.cdh6.3.1.p0.1470567-el7.parcel.sha1
manifest.json环境准备:
jdk-8u45-linux-x64.gz
mysql-connector-java-5.1.47.jar
CentOS 7.9 操作系统,虚拟机 4 核 20 G(内存尽量 > 8 G)
# 查看 IP 地址
[root@node04 ~]# ip addr
# 查看网关
[root@node04 ~]# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 172.16.16.129 0.0.0.0 UG 100 0 0 ens33
172.16.16.128 0.0.0.0 255.255.255.128 U 100 0 0 ens33
192.168.122.0 0.0.0.0 255.255.255.0 U 0 0 0 virbr0
# 虚拟机配置静态地址
[root@node04 ~]# vi /etc/sysconfig/network-scripts/ifcfg-ens33
# 配置完后,重启网卡
[root@node04 ~]# systemctl restart network
[root@node04 ~]# vi /etc/hosts
172.16.16.216 node04
172.16.16.215 node05
172.16.16.217 k8s-master
[root@node04 ~]# systemctl restart network
# 停止并禁用防火墙
[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# systemctl disable firewalld
# 清空规则
[root@localhost ~]# iptables -F
# 查看防火墙状态
[root@localhost ~]# systemctl status firewalld
# 关闭 selinux
[root@localhost ~]# vi /etc/selinux/config
SELINUX=disabled
# 设置后重启生效
[root@localhost ~]# reboot
安全增强型 Linux(SELinux)是一种采用安全架构的 Linux 系统,它能够让管理员更好地管控哪些人可以访问系统。其旨在提高 Linux 系统的安全性,主要作用是最大限度地减小系统中服务进程可访问的资源(最小权限原则)。
# 所有节点设置亚洲上海海时区
timedatectl set-timezone Asia/Shanghai
主从:主节点和互联网同步时间,从节点与主节点同步
# 所有节点安装ntp
yum install -y ntp
# 选取 k8s-master 为 ntp 的主节点
[root@k8s-master ~]# vi /etc/ntp.conf
# 当外部时间不不可用时,使用本地硬件时间
server 127.127.1.0 iburst local clock
# 允许哪些网段的机器来同步时间
restrict 172.16.16.0 mask 255.255.0.0 nomodify notrap
# 开启 ntpd 及查看状态
[root@k8s-master ~]# systemctl start ntpd
[root@k8s-master ~]# systemctl status ntpd
# 验证
[root@k8s-master ~]# ntpq -p
# 其他从节点停止禁用 ntpd 服务
[root@node04 ~]# systemctl stop ntpd
[root@node04 ~]# systemctl disable ntpd
[root@node04 ~]# ntpdate k8s-master
# 其他从节点每天凌晨同步 k8s-master 节点时间
[root@node04 ~]# crontab -e
00 00 * * * /usr/sbin/ntpdate k8s-master
# 将 k8s-master 中的安装文件分发给其他节点
[root@k8s-master root]# scp -r /home/root/CDH6.3.1 node04:/home/node04/CDH6.3.1/
[root@k8s-master root]# scp -r /home/root/CDH6.3.1 node05:/home/node05/CDH6.3.1/
[root@node04 CDH6.3.1]# mkdir /usr/java
[root@node04 CDH6.3.1]# tar -xzvf jdk-8u45-linux-x64.gz -C /usr/java/
# 修正所属用户及用户组
[root@node04 java]# chown -R root:root /usr/java/jdk1.8.0_45/
# 修改环境变量
[root@node04 java]# vi /etc/profile
export JAVA_HOME=/usr/java/jdk1.8.0_45
export PATH=${JAVA_HOME}/bin:${PATH}
source /etc/profile
which java
注意 java 与 jdbc jar 的路径,不要随意修改,如 jdbc,官方文件中默认的配置路径是 cloudera_mysql_connector_jar = /usr/share/java/mysql-connector-java.jar(cat /etc/cloudera-scm-agent/config.ini)
(MySQL重启有点问题,权限方面,误打误撞设置了 777 权限才解决问题...)
文档链接:https://github.com/Hackeruncle/MySQL(MySQL 5.7.11)
视频链接:https://pan.baidu.com/s/1jdM8WeIg8syU0evL1-tDOQ 密码:whic
1.解压及创建目录
[root@k8s-master CDH6.3.1]# tar xzvf mysql-5.7.11-linux-glibc2.5-x86_64.tar.gz -C /usr/local/
[root@k8s-master CDH6.3.1]# cd /usr/local/
[root@k8s-master local]# mv mysql-5.7.11-linux-glibc2.5-x86_64 mysql
[root@k8s-master local]# cd mysql
[root@k8s-master mysql]# mkdir arch data tmp
2.创建my.cnf
vi /etc/my.cnf # 将以下内容复制粘贴至 my.cnf 文件中
[client]
port = 3306
socket = /usr/local/mysql/data/mysql.sock
default-character-set=utf8mb4
[mysqld]
port = 3306
socket = /usr/local/mysql/data/mysql.sock
skip-slave-start
skip-external-locking
key_buffer_size = 256M
sort_buffer_size = 2M
read_buffer_size = 2M
read_rnd_buffer_size = 4M
query_cache_size= 32M
max_allowed_packet = 16M
myisam_sort_buffer_size=128M
tmp_table_size=32M
table_open_cache = 512
thread_cache_size = 8
wait_timeout = 86400
interactive_timeout = 86400
max_connections = 600
# Try number of CPU's*2 for thread_concurrency
#thread_concurrency = 32
#isolation level and default engine
default-storage-engine = INNODB
transaction-isolation = READ-COMMITTED
server-id = 1739
basedir = /usr/local/mysql
datadir = /usr/local/mysql/data
pid-file = /usr/local/mysql/data/hostname.pid
#open performance schema
log-warnings
sysdate-is-now
binlog_format = ROW
log_bin_trust_function_creators=1
log-error = /usr/local/mysql/data/hostname.err
log-bin = /usr/local/mysql/arch/mysql-bin
expire_logs_days = 7
innodb_write_io_threads=16
relay-log = /usr/local/mysql/relay_log/relay-log
relay-log-index = /usr/local/mysql/relay_log/relay-log.index
relay_log_info_file= /usr/local/mysql/relay_log/relay-log.info
log_slave_updates=1
gtid_mode=OFF
enforce_gtid_consistency=OFF
# slave
slave-parallel-type=LOGICAL_CLOCK
slave-parallel-workers=4
master_info_repository=TABLE
relay_log_info_repository=TABLE
relay_log_recovery=ON
#other logs
#general_log =1
#general_log_file = /usr/local/mysql/data/general_log.err
#slow_query_log=1
#slow_query_log_file=/usr/local/mysql/data/slow_log.err
#for replication slave
sync_binlog = 500
#for innodb options
innodb_data_home_dir = /usr/local/mysql/data/
innodb_data_file_path = ibdata1:1G;ibdata2:1G:autoextend
innodb_log_group_home_dir = /usr/local/mysql/arch
innodb_log_files_in_group = 4
innodb_log_file_size = 1G
innodb_log_buffer_size = 200M
#根据生产需要,调整pool size
innodb_buffer_pool_size = 2G
#innodb_additional_mem_pool_size = 50M #deprecated in 5.6
tmpdir = /usr/local/mysql/tmp
innodb_lock_wait_timeout = 1000
#innodb_thread_concurrency = 0
innodb_flush_log_at_trx_commit = 2
innodb_locks_unsafe_for_binlog=1
#innodb io features: add for mysql5.5.8
performance_schema
innodb_read_io_threads=4
innodb-write-io-threads=4
innodb-io-capacity=200
#purge threads change default(0) to 1 for purge
innodb_purge_threads=1
innodb_use_native_aio=on
#case-sensitive file names and separate tablespace
innodb_file_per_table = 1
lower_case_table_names=1
[mysqldump]
quick
max_allowed_packet = 128M
[mysql]
no-auto-rehash
default-character-set=utf8mb4
[mysqlhotcopy]
interactive-timeout
[myisamchk]
key_buffer_size = 256M
sort_buffer_size = 256M
read_buffer = 2M
write_buffer = 2M
3.创建用户组及用户
[root@k8s-master local]# groupadd -g 101 dba
[root@k8s-master local]# useradd -u 514 -g dba -G root -d /usr/local/mysql mysqladmin
4.copy 环境变量配置文件至mysqladmin用户的home目录中,为了以下步骤配置个人环境变量(.为隐藏文件)
[root@k8s-master local]# cp /etc/skel/.* /usr/local/mysql
5.配置环境变量
[root@k8s-master mysql]# vi .bashrc
export MYSQL_BASE=/usr/local/mysql
export PATH=${MYSQL_BASE}/bin:$PATH
6.赋权限和用户组,切换用户 mysqladmin,安装
[root@k8s-master mysql]# chown mysqladmin:dba /etc/my.cnf
[root@k8s-master mysql]# chmod 640 /etc/my.cnf
[root@k8s-master mysql]# chown -R mysqladmin:dba /usr/local/mysql
[root@k8s-master mysql]# chmod -R 755 /usr/local/mysql
7.配置服务及开机自启动
# 将服务文件拷贝到init.d下,并重命名为 mysql
[root@k8s-master mysql]# cp support-files/mysql.server /etc/rc.d/init.d/mysql
# 赋予可执行权限
[root@k8s-master mysql]# chmod +x /etc/rc.d/init.d/mysql
# 添加服务
[root@k8s-master mysql]# chkconfig --add mysql
[root@k8s-master mysql]# chkconfig mysql on
8.安装 libaio 及安装 mysql 的初始 db
[root@k8s-master mysql]# yum -y install libaio
# 初始化
[root@k8s-master mysql]# bin/mysqld \
--defaults-file=/etc/my.cnf \
--user=mysqladmin \
--basedir=/usr/local/mysql/ \
--datadir=/usr/local/mysql/data/ \
--initialize
9.查看临时密码
[root@k8s-master mysql]# cd data
[root@k8s-master data]# cat hostname.err |grep password
2022-05-03T03:08:01.112084Z 1 [Note] A temporary password is generated for root@localhost: yJfl0zstMw&h
[root@k8s-master data]# su - mysqladmin
10.启动服务
[mysqladmin@k8s-master ~]$ service mysql start
Starting MySQL.. SUCCESS!
11.登录及修改用户密码
[mysqladmin@k8s-master ~]$ mysql -uroot -p
Enter password: (yJfl0zstMw&h--不显示)
Welcome to the MySQL monitor...
mysql> alter user root@localhost identified by '123456';
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456';
# 注意要刷新
mysql> flush privileges;
12.部署完成后,登录
[mysqladmin@node01 ~]$ mysql -uroot -p123456
mysql> create database cmf default character set utf8;
mysql> create database amon default character set utf8;
mysql> grant all privileges on cmf.* to 'cmf'@'%' identified by '123456';
mysql> grant all privileges on amon.* to 'amon'@'%' identified by '123456';
mysql> flush privileges;
mkdir -p /usr/share/java/
# 重命名不能带版本号
[root@k8s-master mysql]# cd /home/root/CDH6.3.1
[root@k8s-master CDH6.3]# cp mysql-connector-java-5.1.47.jar /usr/share/java/mysql-connector-java.jar
# 关闭MySQL服务
systemctl stop mysqld
# 使用 rpm 命令查看已安装的安装包
rpm -qa|grep -i mysql
mysql-community-libs-5.7.29-1.el7.x86_64
mysql-community-common-5.7.29-1.el7.x86_64
mysql-community-client-5.7.29-1.el7.x86_64
mysql-community-server-5.7.29-1.el7.x86_64
mysql57-community-release-el7-11.noarch
# 使用 yum 卸载安装的 mysql
yum remove mysql mysql-server mysql-libs mysql-server
# 查询剩余的安装包
rpm -qa|grep -i mysql
mysql-community-common-5.7.29-1.el7.x86_64
mysql57-community-release-el7-11.noarch
# 移除掉这些安装包
rpm -ev mysql-community-common-5.7.29-1.el7.x86_64
rpm -ev mysql57-community-release-el7-11.noarch
# 查找是否还有残留文件
find / -name mysql
# 移除这些残留文件
rm -rf /var/lib/mysql
# 最后的检查,直到删干净为止
1.1 所有节点解压文件
[root@k8s-master CDH6.3]# tar -xzvf cm6.3.1-redhat7.tar.gz
1.2 选择 k8s-master 为 cm server,不下载依赖包直接部署
# server 与 agent 的安装,都先部署 daemons 文件
[root@k8s-master CDH6.3]# cd cm6.3.1/RPMS/x86_64
[root@k8s-master x86_64]# rpm -ivh cloudera-manager-daemons-6.3.1-1466458.el7.x86_64.rpm --nodeps --force
[root@k8s-master x86_64]# rpm -ivh cloudera-manager-server-6.3.1-1466458.el7.x86_64.rpm --nodeps --force
1.3 所有节点(包含 k8s-master)为 cm agent,不下载依赖包直接部署
# k8s-master 节点
[root@k8s-master CDH6.3]# cd cm6.3.1/RPMS/x86_64
[root@k8s-master x86_64]#rpm -ivh cloudera-manager-agent-6.3.1-1466458.el7.x86_64.rpm --nodeps --force
# 其他节点
[root@node04 CDH6.3]# cd cm6.3.1/RPMS/x86_64
[root@node04 x86_64]# rpm -ivh cloudera-manager-daemons-6.3.1-1466458.el7.x86_64.rpm --nodeps --force
[root@node04 x86_64]# rpm -ivh cloudera-manager-agent-6.3.1-1466458.el7.x86_64.rpm --nodeps --force
1.4 所有节点修改 agent 的配置,指向 server 的节点 k8s-master
[root@node04 home]# vi /etc/cloudera-scm-agent/config.ini
server_host=k8s-master
1.5 主节点修改 server 的配置
# 注意,如果是复制粘贴,不要有空格
vi /etc/cloudera-scm-server/db.properties
com.cloudera.cmf.db.type=mysql
com.cloudera.cmf.db.host=k8s-master:3306
com.cloudera.cmf.db.name=cmf
com.cloudera.cmf.db.user=cmf
com.cloudera.cmf.db.password=123456
com.cloudera.cmf.db.setupType=EXTERNAL
2.1 安装 httpd 服务
yum install -y httpd
2.2.部署离线parcel源
mkdir -p /var/www/html/cdh6_parcel
# Centos 7.x 的 parcel 文件必须是 e17
[root@k8s-master CDH6.3]# CDH6.3.1]# mv CDH-6.3.1-1.cdh6.3.1.p0.1470567-el7.parcel /var/
www/html/cdh6_parcel/
[root@k8s-master CDH6.3.1]# mv CDH-6.3.1-1.cdh6.3.1.p0.1470567-el7.parcel.sha1 /
var/www/html/cdh6_parcel/CDH-6.3.1-1.cdh6.3.1.p0.1470567-el7.parcel.sha
[root@k8s-master CDH6.3.1]# mv manifest.json /var/www/html/cdh6_parcel/
# 移动 sha1 名称文件时,重命名去掉 1,不然在部署过程 CM 认为文件下载不完整,会持续下载
2.3.启动 httpd
systemctl start httpd
# 可在浏览器中查看:http://k8s-master/cdh6_parcel/
3.1 k8s-master 节点启动 Server
[root@k8s-master cloudera-scm-server]# service cloudera-scm-server start
# 查看日志,有错误就根据错误解决,没有错误,等待1min,出现 7180 端口,表明是成功的。
tail -F /var/log/cloudera-scm-server/cloudera-scm-server.log
3.2 等待 1min,打开 http://k8s-master:7180 是否出现登陆界面,账号密码:admin admin
3.3 假如打不不开,去看 server 的 log,根据错误仔细排查错误
systemctl start cloudera-scm-agent
http://k8s-master:7180/
账号密码:admin admin
勾选用户许可条款与条件,其余都是下拉界面,点击继续进行下一步
选择Cloudera Express免费版本
填写保存后,返回页面,等一会便自动刷新界面,CDH版本选择 CDH-6.3.1.1-cdh6.3.1.p0.1470567 版本即可进行下一步。
处理对应的错误,在对应的主机上输入相关命令,如上述的问题修改对应内容即可。
echo never>/sys/kernel/mm/transparent_hugepage/defrag echo never>/sys/kernel/mm/transparent_hugepage/enabled
若不使用 HUE,则可以忽略。
第一次安装,可以只安装基本组件:HDFS、YARN、ZooKeeper
启动后,会出现各式各样的配置问题,依次调整即可(先调整 Cloduera Management Service 的问题)。
点开给予相应的空间,若空间不满足,点击 Suppress 忽略。
版本验证问题,可忽略。
个人未安装完成便进行卸载,仅供参考....
停止CM Server和数据库:在 k8s-master 服务器上执行如下命令
[root@k8s-master ~]# service cloudera-scm-server stop
#如果使用内置 db postgresql 需要停止该服务,没有则忽略
[root@k8s-master ~]# service cloudera-scm-server-db stop
卸载 CM Server :使用 yum 卸载 cloudera-scm-server 和 cloudera-scm-server-db-2
[root@k8s-master ~]# yum remove cloudera-manager-server
#如果使用内置db postgresql需要移除该服务,没有则忽略
[root@k8s-master ~]# yum remove cloudera-manager-server-db-2
卸载 CM Agent 和 Managed Software:在所有服务器上使用如下命令停止 Cloudera Manager Agent 服务
[root@k8s-master ~]# sudo service cloudera-scm-agent hard_stop
在集群所有节点执行如下操作:
[root@k8s-master ~]# yum remove 'cloudera-manager-*'
运行清除命令:在集群所有节点执行如下操作
[root@k8s-master ~]# yum clean all
移除CM数据
在集群所有节点执行如下命令,删除所有CM数据
umount cm_processes
rm –rf /usr/share/cmf /var/lib/cloudera* /var/cache/yum/x86_64/6/cloudera* /var/log/cloudera* /var/run/cloudera* /etc/cloudera* /usr/lib64/cmf
(磁盘空间分配时,预留了未分配的空间.....)
[root@k8s-master ~]# df -h
文件系统 容量 已用 可用 已用% 挂载点
devtmpfs 126G 0 126G 0% /dev
tmpfs 126G 104M 126G 1% /dev/shm
tmpfs 126G 61M 126G 1% /run
tmpfs 126G 0 126G 0% /sys/fs/cgroup
/dev/mapper/centos-root 25G 24G 0 100% /
/dev/sda7 283M 143M 122M 54% /boot
/dev/sda6 200M 12M 189M 6% /boot/efi
/dev/mapper/centos-home 1.4T 40G 1.3T 4% /home
cm_processes 126G 0 126G 0% /run/cloudera-scm-agent/process
tmpfs 26G 8.0K 26G 1% /run/user/42
tmpfs 26G 44K 26G 1% /run/user/0
tmpfs 26G 52K 26G 1% /run/user/1003
# 开始扩容,创建物理卷
[root@node01 ~]# lvm
lvm> pvcreate /dev/sda9
WARNING: ext4 signature detected on /dev/sda9 at offset 1080. Wipe it? [y/n]: y
Wiping ext4 signature on /dev/sda9.
Physical volume "/dev/sda9" successfully created.
查看物理卷和卷组:
lvm> pvdisplay
"/dev/sda9" is a new physical volume of "400.00 GiB"
--- NEW Physical volume ---
PV Name /dev/sda9
VG Name
PV Size 400.00 GiB
Allocatable NO
PE Size 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID v05R2D-HKdL-X6Dn-jT2Y-D9T0-Tr5u-KnIWb4
...
# 将物理卷加入到卷组
lvm> vgextend centos /dev/sda9
Volume group "centos" successfully extended
# 将卷组剩余空间添加到逻辑卷 /dev/centos/root
lvm> lvextend -l +100%FREE /dev/centos/root
Size of logical volume centos/root changed from 25.00 GiB (6400 extents) to 425.00 GiB (108800 extents).
Logical volume centos/root successfully resized.
# 同步到文件系统,之前只是对逻辑卷扩容,还要同步到文件系统,实现对根目录的扩容。
[root@node01 ~]# resize2fs /dev/mapper/centos-root
resize2fs 1.42.9 (28-Dec-2013)
Filesystem at /dev/mapper/centos-root is mounted on /; on-line resizing required
old_desc_blocks = 4, new_desc_blocks = 54
The filesystem on /dev/mapper/centos-root is now 111411200 blocks long.
resize2fs 针对的是ext2、ext3、ext4文件系统
xfs_growfs 针对的是xfs文件系统