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>

©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 218,755评论 6 507
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 93,305评论 3 395
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 165,138评论 0 355
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 58,791评论 1 295
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 67,794评论 6 392
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 51,631评论 1 305
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 40,362评论 3 418
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 39,264评论 0 276
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 45,724评论 1 315
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 37,900评论 3 336
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 40,040评论 1 350
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 35,742评论 5 346
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 41,364评论 3 330
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 31,944评论 0 22
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 33,060评论 1 270
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 48,247评论 3 371
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 44,979评论 2 355

推荐阅读更多精彩内容

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