Cloude Manager概述:
CDH是Cloudera公司对整体hadoop集群环境进行监控与管理的企业级大数据管理平台。
Cloudera Manager分为:
Cloudera Manager Server:对整个集群提供监控与管理操作。Cloudera Manager Server通过部署在不同设备上的Cloudera Manager Agent进行管理整体集群。Cloudera Manager Server需要部署在一台设备上。
Cloudera Manager Agent:部署在每个需要监控与管理的设备上。负责采集运行数据与执行下发的管理命令。
DataBase:关系型数据库是Cloudera Manager执行管理操作时,存储整体集群情况数据。
CM、CD版本为6.2.0
CM百度网盘地址:https://pan.baidu.com/s/1W2urUqeOPE4_cJP-IVXxGw 提取码:r1h8
可查看其他配套相关版本要求
2.jdk(master结点)https://www.oracle.com/java/technologies/downloads/#java8
官网下载地址
rpm -qa|grep java #查询目前已装的JDK
rpm -e --nodeps #后面跟上一条命令查找出来的所有包,用空格隔开 #卸载相应的JDK
或 yum remove java* # 卸载
在usr目录下建立java安装目录
mkdir /usr/javatar -zxvf jdk-8u321-linux-x64.tar.gzvi /etc/profile
#添加如下内容:JAVA_HOME=/usr/java/jdk1.8.0_321
CLASSPATH=$JAVA_HOME/lib/
PATH=$PATH:$JAVA_HOME/bin
export PATH JAVA_HOME CLASSPATHsource /etc/profile #使文件生效
3.mysql(我弃用此方案,原文在下,我采用之后的方式,虽然简单但我看不懂)
可忽略此网址
https://dev.mysql.com/downloads/connector/j/
安装指南https://blog.csdn.net/weixin_31240035/article/details/112280003
mysql部分
此文的yum安装流畅快速简洁方便
安装MySQL(MySQL只需要在主服务器上安装)
【注:关于mysql版本问题,笔者安装的mysql5.6,安装过程中以及后面cloudera连接数据库,创建数据库时均未出现问题。】
rpm -qa | grep mysql
rpm -qa | grep mariadb
rpm -e --nodeps #后面跟上面2条命令查询到的所有包,包之间用空格键隔开
wget http://repo.mysql.com/mysql57-community-release-el6-8.noarch.rpm #下载yum源文件rpm -Uvh mysql57-community-release-el6-8.noarch.rpm#修改yum源文件:vim /etc/yum.repos.d/mysql-community.repo[mysql56-community]enabled=1gpgcheck=1[mysql57-community]enabled=0gpgcheck=1vim /etc/yum.repos.d/mysql-community-source.repo[mysql56-community-source]enabled=1 gpgcheck=1[mysql-tools-preview-source]name=MySQL Tools Preview - Sourcebaseurl=http://repo.mysql.com/yum/mysql-tools-preview/el/6/SRPMSenabled=1 gpgcheck=1
yum repolist all | grep mysql #用yum repolist mysql这个命令查看一下是否已经有mysql可安装文件yum -y install mysql-community-server #yum安装mysql, 一直yes下去
service mysqld start
service mysqld status
mysql刚安装完,mysql的root用户的密码默认是空的,需要给root用户设置密码密码,执行下列命令进行安全设置
mysql_secure_installation #输入当前用户:回车,输入root密码:######
mysql -uroot -p #进入MySQL数据库create database amon DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
create database rman DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
create database metastore DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
create database sentry DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
create database nav DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
create database navms DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
create database hive DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
create database hue DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
create database monitor DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
create database oozie DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
grant all on *.* to 'root'@'%' identified by '*****' with grant option;
4.服务器配置
hostnamectl set-hostname node0vim /etc/hosts
10.0.1.71 node1
10.0.1.72 node2
10.0.1.73 node3
hostnamectl set-hostname node1
略
hostnamectl set-hostname node2
hostnamectl set-hostname node3
在这里插入代码片
sed -i "s|SELINUX=enforcing|SELINUX=disabled|g" /etc/selinux/config
setenforce 0
ssh-keygen
ssh-copy-id ns1 #ns1为主机名
ssh-copy-id ns2
ssh-copy-id ns3
【注:CDH 要求使用 IPv4,不支持IPv6,如不禁用,通信可能产生问题,进而各个进程可能挂掉,以及出现超时等问题】
echo "alias net-pf-10 off" >> /etc/modprobe.d/dist.conf
echo "alias ipv6 off" >> /etc/modprobe.d/dist.conf
【注:安装完CDH后,CDH Manager一般会提示用户需要做一些Linux系统层面的优化,主要包括两类:禁止透明大页面及交换分区设置。若启用“透明大页面”,可能会导致重大的性能问题。】
echo never > /sys/kernel/mm/transparent_hugepage/defragecho 'echo never > /sys/kernel/mm/transparent_hugepage/defrag' >> /etc/rc.local
【注:Cloudera 建议将 /proc/sys/vm/swappiness 设置为 0,修改swap空间的swappiness,降低对硬盘的缓存。】
sysctl vm.swappiness=0 #修改swappiness值为0
cat /proc/sys/vm/swappiness #验证vi /etc/sysctl.conf #为保证重启有效,在文件中添加下面一行
vm.swappiness=0
yum -y install chkconfig bind-utils psmisc libxslt zlib sqlite cyrus-sasl-plain cyrus-sasl-gssapi fuse portmap fuse-libs redhat-lsb httpd httpd-tools unzip ntp
systemctl start httpd.service
systemctl enable httpd.service #设置为开机启动
启动NTP服务,设置三台机器时间同步
systemctl restart ntpd
systemctl enable ntpd.service #设置为开机启动
【注:http服务开机自启动有效,但ntp服务开机自启动无效,所以重新开机可能需要手动开启ntp服务。出现这个问题的原因可能是服务chronyd未被禁用,导致ntp即使配置了也无法实现开机启动,但笔者尝试了这种方法,还是没有生效,这个问题待解决。】
在主机ns1上修改本地硬件时钟时间:
hwclock --localtime #查看本地硬件时钟时间
hwclock --localtime -w #将系统时间写入本地硬件时钟时间vim /etc/ntp.conf
在文件中找到这一行,放开restrict的注释,并且修改ip地址:
# Hosts on local network are less restricted.
restrict 10.0.1.0 mask 255.255.255.0 nomodify notrap
找到这一行,注释下面的server:
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
#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 # local clock
fudge 127.127.1.0 stratum 10
(1)关闭所有节点上 ntp 服务和自启动
systemctl stop ntpd
[node1 ~]$ sudo systemctl disable ntpd
[node2 ~]$ sudo systemctl stop ntpd
[node3 ~]$ sudo systemctl disable ntpd
(2)在其他机器配置 1 分钟与时间服务器同步一次
[all ~]$ sudo crontab -e
编写定时任务如下:
*/1 * * * * /usr/sbin/ntpdate 10.0.1.70
(3)修改任意机器时间
[leokadia@hadoop103 ~]$ sudo date -s "2021-9-11 11:11:11"
(4)1 分钟后查看机器是否与时间服务器同步
date
5.安装Mysql
Mysql 下载地址:https://pan.baidu.com/s/1oaWnAi9J2swKnViAnF0cKQ 提取码:164h
此处先把mysql-connector-java-5.1.47.jar传到每台服务器的/usr/share/java(如果目录不存在需要先创建)目录下,并更名为mysql-connector-java.jar,如果不更名后面会报错
输入tar -zxvf mysql-5.7.11-linux-glibc2.5-x86_64.tar.gz -C /usr/local/mysql回车解压(注意-C需要大写)
mkdir mysql/arch mysql/data mysql/tmp
useradd mysql
chown -R mysql.mysql /usr/local/mysql
yum -y install perl perl-devel
vim /etc/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
cd /usr/local/mysql
#将服务文件拷贝到init.d下,并重命名为mysql
cp support-files/mysql.server /etc/rc.d/init.d/mysql
#赋予可执行权限
chmod +x /etc/rc.d/init.d/mysql
#删除服务
chkconfig --del mysql
#添加服务
chkconfig --add mysql
chkconfig --level 345 mysql on
#添加快捷方式
ln -s /usr/local/mysql/bin/mysql /usr/bin/
bin/mysqld \
--defaults-file=/etc/my.cnf \
--user=mysql \
--basedir=/usr/local/mysql/ \
--datadir=/usr/local/mysql/data/ \
--initialize
在初始化时如果加上 –initial-insecure,则会创建空密码的 root@localhost 账号,否则会创建带密码的 root@localhost 账号,密码直接写在 log-error 日志文件中(在5.6版本中是放在 ~/.mysql_secret 文件里,更加隐蔽,不熟悉的话可能会无所适从)
#下面命令执行完记得敲回车
/usr/local/mysql/bin/mysqld_safe --defaults-file=/etc/my.cnf &
#启动mysql(如果上面命令没有启动mysql)
service mysql start
cat data/hostname.err |grep password
mysql -u root -p
#输入刚刚日志中的密码进入
#设置密码
set password for 'root'@'localhost'=password('root');
#配置远程可以访问
grant all privileges on *.* to 'root'@'%' identified by 'root' with grant option;
use mysql
delete from user where host!='%';
#刷新
flush privileges;
#退出
quit
mysql -u root -p
#输入修改后的密码
#scm库和权限暂时不创建,后面指定数据库,会自动创建
#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 metastore DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
CREATE DATABASE hue DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
CREATE DATABASE oozie DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
#GRANT ALL ON scm.* TO 'scm'@'%' IDENTIFIED BY 'scm';
GRANT ALL ON amon.* TO 'amon'@'%' IDENTIFIED BY 'amon';
GRANT ALL ON rman.* TO 'rman'@'%' IDENTIFIED BY 'rman';
GRANT ALL ON metastore.* TO 'hive'@'%' IDENTIFIED BY 'hive';
GRANT ALL ON hue.* TO 'hue'@'%' IDENTIFIED BY 'hue';
GRANT ALL ON oozie.* TO 'oozie'@'%' IDENTIFIED BY 'oozie';
#####注意此处再授权一个本主机名地址,不然web页面配置很容易出错
GRANT ALL ON amon.* TO 'amon'@'本主机名' IDENTIFIED BY 'amon';
#刷新源
FLUSH PRIVILEGES;
#检查权限是否正确
show grants for 'amon'@'%';
show grants for 'rman'@'%';
show grants for 'hive'@'%';
show grants for 'hue'@'%';
show grants for 'oozie'@'%';
#hive中文乱码解决
alter table COLUMNS_V2 modify column COMMENT varchar(256) character set utf8;
alter table TABLE_PARAMS modify column PARAM_VALUE varchar(4000) character set utf8;
alter table PARTITION_PARAMS modify column PARAM_VALUE varchar(4000) character set utf8;
alter table PARTITION_KEYS modify column PKEY_COMMENT varchar(4000) character set utf8;
alter table INDEX_PARAMS modify column PARAM_VALUE varchar(4000) character set utf8;
#退出
quit
#重启服务
service mysql restart
6.hadoop安装
(先看安装部分,下载需要更新yum源httpd,进入其下目录,创建cm,管理文件夹,然后通过浏览器访问管理的文件)
#更新yum源httpd
yum -y install httpd
#查看httpd状态
systemctl status httpd.service
#启动httpd
service httpd start
#配置httpd永久生效(重启生效)
chkconfig httpd on
#更新yum源yum-utils createrepo
yum -y install yum-utils createrepo
#进入yum源路径
cd /var/www/html/
#创建cm文件夹
mkdir cm
CM百度网盘地址:https://pan.baidu.com/s/1W2urUqeOPE4_cJP-IVXxGw 提取码:r1h8
CDH百度网盘地址:https://pan.baidu.com/s/13T9cHx8VVm2Xf8KxvweJWg 提取码:hnki
#在添加完需要资源后,使用工具和本地的yum源创建联系
createrepo /var/www/html/cm/
vim /etc/yum.repos.d/cloudera-manager.repo
#添加如下内容
[cloudera-manager]
name=Cloudera Manager, Version yum
baseurl=http://192.168.74.10/cm
gpgcheck=0
enabled=1
yum clean all
yum makecache
yum list | grep cloudera-manager
scp /etc/yum.repos.d/cloudera-manager.repo root@node1:/etc/yum.repos.d/scp /etc/yum.repos.d/cloudera-manager.repo root@node2:/etc/yum.repos.d/scp /etc/yum.repos.d/cloudera-manager.repo root@node3:/etc/yum.repos.d/
rpm -qa|grep java #查询目前已装的JDK
rpm -e --nodeps #后面跟上一条命令查找出来的所有包,用空格隔开 #卸载相应的JDK
或 yum remove java* # 卸载wget 10.0.1.70/cm/oracle-j2sdk1.8-1.8.0+update181-1.x86_64.rpmrpm -ivh oracle-j2sdk1.8-1.8.0+update181-1.x86_64.rpmvim /etc/profile
#添加
export JAVA_HOME=/usr/java/jdk1.8.0_181-cloudera
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jarsource /etc/profilejava
javac
yum list | grep cloudera-manager
yum -y install cloudera-manager-daemons cloudera-manager-agent cloudera-manager-server
yum list | grep cloudera-manager
yum -y install cloudera-manager-daemons cloudera-manager-agent
mkdir /usr/software
cd /usr/software
chmod +x cloudera-manager-installer.bin
cd /opt/cloudera/parcel-repo/
sha1sum CDH-6.2.0-1.cdh6.2.0.p0.967373-el7.parcel | awk '{ print $1 }' > CDH-6.2.0-1.cdh6.2.0.p0.967373-el7.parcel.sha
./cloudera-manager-installer.bin
rm -f /etc/cloudera-scm-server/db.properties
#再次执行脚本(一路yes)
./cloudera-manager-installer.bin
此处便安装完成,可以登录主机IP+7180端口登录web页面,用户名密码admin/admin,但是此处暂时不要急于登录网页并配置参数,先改掉数据库连接方式重启cloudera-scm-server后再进行配置,操作如下:
1) 执行脚本scm_prepare_database.sh#设置Cloudera Manager 数据库
/opt/cloudera/cm/schema/scm_prepare_database.sh mysql -uroot -p'root' scm scm scm
#进如mysql
mysql -uroot -proot
GRANT ALL ON scm.* TO 'scm'@'%' IDENTIFIED BY 'scm';
FLUSH PRIVILEGES;
show grants for 'scm'@'%';
quit
2) 停止ClouderaManager服务
service cloudera-scm-server stop
service cloudera-scm-server-db stop
3) 删除内嵌的默认数据库PostgreSQL的配置
rm -f /etc/cloudera-scm-server/db.mgmt.properties
4) 启动ClouderaManager服务
service cloudera-scm-server start
如果有问题查看日志
vim /var/log/cloudera-scm-server/cloudera-scm-server.log
参考https://blog.csdn.net/m0_38017084/article/details/82218559
https://blog.csdn.net/a18850765326/article/details/121693857
sed -i “s|SELINUX=enforcing|SELINUX=disabled|g” /etc/selinux/config
https://blog.csdn.net/m0_38017084/article/details/82218559
https://blog.csdn.net/qq_44737094/article/details/117393393
https://blog.csdn.net/qq_44737094/article/details/116835037
https://blog.csdn.net/a18850765326/article/details/121693857《Cloudera Hadoop大数据平台实战指南》