kylin 集群安装配置

张映 发表于 2019-11-13

分类目录: hadoop/spark/scala

标签:, ,

Apache Kylin不同于“大规模并行处理”(Massive Parallel Processing,MPP)架构的Hive、Presto等,Apache Kylin采用“预计算”的模式,用户只需要提前定义好查询维度,Kylin将帮助我们进行计算,并将结果存储到HBase中,为海量数据的查询和分析提供亚秒级返回,是一种典型的“空间换时间”的解决方案。Apache Kylin的出现不仅很好地解决了海量数据快速查询的问题,也避免了手动开发和维护提前计算程序带来的一系列麻烦。

说的更直白一点就是查询数据不查原始表,查结果表。

一,软件要求

Hadoop: 2.7+, 3.1+ (since v2.5)
Hive: 0.13 - 1.2.1+
HBase: 1.1+, 2.0 (since v2.5)
Spark (可选) 2.3.0+
Kafka (可选) 1.0.0+ (since v2.5)
JDK: 1.8+ (since v2.5)
OS: Linux only, CentOS 6.5+ or Ubuntu 16.0.4+

二,硬件要求

运行 Kylin 的服务器的最低配置为 4 core CPU,16 GB 内存和 100 GB 磁盘。 对于高负载的场景,建议使用 24 core CPU,64 GB 内存或更高的配置。如果达不到是可以运行的。

三,下载kylin

  1. # wget http://mirror.bit.edu.cn/apache/kylin/apache-kylin-2.6.4/apache-kylin-2.6.4-bin-hbase1x.tar.gz  
  2. # tar -zxvf apache-kylin-2.6.4-bin-hbase1x.tar.gz  
  3. # cp -r apache-kylin-2.6.4-bin /bigdata/kylin  

hbase版,是元数据库放在hbase中。

四,设置环境变量

  1. # vim ~/.bashrc  
  2. # export KYLIN_HOME=/bigdata/kylin  
  3. # export PATH=$KYLIN_HOME/bin:$PATH  
  4. # source ~/.bashrc  

五,kylin配置

  1. # vim $KYLIN_HOME/conf/kylin.properties  
  2.   
  3. kylin.metadata.url=kylin_metadata@hbase  
  4. kylin.server.mode=all  
  5. kylin.server.cluster-servers=bigserver1:7070,bigserver2:7070,bigserver3:7070  
  6. kylin.job.scheduler.default=2  
  7. kylin.job.lock=org.apache.kylin.storage.hbase.util.ZookeeperJobLock  

服务端只有一个kylin.server.mode=all,客户端kylin.server.mode=query。
配置相同的 kylin.metadata.url 值,即配置所有的 Kylin 节点使用同一个 HBase metastore。
配置 Kylin 节点列表 kylin.server.cluster-servers,包括所有节点(包括当前节点),当事件变化时,接收变化的节点需要通知其他所有节点(包括当前节点)。
kylin.job.scheduler.default,任务数为2,kylin.job.lock启用分布式任务锁。

六,导入测试数据

  1. # ${KYLIN_HOME}/bin/sample.sh  
  2. Retrieving hadoop conf dir...  
  3. Loading sample data into HDFS tmp path: /tmp/kylin/sample_cube/data  
  4. Going to create sample tables in hive to database DEFAULT by cli  
  5. SLF4J: Class path contains multiple SLF4J bindings.  
  6.   
  7. 。。。。。。。。。。。。。。。。。。。。省略。。。。。。。。。。。。。。。。。。。。。。。。  
  8.   
  9. 2019-11-12 17:33:26,991 INFO [close-hbase-conn] hbase.HBaseConnection:136 : Closing HBase connections...  
  10. 2019-11-12 17:33:26,991 INFO [close-hbase-conn] client.ConnectionManager$HConnectionImplementation:2251 : Closing master protocol: MasterService  
  11. 2019-11-12 17:33:26,998 INFO [close-hbase-conn] client.ConnectionManager$HConnectionImplementation:1774 : Closing zookeeper sessionid=0x103755941330014  
  12. 2019-11-12 17:33:27,017 INFO [close-hbase-conn] zookeeper.ZooKeeper:684 : Session: 0x103755941330014 closed  
  13. 2019-11-12 17:33:27,017 INFO [main-EventThread] zookeeper.ClientCnxn:519 : EventThread shut down for session: 0x103755941330014  
  14. Sample cube is created successfully in project 'learn_kylin'.  
  15. Restart Kylin Server or click Web UI => System Tab => Reload Metadata to take effect  

