apache kylin2.6搭建并排除

1,前景交代

部门最近在规划做一套画像系统,底层存储方案定的为apache kylin,麒麟神兽。

我本力推TiDB,奈何tidb对硬件(ssd硬盘)和系统(centos 7.3以上)都有要求,最终被拍板定位kylin。

kylin前两年都知晓其概念,基于hive数据,大多数用星型模型和雪花模型,支持后台预计算各种更简单的函数。

能够将近实时的分析出多维度组合的结果。

了解其数据执行流程就会发现它中间用了大量的磁盘和计算资源做预处理,结果落到hbase中。

之前我觉着太浪费资源,还不如自己写个离线或者实时程序把一个job可以把各种纬度的组合结果落入hbase+phoenix中供查询。

奈何现在要玩高大上一点,各大厂都在造olap平台。

虽然还不确定kylin对hive的udf支持力度如何,也不知道复杂的空间查询该如何内置到kylin的cube中。

但是我们这边也不能落伍呀,就把apache kylin定为画像系统的存储方案。

目前我们有一套数据开发平台,大致环境如下:

8个实体机(16core ,32G,16T) 系统为centos6.8

一个千兆交换机,都安安静静躺在工位脚下。冬天可以暖脚,夏天省略。

Hadooop 2.7 
spark2.2
hive 2.3
hbase1.26
phoenix 4.14
ooozie 4.3
mysql5.7,
kafka1.1
hue4.2

等等其他各种环境。

所以在准备在msater01上装个kylin的all节点,其他挑两个节点装上query节点。

目前kylin最新版本为3.0  不敢用最新的,就用了个次新的2.63版本为此次踩坑版本。

 

2,搭建干货

大致安装搭建时候是参考:


这篇博客来搭建的。

只是在启动的时候报了一些博客中没有得错误,而且是费了很大劲才排除掉的。

1,kylin在启动之后,有了kylin的一个RunJar进程,但是7070/kylin的web界面却打不开。

查看kylin的logs目录下kylin.out文件发现报错:

java.lang.NoClassDefFoundError: Could not initialize class org.apache.derby.jdbc.AutoloadedDriver40
         at java.lang.Class.forName0(Native Method)
         at java.lang.Class.forName(Class.java:348)
         at java.sql.DriverManager.isDriverAllowed(DriverManager.java:556)
         at java.sql.DriverManager.isDriverAllowed(DriverManager.java:548)
         at java.sql.DriverManager.getDrivers(DriverManager.java:446)
         at org.apache.catalina.loader.JdbcLeakPrevention.clearJdbcDriverRegistrations(JdbcLeakPrevention.java:56)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

根据各种把资料,找博客后尝试将jdk(我们的是1.8)db/lib/derby.jar 文件拷贝到kylin的安装目录的lib/ 下

此问题解决。

 

2,接着又爆出:

java.io.FileNotFoundException: /home/software/kylin/apache-kylin-2.6.3-bin-hbase1x/tomcat/conf/.keystore (No such file or directory)
         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)
         at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:90)
         at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:188)
         at java.net.URL.openStream(URL.java:1045)
         at org.apache.tomcat.util.file.ConfigFileLoader.getInputStream(ConfigFileLoader.java:100)
         at org.apache.tomcat.util.net.jsse.JSSESocketFactory.getStore(JSSESocketFactory.java:472)
         at org.apache.tomcat.util.net.jsse.JSSESocketFactory.getKeystore(JSSESocketFactory.java:381)

这个问题在上面提到的博客中有解决思路:

修改 /home/software/kylin/apache-kylin-2.6.3-bin-hbase1x/tomcat/conf/server.xml
 注释掉:

<!--    <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" />
   -->
   3,然后哩,又报错 还是kylin.out这个文件:
