kylin的入门使用

我们kylin环境安装成功之后,我们就可以在hive当中创建数据库以及数据库表,然后通过kylin来实现数据的查询

第一步:创建hive数据库以及表并加载以下数据

<v:shapetype id="_x0000_t75" stroked="f" filled="f" path="m@4@5l@4@11@9@11@9@5xe" o:preferrelative="t" o:spt="75" coordsize="21600,21600"><v:stroke joinstyle="miter"><v:formulas></v:formulas><v:path o:connecttype="rect" gradientshapeok="t" o:extrusionok="f"></v:path></v:stroke></v:shapetype><v:shape id="_x0000_i1025" style="width:41.4pt; height:41.4pt" type="#_x0000_t75" o:ole=""><v:imagedata o:title="" src="file:///C:\Users\chenning\AppData\Local\Temp\msohtmlclip1\01\clip_image001.emz"></v:imagedata></v:shape><v:shape id="_x0000_i1026" style="width:40.8pt; height:41.4pt" type="#_x0000_t75" o:ole=""><v:imagedata o:title="" src="file:///C:\Users\chenning\AppData\Local\Temp\msohtmlclip1\01\clip_image002.emz"></v:imagedata></v:shape>

将以上两份文件上传到node03服务器的/kkb/install路径下,然后执行以下命令,创建hive数据库以及数据库表,并加载数据

cd /kkb/install/hive-1.1.0-cdh5.14.2/

bin/beeline

创建数据库并使用该数据库

create database kylin_hive;

use kylin_hive;

(1)创建部门表

create external table if not exists kylin_hive.dept(

deptno int,

dname string,

loc int )

row format delimited fields terminated by '\t';

(2)创建员工表

create external table if not exists kylin_hive.emp(

empno int,

ename string,

job string,

mgr int,

hiredate string,

sal double,

comm double,

deptno int)

row format delimited fields terminated by '\t';

(3)查看创建的表

jdbc:hive2://node03:10000> show tables;

OK

tab_name

dept

emp

(4)向外部表中导入数据导入数据

load data local inpath '/kkb/install/dept.txt' into table kylin_hive.dept;

load data local inpath '/kkb/install/emp.txt' into table kylin_hive.emp;

查询结果

jdbc:hive2://node03:10000> select * from emp;

jdbc:hive2://node03:10000> select * from dept;

第二步:访问kylin浏览器界面,并创建project

直接在浏览器界面访问

http://node02:8066/kylin/login 并登录kylin,用户名 ADMIN,密码KYLIN

点击页面 + 号,来创建工程

<v:shape id="图片_x0020_32" style="width:437.4pt;height:187.8pt; visibility:visible;mso-wrap-style:square" type="#_x0000_t75" o:spid="_x0000_i1049"><v:imagedata o:title="" src="file:///C:\Users\chenning\AppData\Local\Temp\msohtmlclip1\01\clip_image003.png"></v:imagedata></v:shape>

输入工程名称以及工程描述

<v:shape id="图片_x0020_42" style="width:437.4pt;height:141.6pt; visibility:visible;mso-wrap-style:square" type="#_x0000_t75" o:spid="_x0000_i1048"><v:imagedata o:title="" src="file:///C:\Users\chenning\AppData\Local\Temp\msohtmlclip1\01\clip_image004.png"></v:imagedata></v:shape>

为工程添加数据源

<v:shape id="图片_x0020_43" style="width:437.4pt;height:168.6pt; visibility:visible;mso-wrap-style:square" type="#_x0000_t75" o:spid="_x0000_i1047"><v:imagedata o:title="" src="file:///C:\Users\chenning\AppData\Local\Temp\msohtmlclip1\01\clip_image005.png"></v:imagedata></v:shape>

添加数据源表

<v:shape id="图片_x0020_45" style="width:436.8pt;height:102pt; visibility:visible;mso-wrap-style:square" type="#_x0000_t75" o:spid="_x0000_i1046"><v:imagedata o:title="" src="file:///C:\Users\chenning\AppData\Local\Temp\msohtmlclip1\01\clip_image006.png"></v:imagedata></v:shape>

第三步:为kylin添加models

1、回到models页面

