本文主要介绍 Hue 的实践用法。
Hue 的 beeswax App 提供了友好方便的 Hive 查询功能,可以选择不同的 Hive 数据库、编写 HQL 语句、提交查询任务、查看结果。
使用 Hbase Browser 可以查询、修改、展示 Hbase 集群中表的数据。
通过 Hue 的 Web 页面可方便查看 HDFS 中的文件和文件夹,并对其进行创建、下载、上传、复制、修改和删除等操作。
create database if not exists hive_sample;
show databases;
use hive_sample;
show tables;
create table if not exists hive_sample (a int, b string);
show tables;
insert into hive_sample select 1, "a";
select * from hive_sample;
将以上内容保存为 hive_sample.sql 文件。Hive 工作流还需要一个 hive-site.xml 配置文件,此配置文件可以在集群中安装了 Hive 组件的节点上找到。具体路径:/usr/local/service/hive/conf/hive-site.xml,复制一个 hive-site.xml 文件。然后上传 Hive script 文件和 hive-site.xml 到 hdfs 的目录,例如:/user/hadoop。
注意:本文以安装 Hive 版本为 Hive1 为例,配置参数为 HiveServer1。与其他 Hive 版本混合部署时(即配置其他版本的配置参数时),会报错。
3. 选择刚上传的 Hive scipt 文件和 hive-site.xml 文件。
4. 单击 Add 后,还需在 FILES 中指定 hive script 文件。
5. 单击右上角保存,然后单击执行,运行 workflow。
创建定时调度任务。
Hue 的定时调度任务是 schedule,类似于 Linux 的 crontab,支持的调度粒度可以到分钟级别。
创建定时调度任务。
notebook 可以快速的构建间的查询,将查询结果放到一起做对比分析,支持5种类型:hive,impala,spark,java,shell。
本页内容是否解决了您的问题?