七,启动kylin集群

  1. [root@bigserver1 kylin]# kylin.sh start  
  2. Retrieving hadoop conf dir...  
  3. KYLIN_HOME is set to /bigdata/kylin  
  4. Retrieving hive dependency...  
  5. Retrieving hbase dependency...  
  6. Retrieving hadoop conf dir...  
  7. Retrieving kafka dependency...  
  8. Retrieving Spark dependency...  
  9. Start to check whether we need to migrate acl tables  
  10. Retrieving hive dependency...  
  11. Retrieving hbase dependency...  
  12. Retrieving hadoop conf dir...  
  13. Retrieving kafka dependency...  
  14. Retrieving Spark dependency...  
  15. SLF4J: Class path contains multiple SLF4J bindings.  
  16.   
  17. 。。。。。。。。。。。。。。。。。。。。省略。。。。。。。。。。。。。。。。。。。。。。。。  
  18.   
  19. new Kylin instance is started by root. To stop it, run 'kylin.sh stop'  
  20. Check the log at /bigdata/kylin/logs/kylin.log  
  21. Web UI is at http://bigserver1:7070/kylin    
  22.   
  23. # netstat -tpnl |grep 7070  
  24. tcp6 0 0 :::7070 :::* LISTEN 17395/java   
  25.   
  26. [root@bigserver1 kylin]# jps  
  27. 18064 NameNode  
  28. 18145 JournalNode  
  29. 17490 QuorumPeerMain  
  30. 17395 RunJar //会多出来一个  
  31. 17300 HMaster  
  32. 18244 DFSZKFailoverController  
  33. 5302 Kafka  
  34. 2583 JobHistoryServer  
  35. 20537 Jps  
  36. 5150 ResourceManager  
  37. 8462 HRegionServer  

启动没报错,端口起来了,RunJar也有就说明启动正常了。

八,nginx配置

  1. # cat kylin.conf  
  2. upstream kylin {  
  3.     server bigserver1:7070;  
  4.     server bigserver2:7070;  
  5.     server bigserver3:7070;  
  6.     ip_hash;  
  7. }    
  8.   
  9. server {  
  10.     listen       80;  
  11.     server_name  kylin.xxxx.com;  
  12.     index index.html;     
  13.   
  14.     location / {  
  15.         proxy_pass http://kylin;  
  16.         proxy_redirect                      off;  
  17.         proxy_set_header   Host             $host;  
  18.         proxy_set_header   X-Real-IP        $remote_addr;  
  19.         proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;  
  20.     }    
  21.   
  22.     error_page 404 /404.html;  
  23.     location = /40x.html {  
  24.     }    
  25.   
  26.     error_page 500 502 503 504 /50x.html;    
  27.   
  28.     location = /50x.html {  
  29.     }  
  30.     access_log /var/log/nginx/kylin.access.log;  
  31.     error_log /var/log/nginx/kylin.error.log;  
  32.   
  33. }  

重启nginx

九,遇到的问题及解决

1,mr历史记录没开

org.apache.kylin.engine.mr.exception.MapReduceException: Exception: java.net.ConnectException: Call From bigserver1/10.0.40.237 to bigserver1:10020 failed on connection exception: java.net.ConnectException: 拒绝连接; For more details see: http://wiki.apache.org/hadoop/ConnectionRefused
java.net.ConnectException: Call From bigserver1/10.0.40.237 to bigserver1:10020 failed on connection exception: java.net.ConnectException: 拒绝连接; For more details see: http://wiki.apache.org/hadoop/ConnectionRefused
at org.apache.kylin.engine.mr.common.MapReduceExecutable.doWork(MapReduceExecutable.java:173)
at org.apache.kylin.job.execution.AbstractExecutable.execute(AbstractExecutable.java:167)
at org.apache.kylin.job.execution.DefaultChainedExecutable.doWork(DefaultChainedExecutable.java:71)
at org.apache.kylin.job.execution.AbstractExecutable.execute(AbstractExecutable.java:167)
at org.apache.kylin.job.impl.threadpool.DistributedScheduler$JobRunner.run(DistributedScheduler.java:110)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)

解决办法:

  1. $HADOOP_HOME/sbin/mr-jobhistory-daemon.sh start historyserver  

这个报错,不影响kylin的启动,但是会影响,Cubes的运行,会卡住

2,kylin https报错

十一月 13, 2019 10:23:17 上午 org.apache.coyote.AbstractProtocol init
严重: Failed to initialize end point associated with ProtocolHandler ["http-bio-7443"]
java.io.FileNotFoundException: /bigdata/kylin/tomcat/conf/.keystore (没有那个文件或目录)
at java.io.FileInputStream.open0(Native Method)
at java.io.FileInputStream.open(FileInputStream.java:195)
at java.io.FileInputStream.<init>(FileInputStream.java:138)
at java.io.FileInputStream.<init>(FileInputStream.java:93)

因为没有配置tomcat的https导出这个错误产生。

解决办法:

  1. # vim $KYLIN_HOME/tomcat/conf/server.xml  
  2.   
  3. <Connector port="7070" protocol="HTTP/1.1"  
  4.  connectionTimeout="20000"  
  5.  redirectPort="7443" //把这行去掉  
  6.  compression="on"  
  7.  compressionMinSize="2048"  
  8.  noCompressionUserAgents="gozilla,traviata"  
  9.  compressableMimeType="text/html,text/xml,text/javascript,application/javascript,application/json,text/css,text/plain"  
  10. />  
  11.   
  12. //注释掉以下内容  
  13. <!--<Connector port="7443" protocol="org.apache.coyote.http11.Http11Protocol"  
  14.  maxThreads="150" SSLEnabled="true" scheme="https" secure="true"  
  15.  keystoreFile="conf/.keystore" keystorePass="changeit"  
  16.  clientAuth="false" sslProtocol="TLS" />-->  

这个报错,不会影响启动,也不会影响使用。

kylin 数据来自hive

kylin 数据来自hive



转载请注明
作者:海底苍鹰
地址:http://blog.51yip.com/hadoop/2231.html