<v:shape id="图片_x0020_47" style="width:437.4pt;height:190.8pt; visibility:visible;mso-wrap-style:square" type="#_x0000_t75" o:spid="_x0000_i1045"><v:imagedata o:title="" src="file:///C:\Users\chenning\AppData\Local\Temp\msohtmlclip1\01\clip_image007.png"></v:imagedata></v:shape>

2、添加new models

<v:shape id="图片_x0020_67" style="width:437.4pt;height:259.2pt; visibility:visible;mso-wrap-style:square" type="#_x0000_t75" o:spid="_x0000_i1044"><v:imagedata o:title="" src="file:///C:\Users\chenning\AppData\Local\Temp\msohtmlclip1\01\clip_image008.png"></v:imagedata></v:shape>

3、填写model name之后,继续下一步

<v:shape id="图片_x0020_68" style="width:438pt;height:108pt; visibility:visible;mso-wrap-style:square" type="#_x0000_t75" o:spid="_x0000_i1043"><v:imagedata o:title="" src="file:///C:\Users\chenning\AppData\Local\Temp\msohtmlclip1\01\clip_image009.png"></v:imagedata></v:shape>

4、选择事实表

这里就选择emp作为事实表

<v:shape id="图片_x0020_69" style="width:436.8pt;height:106.2pt; visibility:visible;mso-wrap-style:square" type="#_x0000_t75" o:spid="_x0000_i1042"><v:imagedata o:title="" src="file:///C:\Users\chenning\AppData\Local\Temp\msohtmlclip1\01\clip_image010.png"></v:imagedata></v:shape>

5、添加维度表

添加我们的DEPT作为维度表,并选择我们的join方式,以及join连接字段

<v:shape id="图片_x0020_71" style="width:433.2pt;height:107.4pt; visibility:visible;mso-wrap-style:square" type="#_x0000_t75" o:spid="_x0000_i1041"><v:imagedata o:title="" src="file:///C:\Users\chenning\AppData\Local\Temp\msohtmlclip1\01\clip_image011.png"></v:imagedata></v:shape>

<v:shape id="图片_x0020_70" style="width:438pt;height:160.2pt; visibility:visible;mso-wrap-style:square" type="#_x0000_t75" o:spid="_x0000_i1040"><v:imagedata o:title="" src="file:///C:\Users\chenning\AppData\Local\Temp\msohtmlclip1\01\clip_image012.png"></v:imagedata></v:shape>

6、选择聚合维度信息

<v:shape id="图片_x0020_72" style="width:436.8pt;height:124.8pt; visibility:visible;mso-wrap-style:square" type="#_x0000_t75" o:spid="_x0000_i1039"><v:imagedata o:title="" src="file:///C:\Users\chenning\AppData\Local\Temp\msohtmlclip1\01\clip_image013.png"></v:imagedata></v:shape>

7、选择度量信息

<v:shape id="图片_x0020_73" style="width:436.8pt;height:124.8pt; visibility:visible;mso-wrap-style:square" type="#_x0000_t75" o:spid="_x0000_i1038"><v:imagedata o:title="" src="file:///C:\Users\chenning\AppData\Local\Temp\msohtmlclip1\01\clip_image014.png"></v:imagedata></v:shape>

8、添加分区信息及过滤条件之后“Save”

<v:shape id="图片_x0020_74" style="width:437.4pt;height:186.6pt; visibility:visible;mso-wrap-style:square" type="#_x0000_t75" o:spid="_x0000_i1037"><v:imagedata o:title="" src="file:///C:\Users\chenning\AppData\Local\Temp\msohtmlclip1\01\clip_image015.png"></v:imagedata></v:shape>

第四步:通过kylin来构建cube

前面我们已经创建了project和我们的models,接下来我们就来构建我们的cube

1、页面添加,创建一个new cube

<v:shape id="图片_x0020_75" style="width:438pt;height:175.8pt; visibility:visible;mso-wrap-style:square" type="#_x0000_t75" o:spid="_x0000_i1036"><v:imagedata o:title="" src="file:///C:\Users\chenning\AppData\Local\Temp\msohtmlclip1\01\clip_image016.png"></v:imagedata></v:shape>

2、选择我们的model以及cube name

<v:shape id="图片_x0020_76" style="width:436.8pt;height:147.6pt; visibility:visible;mso-wrap-style:square" type="#_x0000_t75" o:spid="_x0000_i1035"><v:imagedata o:title="" src="file:///C:\Users\chenning\AppData\Local\Temp\msohtmlclip1\01\clip_image017.png"></v:imagedata></v:shape>