EVERE: ContainerBase.addChild: start: 
 org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/kylin]]
         at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:162)
         at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:1018)
         at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:994)
         at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
         at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1127)
         at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:2021)
         at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
         at java.util.concurrent.FutureTask.run(FutureTask.java:266)
         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)
 Caused by: org.apache.catalina.LifecycleException: Failed to start component [WebappLoader[/kylin]]
         at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:162)
         at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5541)
         at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
         ... 10 more
 Caused by: org.apache.catalina.LifecycleException: start: 
         at org.apache.catalina.loader.WebappLoader.startInternal(WebappLoader.java:651)
         at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
         ... 12 more
 Caused by: java.lang.NoSuchMethodError: com.ibm.icu.impl.ICUBinary.getRequiredData(Ljava/lang/String;)Ljava/nio/ByteBuffer;
         at com.ibm.icu.charset.UConverterAlias.haveAliasData(UConverterAlias.java:131)
         at com.ibm.icu.charset.UConverterAlias.haveAvailableConverterList(UConverterAlias.java:714)
         at com.ibm.icu.charset.UConverterAlias.bld_countAvailableConverters(UConverterAlias.java:746)
         at com.ibm.icu.charset.UConverterAlias.countAvailable(UConverterAlias.java:537)
         at com.ibm.icu.charset.CharsetProviderICU.loadAvailableICUCharsets(CharsetProviderICU.java:273)
         at com.ibm.icu.charset.CharsetProviderICU.charsets(CharsetProviderICU.java:296)
         at java.nio.charset.Charset$3.run(Charset.java:584)
         at java.nio.charset.Charset$3.run(Charset.java:573)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.nio.charset.Charset.availableCharsets(Charset.java:572)
         at org.apache.tomcat.util.buf.B2CConverter.<clinit>(B2CConverter.java:51)
         at org.apache.tomcat.util.buf.UDecoder.URLDecode(UDecoder.java:346)
         at org.apache.catalina.loader.WebappLoader.buildClassPath(WebappLoader.java:1103)
         at org.apache.catalina.loader.WebappLoader.setClassPath(WebappLoader.java:1071)
         at org.apache.catalina.loader.WebappLoader.startInternal(WebappLoader.java:626)
         ... 13 more这个明显看着是缺少个类或者方法,以我三十年的人生经验推测八九不离十是tomcat里面的jar包冲突,n年前搞web的时候,tomcat里面各种jar包冲突到现在还记忆犹新。
去网上搜发现com.ibm.icu.impl.ICUBinary 这个类呢属于incu4j包里面的,就手动下了几个不同版本的该包https://mvnrepository.com/artifact/com.ibm.icu/icu4j  通过各种反编译看了下,发现50 版本之前ICUBinary这个类里面就是木得getRequiredData方法! 不要急匆匆的下完包就放进去,反编译确认下比较好。 将icu4j-56.2.jar 这个包放到kylin安装目录下的tomcat的lib目录下 上述问题解决。
 
4,接着呢,问题依旧:
EVERE: Error reading request, ignored
 java.lang.NoClassDefFoundError: Could not initialize class org.apache.tomcat.util.buf.B2CConverter
         at org.apache.tomcat.util.buf.ByteChunk.<clinit>(ByteChunk.java:115)
         at org.apache.tomcat.util.buf.MessageBytes.<init>(MessageBytes.java:59)
         at org.apache.tomcat.util.buf.MessageBytes.<init>(MessageBytes.java:37)
         at org.apache.tomcat.util.buf.MessageBytes$MessageBytesFactory.newInstance(MessageBytes.java:687)
         at org.apache.tomcat.util.buf.MessageBytes.newInstance(MessageBytes.java:79)
         at org.apache.coyote.Request.<init>(Request.java:83)
         at org.apache.coyote.AbstractProcessor.<init>(AbstractProcessor.java:74)
         at org.apache.coyote.http11.AbstractHttp11Processor.<init>(AbstractHttp11Processor.java:297)
         at org.apache.coyote.http11.Http11Processor.<init>(Http11Processor.java:59)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.createProcessor(Http11Protocol.java:165)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.createProcessor(Http11Protocol.java:103)
         at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:603)
         at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
         at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) 
