首页 > 其他分享 >CDH+Hive部署

CDH+Hive部署

时间:2023-04-04 13:36:20浏览次数:35  
标签:cloudera 部署 utf8 CREATE CDH Hive DEFAULT mysql --

CDH介绍:

   CDH 全称 Cloudera’s Distribution Including Apache Hadoop,是 Cloudera 公司提供的一个 Apache Hadoop 发行版。CDH 将 Hadoop 与其他十几个关键的开源项目集成,并且加入了集群自动化安装、中心化管理、集群监控、报警等功能。

Hive介绍:

   Hive是基于Hadoop的一个数据仓库工具,可以将结构化的数据文件映射为一张表,并提供类SQL查询功能。Hive处理的数据存储在HDFS,Hive分析数据底层的实现是MapReduce,执行程序运行在Yarn上。

优点

(1)操作接口采用类SQL语法,提供快速开发的能力(简单、容易上手)。
(2)避免了去写MapReduce,减少开发人员的学习成本。
(3)Hive的执行延迟比较高,因此Hive常用于数据分析,对实时性要求不高的场合。
(4)Hive优势在于处理大数据,对于处理小数据没有优势,因为Hive的执行延迟比较高
(5)Hive支持用户自定义函数,用户可以根据自己的需求来实现自己的函数。

缺点

  • Hive的HQL表达能力有限
(1)迭代式算法无法表达
(2)数据挖掘方面不擅长,由于MapReduce数据处理流程的限制,效率更高的算法却无法实现。
  • Hive的效率比较低
(1)Hive自动生成的MapReduce作业,通常情况下不够智能化
(2)Hive调优比较困难

节点规划:

   Cloudera Manager Server 节点提供 WebUI 操作界面,管理 Cloudera Manager Agent 节点,在运行 Agent 的机器上部署大数据相关组件。

IP地址 主机名 角色 硬件配置 操作系统
192.168.11.160 hadoop1 Server,Agent 8C+16G+500G CentOS7.6
192.168.11.161 hadoop2 Agent 8C+16G+500G CentOS7.6
192.168.11.162 hadoop3 mysql+Agent 8C+16G+500G CentOS7.6

版本信息:

   JDK:1.8.0

   Mysql:8.0.22

   Cloudera-Manager:6.3.1

   Hadoop:3.0.0

   Hive:2.1.1

   Hue:4.3.0

   Zookeeper:3.4.5

   Kafka:2.2.1

将所有所需程序包上传至服务器

环境准备:

1.设置主机名并添加到/etc/hosts文件内

hostnamectl set-hostname hadoop1
hostnamectl set-hostname hadoop2
hostnamectl set-hostname hadoop3

2.设置SSH免密登录

ssh-keygen -t rsa
然后敲(三个回车),就会生成两个文件id_rsa(私钥)、id_rsa.pub(公钥)*

将公钥拷贝到要免密登录的目标机器上

ssh-copy-id hadoop1
ssh-copy-id hadoop2
ssh-copy-id hadoop3

3.关闭防火墙

systemctl status firewalld
systemctl stop firewalld
systemctl enable firewalld

4.安装JDK(重要)

# 安装jdk
rpm -ivh oracle-j2sdk1.8-1.8.0+update181-1.x86_64.rpm 
# 添加环境变量
echo '# jdk' >> /etc/profile
echo 'export JAVA_HOME=/usr/java/jdk1.8.0_181-cloudera' >> /etc/profile
echo 'export CLASSPATH=.:$CLASSPATH:$JAVA_HOME/lib' >> /etc/profile
echo 'export PATH=$PATH:$JAVA_HOME/bin' >> /etc/profile
# 加载环境变量
source /etc/profile
java -version

5.安装MySQL

5.1查看MySQL是否安装
rpm -qa|grep mysql
# mysql-libs-5.1.73-7.el6.x86_64
5.2若有安装将其卸载
rpm -e --nodeps mysql-libs-5.1.73-7.el6.x86_64
删除原有MySql依赖(也适用安装出错干掉原来的) 
yum remove mysql-libs
5.3安装mysql初始化数据

5.3.1上传rpm包并安装(8.0或者5.7)