3、添加我们的自定义维度

<v:shape id="图片_x0020_77" style="width:437.4pt;height:96pt; visibility:visible;mso-wrap-style:square" type="#_x0000_t75" o:spid="_x0000_i1034"><v:imagedata o:title="" src="file:///C:\Users\chenning\AppData\Local\Temp\msohtmlclip1\01\clip_image018.png"></v:imagedata></v:shape>

<v:shape id="图片_x0020_79" style="width:438pt;height:204pt; visibility:visible;mso-wrap-style:square" type="#_x0000_t75" o:spid="_x0000_i1033"><v:imagedata o:title="" src="file:///C:\Users\chenning\AppData\Local\Temp\msohtmlclip1\01\clip_image019.png"></v:imagedata></v:shape>

4、添加统计维度

<v:shape id="图片_x0020_44" style="width:436.8pt;height:169.8pt; visibility:visible;mso-wrap-style:square" type="#_x0000_t75" o:spid="_x0000_i1032"><v:imagedata o:title="" src="file:///C:\Users\chenning\AppData\Local\Temp\msohtmlclip1\01\clip_image020.png"></v:imagedata></v:shape>

<v:shape id="图片_x0020_78" style="width:437.4pt;height:214.8pt; visibility:visible;mso-wrap-style:square" type="#_x0000_t75" o:spid="_x0000_i1031"><v:imagedata o:title="" src="file:///C:\Users\chenning\AppData\Local\Temp\msohtmlclip1\01\clip_image021.png"></v:imagedata></v:shape>

5、设置多个分区cube合并信息

因为我们这里是全量统计,不涉及多个分区cube进行合并,所以不用设置历史多个cube进行合并

<v:shape id="图片_x0020_80" style="width:437.4pt;height:221.4pt; visibility:visible;mso-wrap-style:square" type="#_x0000_t75" o:spid="_x0000_i1030"><v:imagedata o:title="" src="file:///C:\Users\chenning\AppData\Local\Temp\msohtmlclip1\01\clip_image022.png"></v:imagedata></v:shape>

6、高级设置

高级设置我们这里暂时也不做任何设置,后续再单独详细讲解

<v:shape id="图片_x0020_81" style="width:376.8pt;height:655.2pt; visibility:visible;mso-wrap-style:square" type="#_x0000_t75" o:spid="_x0000_i1029"><v:imagedata o:title="" src="file:///C:\Users\chenning\AppData\Local\Temp\msohtmlclip1\01\clip_image023.png"></v:imagedata></v:shape>

7、额外的其他的配置属性,这里也暂时不做配置

<v:shape id="图片_x0020_82" style="width:438pt;height:153.6pt; visibility:visible;mso-wrap-style:square" type="#_x0000_t75" o:spid="_x0000_i1028"><v:imagedata o:title="" src="file:///C:\Users\chenning\AppData\Local\Temp\msohtmlclip1\01\clip_image024.png"></v:imagedata></v:shape>

8、完成,保存配置

<v:shape id="图片_x0020_83" style="width:437.4pt;height:174.6pt; visibility:visible;mso-wrap-style:square" type="#_x0000_t75" o:spid="_x0000_i1027"><v:imagedata o:title="" src="file:///C:\Users\chenning\AppData\Local\Temp\msohtmlclip1\01\clip_image025.png"></v:imagedata></v:shape>

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • CentOS 7.2安装手册 一、系统安装 1. 系统引导 (1)成功引导系统后,会出现下面的界面 <v:shap...
    全宇宙最帅De男人阅读 783评论 0 1
  • ORACLE安装 安装包: 1.VMware-workstation-full-11.1.0-2496824.ex...
    longfou阅读 415评论 0 0
  • 后期整理字体以及排版问题,修订不适合的翻译 “A wealth of information. Smart, ye...
    iamzzz阅读 767评论 0 0
  • python****网络编程常用库使用手册 一、urllib3 ** Urllib3****是一个功能强大,条理清...
    奕剑听雨阅读 229评论 0 0
  • 1、数据仓库、OLAP 与 BI 数据仓库 数据仓库,英文名称 Data Warehouse,简称 DW。《数据仓...
    我还不够强阅读 248评论 0 1