CentOS7.2 离线安装部署 Cloudera Manager 6.3.1

it2023-02-03  47

1、概述

1.1、简介

Cloudera Manager(简称CM)是Cloudera公司开发的一款大数据集群安装部署利器,这款利器具有集群自动化安装、中心化管理、集群监控、报警等功能,使得安装集群从几天的时间缩短在几小时以内,运维人员从数十人降低到几人以内,极大的提高集群管理的效率。

CDH (Cloudera’s Distribution, including Apache Hadoop),是Hadoop众多分支中的一种,由Cloudera维护,基于稳定版本的Apache Hadoop构建,并集成了很多补丁,可直接用于生产环境。

1.2、安装环境

主机名操作系统角色IP地址cm01CentOS 7.2 64位主节点192.168.0.201cm02CentOS 7.2 64位从节点192.168.0.202cm03CentOS 7.2 64位从节点192.168.0.203

1.3、官网教程

文档地址:官网安装教程

2、安装包准备

2.1、下载 CM 安装包

下载地址:CM 安装包下载

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-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-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

另外需要下载 allkeys.asc

https://archive.cloudera.com/cm6/6.3.1/allkeys.asc

2.2、下载 CDH 安装包

下载地址:CDH 安装包下载

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-el7.parcel.sha1 https://archive.cloudera.com/cdh6/6.3.2/parcels/CDH-6.3.2-1.cdh6.3.2.p0.1605554-el7.parcel.sha256 https://archive.cloudera.com/cdh6/6.3.2/parcels/manifest.json

2.3、下载 MySQL JDBC Driver

注意:默认位置 /usr/share/java/ ,默认驱动名 mysql-connector-java.jar

# 创建文件夹 mkdir -p /usr/share/java/ # 进入 MySQL 驱动文件目录 cd /usr/share/java/ # 下载 MySQL 驱动 wget https://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-5.1.46.tar.gz # -bash: wget: 未找到命令 yum -y install wget # 解压压缩包 tar zxvf mysql-connector-java-5.1.46.tar.gz # 复制并且重命名 cp /usr/share/java/mysql-connector-java-5.1.46/mysql-connector-java-5.1.46-bin.jar /usr/share/java/mysql-connector-java.jar

2、安装前环境配置

2.1、配置静态 IP 地址

# 查看当前 IP 信息 ip addr # 编辑文件 vi /etc/sysconfig/network-scripts/ifcfg-enp2s0 # 将动态获取 IP 改为 静态获取 BOOTPROTO="dhcp" 改为 BOOTPROTO="static" # 复制以下内容 #IP地址 IPADDR0=10.0.0.1 #子网掩码 PREFIX0=24 #网关地址 GATEWAY0=10.0.0.254 DNS1=8.8.8.8 # 重启网络服务 systemctl restart network

2.2、修改主机名称

# 所有机器都需要修改主机名称 hostnamectl set-hostname woniu

2.3、配置主机名跟 IP 地址映射

# 所有机器都需编辑 hosts 文件 vi /etc/hosts # 添加如下内容 10.0.0.1 woniu 10.0.0.2 woniu1 10.0.0.3 woniu2

2.4、关闭防火墙

# 所有机器都需要关闭防火墙 systemctl stop firewalld.service # 禁止开机启动 systemctl disable firewalld.service

2.5、设置 selinux

# 临时关闭 selinux setenforce 0 # 永久关闭 selinux sed -i "s/^SELINUX=enforcing/SELINUX=disabled/g" /etc/selinux/config

2.6、设置 SSH 免密码登录

# 生成秘钥,无需指定口令密码,直接回车 ssh-keygen -t rsa # 将公钥导入到认证文件 cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys # 认证文件合并,输入 yes 回车再输入服务器密码 ssh-copy-id -i ~/.ssh/id_rsa.pub root@woniu1 ssh-copy-id -i ~/.ssh/id_rsa.pub root@woniu2

2.7、部署 NTP 服务器进行时间同步

参考文章:CentOS7 部署 NTP 服务器进行时间同步

先省略,后补

2.8、安装 JDK8

下载地址:https://www.oracle.com/technetwork/java/javase/archive-139210.html

# 创建文件夹 mkdir -p /usr/java/ # 上传 JDK8 压缩文件 # 解压 tar -zxvf jdk-8u131-linux-x64.tar.gz # 配置当前用户环境变量 vi /etc/profile # 在文件中添加如下命令,记得切换自己文件路径 export JAVA_HOME=/usr/java/jdk1.8.0_131 export PATH=$JAVA_HOME/bin:$PATH # 立即生效 source /etc/profile # 同步java文件夹到其它服务器 scp -r /usr/java root@cm02:/usr/ scp -r /usr/java root@cm03:/usr/ #同步/etc/profile文件 scp /etc/profile root@cm02:/etc/profile scp /etc/profile root@cm03:/etc/profile # 立即生效 source /etc/profile