ls
# mysql-community-client-8.0.22-1.el7.x86_64.rpm
# mysql-community-client-plugins-8.0.22-1.el7.x86_64.rpm
# mysql-community-common-8.0.22-1.el7.x86_64.rpm
# mysql-community-libs-8.0.22-1.el7.x86_64.rpm
# mysql-community-libs-compat-8.0.22-1.el7.x86_64.rpm
# mysql-community-server-8.0.22-1.el7.x86_64.rpm

yum localinstall *.rpm -y

5.3.2修改配置文件/etc/my.cnf

[mysqld]
datadir=/var/lib/mysql/data/
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:
#lower_case_table_names=1
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/binlog/mysql-bin
#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=11
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]
prompt=mysql5729_db01 [\\d]>
sql_mode=STRICT_ALL_TABLES
socket=/var/lib/mysql/mysql.sock

5.3.3初始化mysql,初始化完成后注意查看密码

mysqld --defaults-file=/etc/my.cnf --initialize

# 设置忽略大小写,mysql8.0需要在初始化时设置(安装cdh不需要忽略)
mysqld --defaults-file=/etc/my.cnf --initialize --lower-case-table-names=1

5.3.4初始化后修改密码(以下方式选用一个)

set password='Root@123';
FLUSH PRIVILEGES;

# 或者
alter user 'root'@'%' identified with mysql_native_password by '密码';
UPDATE user SET Password=PASSWORD('root@123') where USER='root';

-- 8.0版本直接mysql -uroot -p连接
UPDATE user SET authentication_string=PASSWORD('root@123') where USER='root';
alter user 'boer'@'%'  IDENTIFIED BY 'Boer@123';  
alter user 'root'@'localhost' IDENTIFIED BY 'Root@123'; 
FLUSH PRIVILEGES;

更改权限(以下方式选用一个)

-- Mysql默认不允许远程登录,所以需要开启远程访问权限
update user set host = '%' where user = 'root';	
FLUSH PRIVILEGES;

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'Root@123' WITH GRANT OPTION;
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION; 
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION; 
FLUSH PRIVILEGES;

6.创建相关数据库

6.1mysql5.7
-- mysql5.7
-- scm
CREATE DATABASE scm DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
GRANT ALL ON scm.* TO 'scm'@'%' IDENTIFIED BY 'Scm@147258';

-- amon
CREATE DATABASE amon DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
GRANT ALL ON amon.* TO 'amon'@'%' IDENTIFIED BY 'Amon@147258';

-- rman
CREATE DATABASE rman DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
GRANT ALL ON rman.* TO 'rman'@'%' IDENTIFIED BY 'Rman@147258';

-- hue
CREATE DATABASE hue DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci; 
GRANT ALL ON hue.* TO 'hue'@'%' IDENTIFIED BY 'Hue@147258';

-- hive
CREATE DATABASE metastore DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
GRANT ALL ON metastore.* TO 'hive'@'%' IDENTIFIED BY 'Hive@147258';

-- sentry
CREATE DATABASE sentry DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;   
GRANT ALL ON sentry.* TO 'sentry'@'%' IDENTIFIED BY 'Sentry@147258';

-- nav
CREATE DATABASE nav DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;      
GRANT ALL ON nav.* TO 'nav'@'%' IDENTIFIED BY 'Nav@147258';

-- navms
CREATE DATABASE navms DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
GRANT ALL ON navms.* TO 'navms'@'%' IDENTIFIED BY 'Navms@147258';

-- oozie
CREATE DATABASE oozie DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
GRANT ALL ON oozie.* TO 'oozie'@'%' IDENTIFIED BY 'Oozie@147258';

-- flush
FLUSH PRIVILEGES;
6.2mysql8.0
-- mysql8.0
-- scm
CREATE DATABASE scm DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
CREATE USER 'scm'@'%' IDENTIFIED BY 'Scm@147258';
grant all privileges on scm.*  to 'scm'@'%' ;

-- amon
CREATE DATABASE amon DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
CREATE USER 'amon'@'%' IDENTIFIED BY 'Amon@147258';
grant all privileges on amon.*  to 'amon'@'%' ;