java.lang.NoClassDefFoundError: Could not initialize class org.apache.tomcat.util.buf.ByteChunk
         at org.apache.tomcat.util.buf.MessageBytes.<init>(MessageBytes.java:59)
         at org.apache.tomcat.util.buf.MessageBytes.<init>(MessageBytes.java:37)
         at org.apache.tomcat.util.buf.MessageBytes$MessageBytesFactory.newInstance(MessageBytes.java:687)
         at org.apache.tomcat.util.buf.MessageBytes.newInstance(MessageBytes.java:79)
         at org.apache.coyote.Request.<init>(Request.java:83)
         at org.apache.coyote.AbstractProcessor.<init>(AbstractProcessor.java:74)
         at org.apache.coyote.http11.AbstractHttp11Processor.<init>(AbstractHttp11Processor.java:297)
         at org.apache.coyote.http11.Http11Processor.<init>(Http11Processor.java:59)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.createProcessor(Http11Protocol.java:165)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.createProcessor(Http11Protocol.java:103)
         at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:603)
         at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
         at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
         at java.lang.Thread.run(Thread.java:748) 
看意思大概是不能初始化tomcat util里面buf的一些类:
参考这篇文章 :http://www.voidcn.com/article/p-cpmawhzw-bsr.html
发现应该是 tomcat-coyote.jar这个jar包的问题,但是咱也不知道它目前是哪个版本的,就给替换了个高一点的版本替换成了 tomcat-coyote-7.0.94.jar 但是呢,替换之后 kylin的进程都启动不起来了
报错为:
java.lang.NoClassDefFoundError: org/apache/tomcat/util/compat/JreCompat
         at org.apache.catalina.core.JreMemoryLeakPreventionListener.<init>(JreMemoryLeakPreventionListener.java:77)
         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 java.lang.Class.newInstance(Class.java:442)
         at org.apache.tomcat.util.digester.ObjectCreateRule.begin(ObjectCreateRule.java:145)
         at org.apache.tomcat.util.digester.Digester.startElement(Digester.java:1303)
         at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
         at org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(Unknown Source)
         at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown Source)
         at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
         at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
         at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
         at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
         at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
         at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
         at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
         at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1576)
         at org.apache.catalina.startup.Catalina.load(Catalina.java:628)
         at org.apache.catalina.startup.Catalina.start(Catalina.java:693)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
         at java.lang.reflect.Method.invoke(Method.java:498)
         at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294)
         at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:428)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
         at java.lang.reflect.Method.invoke(Method.java:498)
         at org.apache.hadoop.util.RunJar.main(RunJar.java:212)
 Caused by: java.lang.ClassNotFoundException: org.apache.tomcat.util.compat.JreCompat
         at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
         ... 32 more

还是缺少个类,接着排查发现:tomcat-coyote-7.0.94.jar  这个高版本的tomcat-coyote里面就是木得org.apache.tomcat.util.compat.JreCompat这个类,仔细对比这个新版本和老版本的tomcat-coyote包,

发现里面差别挺大的有些类 老版tomcat-coyote 里面有,新版tomcat-coyote-7.0.94.jar 木得。

而有些呢又是反之,这个可咋搞嘛? 重新编译?一个一个排查。

这个时候一个铤而走险的方法在脑海里一闪而过,两个包并存在呢? 版本冲突能报多严重的错误???

就把两个不同名的tomcat-coyotejar包都放在lib下:

annotations-api.jar  catalina-tribes.jar  icu4j-56.2.jar  kylin-tomcat-ext-2.6.3.jar  tomcat-coyote-7.0.94.jar      tomcat-i18n-es.jar  tomcat-jdbc.jar
 catalina-ant.jar     charsets.jar         jasper-el.jar   servlet-api.jar             tomcat-coyote-9.0.20.jar.bak  tomcat-i18n-fr.jar  tomcat-util.jar
 catalina-ha.jar      ecj-4.4.2.jar        jasper.jar      tomcat7-websocket.jar       tomcat-coyote.jar             tomcat-i18n-ja.jar  websocket-api.jar
 catalina.jar         el-api.jar           jsp-api.jar     tomcat-api.jar              tomcat-dbcp.jar               tomcat-i18n-ru.jar

然后启动一下kylin试试,竟然启动成功,不报错了。

花了两三个小时,稀里糊涂的把这些问题都排除掉了,

就是这么莫名其妙。