kylin部署

运行环境 | centos 7.0 |kylin-2.6.2-hbase1x

Apache Kylin™是一个开源的分布式分析引擎,提供Hadoop/Spark之上的SQL查询接口及多维分析(OLAP)能力以支持超大规模数据,最初由eBay Inc. 开发并贡献至开源社区。它能在亚秒内查询巨大的Hive表。

kylin 部署

  • 下载 apache-kylin-2.6.2-bin-hbase1x.tar.gz

解压

1
tar -zxvf apache-kylin-2.6.2-bin-hbase1x.tar.gz -C /opt

添加环境变量

1
2
3
vi /etc/profile

export hive_dependency=/opt/hive-1.2.2/conf:/opt/hive-1.2.2/lib*:/opt/hive-1.2.2/hcatalog/share/hcatalog/hive-hcatalog-core-2.0.0.jar

启动报错一

1
Something wrong with Hive CLI or Beeline, please execute Hive CLI or Beeline CLI in terminal to find the root cause.
  • 修改 kylin/bin/find-hive-dependency.sh 部分代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
if [ "${client_mode}" == "beeline" ]
then
#beeline_shell=`$KYLIN_HOME/bin/get-properties.sh kylin.source.hive.beeline-shell`
#beeline_params=`bash ${KYLIN_HOME}/bin/get-properties.sh kylin.source.hive.beeline-params`
#hive_env=`${beeline_shell} ${hive_conf_properties} ${beeline_params} --outputformat=dsv -e "set;" 2>&1 | grep --text 'env:CLASSPATH' `
beeline_params=`sh ${KYLIN_HOME}/bin/get-properties.sh kylin.hive.beeline.params`
hive_env=`beeline ${beeline_params} --outputformat=dsv -e set | grep 'env:CLASSPATH'`

else
source ${dir}/check-hive-usability.sh
hive_env=`hive -e set | grep 'env:CLASSPATH'`
#hive_env=`hive ${hive_conf_properties} -e set 2>&1 | grep 'env:CLASSPATH'`

#hive -e set >/tmp/hive_env.txt 2>&1
#hive_env=`grep 'env:CLASSPATH' /tmp/hive_env.txt`
#hive_env=`echo ${hive_env#*env:CLASSPATH}`
#hive_env="env:CLASSPATH"${hive_env}
fi
  • 修改 kylin/conf/kylin.properties
1
2
3
4
kylin.rest.servers=192.168.83.128:7070,192.168.83.129:7070,192.168.83.130:7070
kylin.rest.timezone=GMT+8
kylin.hive.client=beeline
kylin.hive.beeline.params=-n root --hiveconf hive.security.authorization.sqlstd.confwhitelist.append='mapreduce.job.*|dfs.*' -u 'jdbc:hive2://192.168.83.128:10000'
  • 分别验证 bin/find-hive-dependency.sh

Retrieving hive dependency…
Connecting to jdbc:hive2://192.168.83.128:10000
Connected to: Apache Hive (version 1.2.2)
Driver: Hive JDBC (version 1.2.2)
Transaction isolation: TRANSACTION_REPEATABLE_READ
1,484 rows selected (0.89 seconds)
Beeline version 1.2.2 by Apache Hive
Closing: 0: jdbc:hive2://192.168.83.128:10000

1
bin/find-hbase-dependency.sh

Retrieving hbase dependency…