-- rman
CREATE DATABASE rman DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
CREATE USER 'rman'@'%' IDENTIFIED BY 'Rman@147258';
grant all privileges on rman.*  to 'rman'@'%' ;


-- hue
CREATE DATABASE hue DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci; 
CREATE USER 'hue'@'%' IDENTIFIED BY 'Hue@147258';
grant all privileges on hue.*  to 'hue'@'%' ;


-- hive
CREATE DATABASE metastore DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
CREATE USER 'hive'@'%' IDENTIFIED BY 'Hive@147258';
grant all privileges on metastore.*  to 'hive'@'%' ;


-- sentry
CREATE DATABASE sentry DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
CREATE USER 'sentry'@'%' IDENTIFIED BY 'Sentry@147258';
grant all privileges on sentry.*  to 'sentry'@'%' ;   


-- nav
CREATE DATABASE nav DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci; 
CREATE USER 'nav'@'%' IDENTIFIED BY 'Nav@147258';
grant all privileges on nav.*  to 'nav'@'%' ;     


-- navms
CREATE DATABASE navms DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
CREATE USER 'navms'@'%' IDENTIFIED BY 'Navms@147258';
grant all privileges on navms.*  to 'navms'@'%' ;


-- oozie
CREATE DATABASE oozie DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
CREATE USER 'oozie'@'%' IDENTIFIED BY 'Oozie@147258';
grant all privileges on oozie.*  to 'oozie'@'%' ;


-- flush
FLUSH PRIVILEGES;

7.上传连接mysql的jar包

ls
# mysql-connector-java-8.0.16.jar
修改其名称
cp mysql-connector-java-8.0.16.jar  /usr/share/java/mysql-connector-java.jar

8.安装 cloudera-manager

   创建cloudera-manager目录,存放cdh安装文件。解压压缩包

mkdir /opt/cloudera-manager
tar -zxvf cm6.3.1-redhat7.tar.gz
cd cm6.3.1/RPMS/x86_64/
mv cloudera-manager-agent-6.3.1-1466458.el7.x86_64.rpm /opt/cloudera-manager/
mv cloudera-manager-server-6.3.1-1466458.el7.x86_64.rpm /opt/cloudera-manager/
mv cloudera-manager-daemons-6.3.1-1466458.el7.x86_64.rpm /opt/cloudera-manager/

注:rpm安装,所有节点都安装cloudera-manager-daemons和cloudera-manager-agent

rpm -ivh cloudera-manager-daemons-6.3.1-1466458.el7.x86_64.rpm 

# 安装agent依赖
yum install bind-utils psmisc cyrus-sasl-plain cyrus-sasl-gssapi fuse portmap fuse-libs /lib/lsb/init-functions httpd mod_ssl openssl-devel python-psycopg2 MySQL-python libxslt

rpm -ivh cloudera-manager-agent-6.3.1-1466458.el7.x86_64.rpm
8.1修改agent配置文件
vim /etc/cloudera-scm-agent/config.ini

server_host=hadoop1
8.2主节点安装cloudera-manager-server
rpm -ivh cloudera-manager-server-6.3.1-1466458.el7.x86_64.rpm 
8.3修改 server的db.properties
vim /etc/cloudera-scm-server/db.properties

com.cloudera.cmf.db.type=mysql
com.cloudera.cmf.db.host=hadoop1:3306
com.cloudera.cmf.db.name=scm
com.cloudera.cmf.db.user=scm
com.cloudera.cmf.db.password=Scm@147258
com.cloudera.cmf.db.setupType=EXTERNAL
上传parcel包
ls /opt/cloudera/parcel-repo

# CDH-6.3.2-1.cdh6.3.2.p0.1605554-el7.parcel
# CDH-6.3.2-1.cdh6.3.2.p0.1605554-el7.parcel.sha
# CDH-6.3.2-1.cdh6.3.2.p0.1605554-el7.parcel.torrent
# manifest.json
8.4初始化cm库
/opt/cloudera/cm/schema/scm_prepare_database.sh mysql -h hadoop101 scm scm Scm@147258

9.启动Server与Agent

   启动主节点的Server和所有节点的Agent
启动server
service cloudera-scm-server.service start
启动Agent
systemctl start cloudera-scm-agent
启动Server查看日志,等待几分钟后无问题登录
tail -f /var/log/cloudera-scm-server/cloudera-scm-server.log