3、Cloudera Manager 安装

3.1、配置本地 Cloudera Manager 仓库

# 创建本地 CM 仓库文件夹 mkdir -p /var/www/html/cloudera-repos/cm6/ # 上传下载好的 CM 安装包放入 /var/www/html/cloudera-repos/cm6/ 目录 # 安装 httpd 和 createrepo yum -y install httpd createrepo # 启动 httpd 服务并设置为开机自启动 systemctl start httpd && systemctl enable httpd # 生成 RPM,注意最后必须有 . cd /var/www/html/cloudera-repos/cm6/ && createrepo . # 通过浏览器访问了:默认端口 80 http://cm01/cloudera-repos/cm6/

3.2、配置本地 CDH 仓库

# 创建本地 CDH 仓库文件夹 mkdir -p /var/www/html/cloudera-repos/cdh6/ # 上传下载好的 CDH 安装包放入 /var/www/html/cloudera-repos/cdh6/ 目录 # 生成 RPM,注意最后必须有 . cd /var/www/html/cloudera-repos/cdh6/ && createrepo . # 通过浏览器访问了:默认端口80 http://cm01/cloudera-repos/cdh6/

3.3、构建 yum 源(所有服务器上都操作)

# 所有机器都需要配置 vi /etc/yum.repos.d/cloudera-repo.repo # 拷贝如下内容 [cloudera-repo] name=cloudera-repo baseurl=http://cm01/cloudera-repos/cm6/ enabled=1 gpgcheck=0 # 清理 yum clean all yum makecache

3.4、MySQL安装

1、参考地址:官网 MySQL 安装教程

# 创建 mysql 文件夹 mkdir -p /var/www/html/cloudera-repos/mysql5/ # 进入目录 cd /var/www/html/cloudera-repos/mysql5/ # 下载 wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm rpm -ivh mysql-community-release-el7-5.noarch.rpm # 更新 yum update # 安装 mysql yum install mysql-server # 启动 mysql systemctl start mysqld # 开机自启动 systemctl enable mysqld

2、初始化数据库

# 初始化数据库 /usr/bin/mysql_secure_installation

[root@cm01 mysql5]# /usr/bin/mysql_secure_installation NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY! In order to log into MySQL to secure it, we'll need the current password for the root user. If you've just installed MySQL, and you haven't set the root password yet, the password will be blank, so you should just press enter here. Enter current password for root (enter for none): OK, successfully used password, moving on... Setting the root password ensures that nobody can log into the MySQL root user without the proper authorisation. Set root password? [Y/n] Y New password: Re-enter new password: Password updated successfully! Reloading privilege tables.. ... Success! By default, a MySQL installation has an anonymous user, allowing anyone to log into MySQL without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment. Remove anonymous users? [Y/n] Y ... Success! Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network. Disallow root login remotely? [Y/n] n ... skipping. By default, MySQL comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment. Remove test database and access to it? [Y/n] Y - Dropping test database... ERROR 1008 (HY000) at line 1: Can't drop database 'test'; database doesn't exist ... Failed! Not critical, keep moving... - Removing privileges on test database... ... Success! Reloading the privilege tables will ensure that all changes made so far will take effect immediately. Reload privilege tables now? [Y/n] Y ... Success! All done! If you've completed all of the above steps, your MySQL installation should now be secure. Thanks for using MySQL! Cleaning up... [root@cm01 mysql5]#

3、备份数据库配置文件

cp /etc/my.cnf{,.bak}

4、官网推荐配置

[mysqld] datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock transaction-isolation = READ-COMMITTED # Disabling symbolic-links is recommended to prevent assorted security risks; # to do so, uncomment this line: symbolic-links = 0 key_buffer_size = 32M max_allowed_packet = 32M thread_stack = 256K thread_cache_size = 64 query_cache_limit = 8M query_cache_size = 64M query_cache_type = 1 max_connections = 550 #expire_logs_days = 10 #max_binlog_size = 100M #log_bin should be on a disk with enough free space. #Replace '/var/lib/mysql/mysql_binary_log' with an appropriate path for your #system and chown the specified folder to the mysql user. log_bin=/var/lib/mysql/mysql_binary_log #In later versions of MySQL, if you enable the binary log and do not set #a server_id, MySQL will not start. The server_id must be unique within #the replicating group. server_id=1 binlog_format = mixed read_buffer_size = 2M read_rnd_buffer_size = 16M sort_buffer_size = 8M join_buffer_size = 8M # InnoDB settings innodb_file_per_table = 1 innodb_flush_log_at_trx_commit = 2 innodb_log_buffer_size = 64M innodb_buffer_pool_size = 4G innodb_thread_concurrency = 8 innodb_flush_method = O_DIRECT innodb_log_file_size = 512M [mysqld_safe] log-error=/var/log/mysqld.log pid-file=/var/run/mysqld/mysqld.pid sql_mode=STRICT_ALL_TABLES

