在cdh5.14.4安装完成并排错完成的情况下,进行如下kylin安装操作:
1、实验环境
三台CentOS 7主机,IP地址
- 192.168.43.129 cm1
- 192.168.43.130 cm2
- 192.168.43.131 cm3
JDK版本:1.8.0_151
CDH版本:5.14.4
Kylin版本:2.4.1
Mysql版本:5.6.34
mysql-connector版本:mysql-connector-java-5.1.40
2、kylin下载
https://archive.apache.org/dist/kylin/
从这里下载需要的kylin版本
3. 创建目录
mkdir /usr/local/apps
cd /usr/local/apps
4. 上传并解压/usr/local/apps目录:
[root@cm1 apps]# tar -zxf apache-kylin-2.4.1-cdh57-bin.tar.gz
5. 建立软连接
[root@cm1 apps]# ln -s apache-kylin-2.4.1-cdh57-bin kylin
6. 添加环境变量
vim /etc/profile
添加 :export KYLIN_HOME=/usr/local/apps/kylin
7. 环境变量生效
[root@cm1 apps]# source /etc/profile
8. 修改kylin.properties配置文件
cd /usr/local/apps/kylin/conf
vim kylin.properties
修改:
kylin.server.cluster-servers=192.168.43.129:7070
添加配置:
kylin.job.jar=/usr/local/apps/kylin/lib/kylin-job-2.4.1.jar
kylin.coprocessor.local.jar=/usr/local/apps/kylin/lib/kylin-coprocessor-2.4.1.jar
kylin.job.yarn.app.rest.check.status.url=http://192.168.43.129:8088/ws/v1/cluster/apps/${job_id}?anonymous=true
9、修改权限
su hdfs(切换到hdfs用户)
hadoop fs -chmod 777 / (修改权限)
su (切换回root)
10、kylin环境检查
[root@cm1 bin]# cd /usr/local/apps/kylin/bin
[root@cm1 bin]# ./check-env.sh
Retrieving hadoop conf dir...
KYLIN_HOME is set to /usr/local/apps/kylin
[root@cm1 bin]# hdfs dfs -ls / (检查权限,可以看到下面这行)
drwxr-xr-x - root supergroup 0 2017-09-01 10:23 /kylin
[root@cm1 bin]# ./find-hbase-dependency.sh
Retrieving hbase dependency...
[root@cm1 bin]# ./find-hive-dependency.sh
Retrieving hive dependency...
11、启动kylin
cd .. 回到kylin目录,然后执行下面命令
[root@cm1 kylin]# bin/kylin.sh start
关闭执行:
bin/kylin.sh stop
12、访问kylin日志
[root@cm1 kylin]# tail 200 -f logs/kylin.out
13、访问kylin
http://192.168.43.129:7070/kylin/
User: ADMIN
Pass: KYLIN
登录成功:
至此kylin安装完成。
14、导入官方测试数据进行测试
执行命令
/usr/local/apps/kylin/bin
[root@cdh01 bin]# ./sample.sh
日志倒数两行
Sample cube is created successfully in project 'learn_kylin'.
Restart Kylin Server or click Web UI => System Tab => Reload Metadata to take effect
#这句话的意思是 例子cube已成成功创建在了 工程名称叫'learn_kylin'里面了
#重启kylin或者通过webUI => System选项卡=> 重新导入元数据信息
查看Hive default库中的表,多了五张表
hive> show tables;
OK
kylin_account
kylin_cal_dt
kylin_category_groupings
kylin_country
kylin_sales
t1
Time taken: 0.015 seconds, Fetched: 6 row(s)
hive>
15、加载样例数据
在System中点击Reload Metadata重新加载元数据或者重启kylin,如下图:
导入成功之后,点击Model出现下图:
表示导入成功。
16、Cube 构建
点击Cube的Actions现象---->再点击Build
查看正在构建的cube任务,点击monitor:
[root@cm1 ~]# hbase shell Java HotSpot(TM) 64-Bit Server VM warning: Using incremental CMS is deprecated and will likely be removed in a future release 19/05/24 15:51:13 INFO Configuration.deprecation: hadoop.native.lib is deprecated. Instead, use io.native.lib.available HBase Shell; enter 'help<RETURN>' for list of supported commands. Type "exit<RETURN>" to leave the HBase Shell Version 1.2.0-cdh5.14.4, rUnknown, Tue Jun 12 04:00:36 PDT 2018 hbase(main):001:0> list TABLE KYLIN_IVLJD570IG KYLIN_IYHQO0FLT5 kylin_metadata 3 row(s) in 0.4620 seconds
kylin构建自动转化成mapreduce任务进行了:
17、查询构建好的Cube
select sum(KYLIN_SALES.PRICE) as price_sum,KYLIN_CATEGORY_GROUPINGS.META_CATEG_NAME,KYLIN_CATEGORY_GROUPINGS.CATEG_LVL2_NAME from KYLIN_SALES inner join KYLIN_CATEGORY_GROUPINGS on KYLIN_SALES.LEAF_CATEG_ID = KYLIN_CATEGORY_GROUPINGS.LEAF_CATEG_ID and KYLIN_SALES.LSTG_SITE_ID = KYLIN_CATEGORY_GROUPINGS.SITE_ID group by KYLIN_CATEGORY_GROUPINGS.META_CATEG_NAME,KYLIN_CATEGORY_GROUPINGS.CATEG_LVL2_NAME order by KYLIN_CATEGORY_GROUPINGS.META_CATEG_NAME asc,KYLIN_CATEGORY_GROUPINGS.CATEG_LVL2_NAME desc
后续kylin学习参考:
https://blog.csdn.net/a_drjiaoda/article/details/86530332#commentBox
http://www.mamicode.com/info-detail-2332910.html
https://www.cnblogs.com/sh425/p/5778992.html