启动报错二

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
java.net.UnknownHostException: master:2181: 未知的名称或服务
at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
at java.net.InetAddress$2.lookupAllHostAddr(InetAddress.java:928)
at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1323)
at java.net.InetAddress.getAllByName0(InetAddress.java:1276)
at java.net.InetAddress.getAllByName(InetAddress.java:1192)
at java.net.InetAddress.getAllByName(InetAddress.java:1126)
at org.apache.zookeeper.client.StaticHostProvider.<init>(StaticHostProvider.java:61)
at org.apache.zookeeper.ZooKeeper.<init>(ZooKeeper.java:445)
at org.apache.curator.utils.DefaultZookeeperFactory.newZooKeeper(DefaultZookeeperFactory.java:29)
at org.apache.curator.framework.imps.CuratorFrameworkImpl$2.newZooKeeper(CuratorFrameworkImpl.java:154)
at org.apache.curator.HandleHolder$1.getZooKeeper(HandleHolder.java:94)
at org.apache.curator.HandleHolder.getZooKeeper(HandleHolder.java:55)
at org.apache.curator.ConnectionState.reset(ConnectionState.java:219)
at org.apache.curator.ConnectionState.start(ConnectionState.java:103)
at org.apache.curator.CuratorZookeeperClient.start(CuratorZookeeperClient.java:190)
at org.apache.curator.framework.imps.CuratorFrameworkImpl.start(CuratorFrameworkImpl.java:256)
at org.apache.kylin.storage.hbase.util.ZookeeperDistributedLock$Factory.getZKClient(ZookeeperDistributedLock.java:85)
at org.apache.kylin.storage.hbase.util.ZookeeperDistributedLock$Factory.<init>(ZookeeperDistributedLock.java:109)
at org.apache.kylin.storage.hbase.util.ZookeeperDistributedLock$Factory.<init>(ZookeeperDistributedLock.java:105)
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.util.ClassUtil.newInstance(ClassUtil.java:88)
at org.apache.kylin.common.KylinConfigBase.getDistributedLockFactory(KylinConfigBase.java:458)
at org.apache.kylin.storage.hbase.HBaseConnection.createHTableIfNeeded(HBaseConnection.java:327)
at org.apache.kylin.storage.hbase.HBaseResourceStore.createHTableIfNeeded(HBaseResourceStore.java:114)
at org.apache.kylin.storage.hbase.HBaseResourceStore.<init>(HBaseResourceStore.java:88)
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:92)
at org.apache.kylin.common.persistence.ResourceStore.getStore(ResourceStore.java:111)
at org.apache.kylin.rest.service.AclTableMigrationTool.checkIfNeedMigrate(AclTableMigrationTool.java:99)
at org.apache.kylin.tool.AclTableMigrationCLI.main(AclTableMigrationCLI.java:43)
2019-05-20 20:11:14,464 DEBUG [main] util.ZookeeperDistributedLock:147 : 27720@master trying to lock /kylin/kylin_metadata/create_htable/kylin_metadata/lock
2019-05-20 20:11:29,653 ERROR [main] curator.ConnectionState:201 : Connection timed out for connection string (master:2181:2181,slave0:2181:2181,slave1:2181:2181) and timeout (15000) / elapsed (21695)
org.apache.curator.CuratorConnectionLossException: KeeperErrorCode = ConnectionLoss
at org.apache.curator.ConnectionState.checkTimeouts(ConnectionState.java:198)
at org.apache.curator.ConnectionState.getZooKeeper(ConnectionState.java:88)
at org.apache.curator.CuratorZookeeperClient.getZooKeeper(CuratorZookeeperClient.java:115)
at org.apache.curator.framework.imps.CuratorFrameworkImpl.getZooKeeper(CuratorFrameworkImpl.java:474)
at org.apache.curator.framework.imps.CreateBuilderImpl$11.call(CreateBuilderImpl.java:688)
at org.apache.curator.framework.imps.CreateBuilderImpl$11.call(CreateBuilderImpl.java:672)
at org.apache.curator.RetryLoop.callWithRetry(RetryLoop.java:107)
at org.apache.curator.framework.imps.CreateBuilderImpl.pathInForeground(CreateBuilderImpl.java:668)
at org.apache.curator.framework.imps.CreateBuilderImpl.protectedPathInForeground(CreateBuilderImpl.java:453)
at org.apache.curator.framework.imps.CreateBuilderImpl.forPath(CreateBuilderImpl.java:443)
at org.apache.curator.framework.imps.CreateBuilderImpl.forPath(CreateBuilderImpl.java:44)
at org.apache.kylin.storage.hbase.util.ZookeeperDistributedLock.lock(ZookeeperDistributedLock.java:150)
at org.apache.kylin.storage.hbase.util.ZookeeperDistributedLock.lock(ZookeeperDistributedLock.java:171)
at org.apache.kylin.storage.hbase.HBaseConnection.createHTableIfNeeded(HBaseConnection.java:328)
at org.apache.kylin.storage.hbase.HBaseResourceStore.createHTableIfNeeded(HBaseResourceStore.java:114)
at org.apache.kylin.storage.hbase.HBaseResourceStore.<init>(HBaseResourceStore.java:88)
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:92)
at org.apache.kylin.common.persistence.ResourceStore.getStore(ResourceStore.java:111)
at org.apache.kylin.rest.service.AclTableMigrationTool.checkIfNeedMigrate(AclTableMigrationTool.java:99)
at org.apache.kylin.tool.AclTableMigrationCLI.main(AclTableMigrationCLI.java:43)
  • hbase-site.xml文件```
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37

    ```xml
    <configuration>
    <!-- 指定hbase在HDFS上存储的路径 -->
    <property>
    <name>hbase.rootdir</name>
    <value>hdfs://master:9000/hbase</value>
    </property>

    <!-- 指定hbase是分布式的 -->
    <property>
    <name>hbase.cluster.distributed</name>
    <value>true</value>
    </property>

    <!-- 指定zk的地址,多个用“,”分割 -->
    <property>
    <name>hbase.zookeeper.quorum</name>
    <value>master,slave0,slave1</value>
    </property>

    <property>
    <name>dfs.support.append</name>
    <value>true</value>
    </property>

    <property>
    <name>hbase.zookeeper.property.clientPort</name>
    <value>2181</value>
    <source>2181默认值,来源hbase-default.xml</source>
    </property>

    <property>
    <name>hbase.zookeeper.property.dataDir</name>
    <value>/root/tmp/hbase/zookeeper</value>
    </property>
    </configuration>
  • http://192.168.83.128:7070/kylin

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
2019-05-20 22:39:35,530 INFO  [main] util.ZookeeperDistributedLock:238 : 70746@master released lock at /kylin/kylin_metadata/create_htable/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:99)
at org.apache.kylin.common.persistence.ResourceStore.getStore(ResourceStore.java:111)
at org.apache.kylin.rest.service.AclTableMigrationTool.checkIfNeedMigrate(AclTableMigrationTool.java:99)
at org.apache.kylin.tool.AclTableMigrationCLI.main(AclTableMigrationCLI.java:43)
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:92)
... 3 more
Caused by: org.apache.hadoop.hbase.client.RetriesExhaustedException: Failed after attempts=1, exceptions:
Mon May 20 22:39:35 CST 2019, RpcRetryingCaller{globalStartTime=1558363169520, pause=100, retries=1}, java.io.IOException: Call to master/192.168.83.128:16000 failed on local exception: org.apache.hadoop.hbase.ipc.CallTimeoutException: Call id=7, waitTime=5001, operationTimeout=5000 expired.