10.登录:

默认端口号:7180
默认用户名:admin
默认密码:admin

 

标签:cloudera,部署,utf8,CREATE,CDH,Hive,DEFAULT,mysql,--
From: https://www.cnblogs.com/jerry-0910/p/17286085.html

相关文章

  • ubuntu22.04 部署 Auditd
    安装Auditd#apt-yinstallauditdauditd.conf##Thisfilecontrolstheconfigurationoftheauditdaemon#local_events=yeswrite_logs=yeslog_file=/var/log/audit/audit.log#指定日志文件log_group=admlog_format=ENRICHEDflush=INCREMENTA......
  • windows本地部署redis
    1:了解自己php扩展版本,在php文件里输入phpinfo();执行看php版本,看phpExtensionBiuld的值。 2:下载redis配置文件:址:https://windows.php.net/downloads/pecl/releases/redis/点5.3.4版本里的根据phpExtensionBiuld选一个下载。 3:把下载的文件里的php_redis.dll和php_......
  • docker 部署mongoDB集群与读写分离
    一.生成key文件需要注意集群中所有机器都需要用同一个文件,否则会出现验证失败的情况#生成keyopensslrand-base64756>/data/volume/mongodb/configdb/mongo.key#设置访问权限chmod400/data/volume/mongodb/configdb/mongo.key 二.启动MongoDB的docker容器d......
  • 2-nacos运行环境部署
    1、下载nacos最新的二进制压缩包;下载地址:https://github.com/alibaba/nacos/releases 2、解压下载下来的nacos最新的二进制压缩包;tar-zxvfnacos-server-1.3.1.tar.gzcdnacos/bin3、启动nacosserver./startup.sh-mstandalone 注:单机环境必须带-mstandalone参数启动......
  • 关于 Angular 应用部署时的 base-href 参数
    import{existsSync}from'fs';server.get(['/shop/*','/shop'],(req,res)=>{res.render(indexHtml,{req,providers:[{provide:APP_BASE_HREF,useValue:req.baseUrl}],});});server.set('views',distFo......
  • XXL-JOB Linux环境部署安装实战
    一、下载XXL-JOB 下载源码: https://github.com/xuxueli/xxl-job 以2.3.0的版本为例:https://github.com/xuxueli/xxl-job/archive/refs/tags/2.3.0.tar.gz xxl-job文档: https://www.xuxueli.com/xxl-job/二、依赖环境 因为需要打包,所以要有Maven环境 因为部署的是jar......
  • 常用软件Docker部署命令
    前言我们在日常开发中经常会用到一些中间件,用docker快速部署是一个不错的选择。本帖将记录一些日常开发中用到的一些软件的docker部署命令,方便查阅。PostgreSqldockerrun--namedockerPG11-ePOSTGRES_PASSWORD=123456-p5432:5432-dpostgres:12用户名:postgres密......
  • Hive 如何巧用分布函数percent_rank()剔除极值求均值
    场景描述前期写过一篇关于剔除订单极值求订单均值的案例,之前使用的是 dense_rank 函数对订单金额进行排序后,过滤掉最大值最小值后进行处理,最近工作刚好使用到分布函数percent_rank,想起来应该也可以用到这个场景;percent_rank()简介percent_rank()函数为分布函数,用于返回某个......
  • 5G网络架构与组网部署-2
    1.35G组网部署1.3.1SA组网与NSA组网5G标准分为非独立组网(NSA)与独立组网(SA)两种。 独立组网(SA)两种方案,其中Option2为最终目标。gNB:5G基站,ng-eNB:4G增强型基站。 非独立组网(NSA)三种方案:Option3、Option7、Option4。组网是逐步演进的,由最初的4G基站逐步演进为......
  • ansible 部署mysql 5.7
    准备工作创建roles目录#mkdir-pv/data/apps/ansible/roles/mysql-5.7/{files,tasks,handlers,templates,vars}hosts[ubuntu]172.16.18.31ansible_ssh_port=22ansible_ssh_user=ubuntuhostname=app-01测试连通性#ansibleubuntu-mping172.16.18.247|SUCCESS=......