6、创建数据库

ServiceDatabaseUserCloudera Manager ServerscmscmActivity MonitoramonamonReports ManagerrmanrmanHuehuehueHive Metastore ServermetastorehiveSentry ServersentrysentryCloudera Navigator Audit ServernavnavCloudera Navigator Metadata ServernavmsnavmsOozieoozieoozie # 登录 MySQL 数据库 mysql -uroot -p # 初始化 CREATE DATABASE scm DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci; GRANT ALL ON scm.* TO 'scm'@'%' IDENTIFIED BY 'scm@123'; CREATE DATABASE amon DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci; GRANT ALL ON amon.* TO 'amon'@'%' IDENTIFIED BY 'amon@123'; CREATE DATABASE rman DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci; GRANT ALL ON rman.* TO 'rman'@'%' IDENTIFIED BY 'rman@123'; CREATE DATABASE hue DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci; GRANT ALL ON hue.* TO 'hue'@'%' IDENTIFIED BY 'hue@123'; CREATE DATABASE metastore DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci; GRANT ALL ON metastore.* TO 'metastore'@'%' IDENTIFIED BY 'metastore@123'; CREATE DATABASE sentry DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci; GRANT ALL ON sentry.* TO 'sentry'@'%' IDENTIFIED BY 'sentry@123'; CREATE DATABASE nav DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci; GRANT ALL ON nav.* TO 'nav'@'%' IDENTIFIED BY 'nav@123'; CREATE DATABASE navms DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci; GRANT ALL ON navms.* TO 'navms'@'%' IDENTIFIED BY 'navms@123'; CREATE DATABASE oozie DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci; GRANT ALL ON oozie.* TO 'oozie'@'%' IDENTIFIED BY 'oozie@123'; flush privileges; # 删除 drop database scm; drop database amon; drop database rman; drop database hue; drop database metastore; drop database sentry; drop database nav; drop database navms; drop database oozie; flush privileges; #开放mysql远程权限 GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION; FLUSH PRIVILEGES;

3.5、安装 CM Server 和 Agent

主节点

yum install cloudera-manager-daemons cloudera-manager-agent cloudera-manager-server

所有从节点

yum install cloudera-manager-daemons cloudera-manager-agent

3.6、建立CM的数据库

参考文档:官网创建 CM 数据库教程

/opt/cloudera/cm/schema/scm_prepare_database.sh mysql scm scm

3.7、启动 CM Server

# 启动服务 systemctl start cloudera-scm-server # 查看服务的状态 systemctl status cloudera-scm-server # 查看系统日志 journalctl -xe # 默认日志存放地方 /var/log/cloudera-scm-server

3.8、访问服务

# 需要等几分钟 不要慌 http://woniu:7180

4、CDH优化

4.1、禁用透明大页面压缩

echo never>/sys/kernel/mm/transparent_hugepage/defrag echo never>/sys/kernel/mm/transparent_hugepage/enabled

4.2、虚拟内存设置

# 查看虚拟内存需求率 默认60 cat /proc/sys/vm/swappiness # Cloudera 建议将 vm.swappiness 修改为 0 sysctl -w vm.swappiness=0 echo "vm.swappiness = 0" >> /etc/sysctl.conf

5、Cloudera Manager 初始化集群配置

5.1、用户登录

用户名:admin ,密码:admin

5.2、选择版本

1、欢迎页面

2、接受最终用户许可条款和条件。

3、选择免费版本

5.3、群集安装

1、欢迎页面

2、群集名称

3、扫描主机,输入主机名称点击搜索

4、选择存储库

自定义存储库:http://woniu/cloudera-repos/cm6/

远程 Parcel 存储库 URL :http://woniu/cloudera-repos/cdh6/

保存更改

5、JDK 安装选项,跳过不需要勾选

6、提供 SSH 登录凭据

7、Install Agents ,自动安装

7、Install Parcels,自动安装

8、Inspect Cluster

先点击 Inspect Network Performance 再点击 Inspect Hosts

警告,点击 显示检查器结果

已启用透明大页面压缩,可能会导致重大性能问题。请运行“echo never > /sys/kernel/mm/transparent_hugepage/defrag”和“echo never > /sys/kernel/mm/transparent_hugepage/enabled”以禁用此设置,然后将同一命令添加到 /etc/rc.local 等初始化脚本中,以便在系统重启时予以设置

echo never>/sys/kernel/mm/transparent_hugepage/defrag echo never>/sys/kernel/mm/transparent_hugepage/enabled

点击重新运行

5.4、群集设置

1、Select Services

2、自定义角色分配

3、数据库设置

Databases for Cloudera Software 参考如下

 点击测试连接

4、审核更改,默认设置

5、命令详细信息

6、汇总

最新回复(0)