at org.apache.hadoop.hbase.client.RpcRetryingCaller.callWithRetries(RpcRetryingCaller.java:157)
at org.apache.hadoop.hbase.client.HBaseAdmin.executeCallable(HBaseAdmin.java:4297)
at org.apache.hadoop.hbase.client.HBaseAdmin.executeCallable(HBaseAdmin.java:4289)
at org.apache.hadoop.hbase.client.HBaseAdmin.createTableAsyncV2(HBaseAdmin.java:753)
at org.apache.hadoop.hbase.client.HBaseAdmin.createTable(HBaseAdmin.java:674)
at org.apache.hadoop.hbase.client.HBaseAdmin.createTable(HBaseAdmin.java:607)
at org.apache.kylin.storage.hbase.HBaseConnection.createHTableIfNeeded(HBaseConnection.java:347)
at org.apache.kylin.storage.hbase.HBaseResourceStore.createHTableIfNeeded(HBaseResourceStore.java:114)
at org.apache.kylin.storage.hbase.HBaseResourceStore.<init>(HBaseResourceStore.java:88)
... 8 more
Caused by: java.io.IOException: Call to master/192.168.83.128:16000 failed on local exception: org.apache.hadoop.hbase.ipc.CallTimeoutException: Call id=7, waitTime=5001, operationTimeout=5000 expired.
at org.apache.hadoop.hbase.ipc.AbstractRpcClient.wrapException(AbstractRpcClient.java:292)
at org.apache.hadoop.hbase.ipc.RpcClientImpl.call(RpcClientImpl.java:1276)
at org.apache.hadoop.hbase.ipc.AbstractRpcClient.callBlockingMethod(AbstractRpcClient.java:227)
at org.apache.hadoop.hbase.ipc.AbstractRpcClient$BlockingRpcChannelImplementation.callBlockingMethod(AbstractRpcClient.java:336)
at org.apache.hadoop.hbase.protobuf.generated.MasterProtos$MasterService$BlockingStub.createTable(MasterProtos.java:58551)
at org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation$4.createTable(ConnectionManager.java:1864)
at org.apache.hadoop.hbase.client.HBaseAdmin$5.call(HBaseAdmin.java:762)
at org.apache.hadoop.hbase.client.HBaseAdmin$5.call(HBaseAdmin.java:754)
at org.apache.hadoop.hbase.client.RpcRetryingCaller.callWithRetries(RpcRetryingCaller.java:136)
... 16 more
Caused by: org.apache.hadoop.hbase.ipc.CallTimeoutException: Call id=7, waitTime=5001, operationTimeout=5000 expired.
at org.apache.hadoop.hbase.ipc.Call.checkAndSetTimeout(Call.java:73)
at org.apache.hadoop.hbase.ipc.RpcClientImpl.call(RpcClientImpl.java:1250)
... 23 more
2019-05-20 22:39:35,682 INFO [close-hbase-conn] hbase.HBaseConnection:136 : Closing HBase connections...
2019-05-20 22:39:35,683 INFO [close-hbase-conn] client.ConnectionManager$HConnectionImplementation:2155 : Closing master protocol: MasterService
2019-05-20 22:39:35,684 INFO [close-hbase-conn] client.ConnectionManager$HConnectionImplementation:1726 : Closing zookeeper sessionid=0x36ad53f63430007
2019-05-20 22:39:35,749 INFO [main-EventThread] zookeeper.ClientCnxn:512 : EventThread shut down
2019-05-20 22:39:35,749 INFO [close-hbase-conn] zookeeper.ZooKeeper:684 : Session: 0x36ad53f63430007 closed
2019-05-20 22:39:36,113 INFO [Thread-6] zookeeper.ZooKeeper:684 : Session: 0x36ad53f63430008 closed
2019-05-20 22:39:36,114 INFO [main-EventThread] zookeeper.ClientCnxn:512 : EventThread shut down
ERROR: Unknown error. Please check full log.
  • 提取出重要的内容

    1
    2
    3
    Caused by: org.apache.hadoop.ipc.RemoteException(org.apache.hadoop.hbase.TableExistsException): kylin_metadata 

    Caused by: org.apache.hadoop.hbase.TableExistsException: kylin_metadata
  • 进入 zookeeper zkCli.sh

    1
    2
    3
    4
    5
    /opt/zookeeper-3.4.6/bin/zkCli.sh 
    ls /hbase/table
    rmr /hbase/table/kylin_metadata

    重启hbase
  • 登陆 http://host:7070/kylin

没有反应
注释 kylin/tomcat/conf/server.xml

1
2
3
4
<Connector port="7443" protocol="org.apache.coyote.http11.Http11Protocol"
maxThreads="150" SSLEnabled="true" scheme="https" secure="true"
keystoreFile="conf/.keystore" keystorePass="changeit"
clientAuth="false" sslProtocol="TLS" />

  • 补充:
    1
    2
    hive 启动时无法访问spark-assembly-*.jar的解决办法
    将加载原来的lib/spark-assembly-*.jar`替换成jars/*.jar

部分代码如下

1
2
3
4
5
6
7
# add Spark assembly jar to the classpath
if [[ -n "$SPARK_HOME" ]]
then
#sparkAssemblyPath=`ls ${SPARK_HOME}/lib/spark-assembly-*.jar`
sparkAssemblyPath=`ls ${SPARK_HOME}/jars/*.jar`
CLASSPATH="${CLASSPATH}:${sparkAssemblyPath}"
fi

本文结束感谢您的阅读,本文原创–支持原创
顺便打点赏吧~ 有问题请联系我--strivedeer@163.com