一、下載kylin
git clone https://github.com/apache/kylin kylin
二、安裝maven、nodejs
1.maven的安裝參照百度,這里不再贅述
2.nodejs的安裝參考http://www.runoob.com/nodejs/nodejs-install-setup.html
CentOS 下安裝 Node.js 1、下載源碼,你需要在https://nodejs.org/en/download/下載最新的Nodejs版本,本文以v0.10.24為例: cd /usr/local/src/ wget http://nodejs.org/dist/v0.10.24/node-v0.10.24.tar.gz 2、解壓源碼 tar zxvf node-v0.10.24.tar.gz 3、 編譯安裝 cd node-v0.10.24 ./configure --prefix=/usr/local/node/0.10.24 make make install 4、 配置NODE_HOME,進入profile編輯環境變量 vim /etc/profile 設置nodejs環境變量,在 export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROL 一行的上面添加如下內容: #set for nodejs export NODE_HOME=/usr/local/node/0.10.24 export PATH=$NODE_HOME/bin:$PATH :wq保存並退出,編譯/etc/profile 使配置生效 source /etc/profile 驗證是否安裝配置成功 node -v 輸出 v0.10.24 表示配置成功 npm模塊安裝路徑 /usr/local/node/0.10.24/lib/node_modules/
三、編譯kylin
1.解壓kylin
tar -xzvf apache-kylin-2.1.0-src.tar.gz
2.編譯kylin
apache-kylin-2.1.0/build/script ./package.sh -P cdh5.5.2 ............等待編譯中
3.出現如下問題,未成功編譯
> phantomjs@1.9.20 install /home/hadoop/test/apache-kylin-2.1.0/webapp/node_modules/grunt-contrib/node_modules/grunt-contrib-jasmine/node_modules/grunt-lib-phantomjs/node_modules/phantomjs > node install.js PhantomJS not found on PATH Downloading https://github.com/Medium/phantomjs/releases/download/v1.9.19/phantomjs-1.9.8-linux-x86_64.tar.bz2 Saving to /home/hadoop/test/apache-kylin-2.1.0/webapp/node_modules/grunt-contrib/node_modules/grunt-contrib-jasmine/node_modules/grunt-lib-phantomjs/node_modules/phantomjs/phantomjs/phantomjs-1.9.8-linux-x86_64.tar.bz2 Receiving... Error making request. Error: connect ECONNREFUSED at errnoException (net.js:901:11) at Object.afterConnect [as oncomplete] (net.js:892:19) Please report this full log at https://github.com/Medium/phantomjs npm http 304 https://registry.npmjs.org/hoek > phantomjs@1.9.20 install /home/hadoop/test/apache-kylin-2.1.0/webapp/node_modules/grunt-contrib/node_modules/grunt-contrib-qunit/node_modules/grunt-lib-phantomjs/node_modules/phantomjs > node install.js PhantomJS not found on PATH Downloading https://github.com/Medium/phantomjs/releases/download/v1.9.19/phantomjs-1.9.8-linux-x86_64.tar.bz2 Saving to /home/hadoop/test/apache-kylin-2.1.0/webapp/node_modules/grunt-contrib/node_modules/grunt-contrib-qunit/node_modules/grunt-lib-phantomjs/node_modules/phantomjs/phantomjs/phantomjs-1.9.8-linux-x86_64.tar.bz2 Receiving... Error making request. Error: connect ECONNREFUSED at errnoException (net.js:901:11) at Object.afterConnect [as oncomplete] (net.js:892:19) Please report this full log at https://github.com/Medium/phantomjs npm ERR! error rolling back Error: ENOTEMPTY, rmdir '/home/hadoop/test/apache-kylin-2.1.0/webapp/node_modules/grunt-contrib/node_modules/grunt-contrib-qunit/node_modules/grunt-lib-phantomjs/node_modules/phantomjs' npm ERR! error rolling back grunt-contrib@0.7.0 { [Error: ENOTEMPTY, rmdir '/home/hadoop/test/apache-kylin-2.1.0/webapp/node_modules/grunt-contrib/node_modules/grunt-contrib-qunit/node_modules/grunt-lib-phantomjs/node_modules/phantomjs'] npm ERR! error rolling back errno: 53, npm ERR! error rolling back code: 'ENOTEMPTY', npm ERR! error rolling back path: '/home/hadoop/test/apache-kylin-2.1.0/webapp/node_modules/grunt-contrib/node_modules/grunt-contrib-qunit/node_modules/grunt-lib-phantomjs/node_modules/phantomjs' } npm ERR! phantomjs@1.9.20 install: `node install.js` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the phantomjs@1.9.20 install script. npm ERR! This is most likely a problem with the phantomjs package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! node install.js npm ERR! You can get their info via: npm ERR! npm owner ls phantomjs npm ERR! There is likely additional logging output above. npm ERR! System Linux 2.6.32-642.el6.x86_64 npm ERR! command "/usr/local/node/0.10.24/bin/node" "/usr/local/node/0.10.24/bin/npm" "install" npm ERR! cwd /home/hadoop/test/apache-kylin-2.1.0/webapp npm ERR! node -v v0.10.24 npm ERR! npm -v 1.3.21 npm ERR! code ELIFECYCLE npm ERR! npm ERR! Additional logging details can be found in: npm ERR! /home/hadoop/test/apache-kylin-2.1.0/webapp/npm-debug.log npm ERR! not ok code 0
問題解決辦法:安裝 PhantomJS 安裝過程如下:
1.1下載PhantomJS參考:http://www.cnblogs.com/zengguowang/p/6911812.html 下載地址:https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2 wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2 1.2解壓 bzip2 -d phantomjs-2.1.1-linux-x86_64.tar.bz2 tar xvf phantomjs-2.1.1-linux-x86_64.tar -C /usr/local/ 1.3安裝依賴 安裝依賴軟件 yum -y install wget fontconfig mv /usr/local/phantomjs-2.1.1-linux-x86_64/ /usr/local/phantomjs 1.4環境變量設置 vim /etc/profile #set for phantomjs PHANTOMJS_HOME=/usr/local/phantomjs PATH=$PATH:$PHANTOMJS_HOME/bin export PHANTOMJS_HOME PATH source /etc/profile 1.5驗證 phantomjs
繼續編譯:
./package.sh -P cdh5.5.2
看到如下結果,表示編譯成功:
四、安裝kylin
4.1解壓二進制包
# tar -xzvf apache-kylin-2.1.0-bin.tar.gz -C /opt
4.2配置環境變量
導出環境變量KYLIN_HOME: # vi /etc/profile export KYLIN_HOME=/opt/apache-kylin-2.1.0-bin # source /etc/profile Kylin啟動還需要配置HIVE_CONF、HCAT_HOME # vi /opt/hadoopclient/Hive/component_env export HIVE_CONF=/opt/hadoopclient/Hive/config export HCAT_HOME=/opt/hadoopclient/Hive/HCatalog
4.2檢查設置
Kylin檢查環境設置: # cd /opt/apache-kylin-2.1.0-bin/bin # ./check-env.sh
4.3修改kylin配置
Hive client使用beeline: # vi /opt/apache-kylin-2.1.0-bin/conf/kylin.properties kylin.hive.client=beeline kylin.hive.beeline.params=-n root -u 'jdbc:hive2://162.1.93.103:24002,162.1.93.102:24002,162.1.93.101:24002/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2;sasl.qop=auth-conf;auth=KERBEROS;principal=hive/hadoop.hadoop.com@HADOOP.COM'
4.4啟動kylin
# ./kylin.sh start
啟動kylin失敗!!,問題描述如下:
/kylin_metadata/lock Exception in thread "main" java.lang.IllegalArgumentException: Failed to find metadata store by url: kylin_metadata@hbase at org.apache.kylin.common.persistence.ResourceStore.createResourceStore(ResourceStore.java:89) at org.apache.kylin.common.persistence.ResourceStore.getStore(ResourceStore.java:101) at org.apache.kylin.rest.service.AclTableMigrationTool.checkIfNeedMigrate(AclTableMigrationTool.java:94) at org.apache.kylin.tool.AclTableMigrationCLI.main(AclTableMigrationCLI.java:41) Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at org.apache.kylin.common.persistence.ResourceStore.createResourceStore(ResourceStore.java:83) ... 3 more Caused by: java.lang.NoSuchMethodError: org.apache.hadoop.hbase.HTableDescriptor.addFamily(Lorg/apache/hadoop/hbase/HColumnDescriptor;)Lorg/apache/hadoop/hbase/HTableDescriptor; at org.apache.kylin.storage.hbase.HBaseConnection.createHTableIfNeeded(HBaseConnection.java:320) at org.apache.kylin.storage.hbase.HBaseResourceStore.createHTableIfNeeded(HBaseResourceStore.java:110) at org.apache.kylin.storage.hbase.HBaseResourceStore.<init>(HBaseResourceStore.java:91) ... 8 more 2017-10-18 16:53:46,956 INFO [Thread-1] client.ConnectionManager$HConnectionImplementation:1705 : Closing zookeeper sessionid=0x35ec685fa820019 2017-10-18 16:53:46,962 INFO [Thread-1] zookeeper.ZooKeeper:684 : Session: 0x35ec685fa820019 closed 2017-10-18 16:53:46,962 INFO [main-EventThread] zookeeper.ClientCnxn:512 : EventThread shut down 2017-10-18 16:53:46,971 INFO [Thread-6] zookeeper.ZooKeeper:684 : Session: 0x25ec685f9a60023 closed 2017-10-18 16:53:46,971 INFO [main-EventThread] zookeeper.ClientCnxn:512 : EventThread shut down ERROR: Unknown error. Please check full log.
問題解決辦法:
參考文章解決:http://blog.csdn.net/fz1989/article/details/52160827
社區問題的描述:https://issues.apache.org/jira/browse/KYLIN-1089
經過多方排查,發現是由於版本問題導致的,我之前的kylin版本是“apache-kylin-2.1.0-bin”,我的Hbase的版本是“hbase-1.2.0-cdh5.7.0‘’,最后我更換了kylin的版本為‘’apache-kylin-2.1.0-bin-cdh57”后,問題解決。
官方參考:http://kylin.apache.org/development/howto_package.html
默認用戶名密碼:ADMIN/KYLIN
4.5demo測試
# cd /opt/apache-kylin-2.1.0-bin/bin # ./sample.sh System -> Actions -> Reload Metadata
4.6構建cube
選擇learn_kylin工程,構建默認的kylin_sales_cube Cube構建成功,狀態變為READY
4.7查詢
Insight頁面執行查詢