溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

如何修改編譯hadoop

發(fā)布時(shí)間:2021-12-09 14:10:12 來(lái)源:億速云 閱讀:150 作者:iii 欄目:大數(shù)據(jù)

本篇內(nèi)容介紹了“如何修改編譯hadoop”的有關(guān)知識(shí),在實(shí)際案例的操作過(guò)程中,不少人都會(huì)遇到這樣的困境,接下來(lái)就讓小編帶領(lǐng)大家學(xué)習(xí)一下如何處理這些情況吧!希望大家仔細(xì)閱讀,能夠?qū)W有所成!

版本

spark 3.1.x
hive 1.2.x
hadoop 2.6.0-cdh-5.13.1

背景

由于好多公司的yarn集群用的是cdh版本的,用Cloudera Manager管理的。而截止到目前為止,spark的最新版本已經(jīng)到了3.1.1。而對(duì)于cdh 2.6.0-5.13.1來(lái)說(shuō)目前支持的hive版本為1.2.1,所以我們做一下集中嘗試:

  • 直接修改pom文件中的hive對(duì)應(yīng)的版本

  • 直接修改編譯的hadoop版本

  • 在spark運(yùn)行的時(shí)候,動(dòng)態(tài)加載hive對(duì)應(yīng)的版本包

直接修改pom文件中的hive對(duì)應(yīng)的版本

直接在spark的父pom文件增加如下proflie信息:

<profile>
    <id>hive-1.2</id>
    <properties>
      <hive.version>1.2.1</hive.version>
      <!-- Version used for internal directory structure -->
      <hive.version.short>1.2</hive.version.short>
      <hive.storage.version>2.6.0</hive.storage.version>
      <datanucleus-core.version>3.2.10</datanucleus-core.version>
    </properties>
  </profile>

運(yùn)行

./dev/make-distribution.sh --name 2.6.0-cdh6.13.1  --pip  --tgz  -Phive-1.2 -Phive-thriftserver -Pyarn

報(bào)錯(cuò):

[INFO] --- scala-maven-plugin:4.3.0:compile (scala-compile-first) @ spark-hive_2.12 ---
[INFO] Using incremental compilation using Mixed compile order
[INFO] Compiler bridge file: .sbt/1.0/zinc/org.scala-sbt/org.scala-sbt-compiler-bridge_2.12-1.3.1-bin_2.12.10__52.0-1.3.1_20191012T045515.jar
[INFO] compiler plugin: BasicArtifact(com.github.ghik,silencer-plugin_2.12.10,1.6.0,null)
[INFO] Compiling 29 Scala sources and 2 Java sources to spark/sql/hive/target/scala-2.12/classes ...
[ERROR] [Error] spark/sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveShim.scala:29: object SerializationUtilities is not a msmber of package org.apache.hadoop.hive.ql.exec
[ERROR] [Error] spark/sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveShim.scala:150: not found: value SerializationUtilities
[ERROR] [Error] spark/sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveShim.scala:154: not found: value SerializationUtilities
[ERROR] [Error] spark/sql/hive/src/main/scala/org/apache/spark/sql/hive/hiveUDFs.scala:350: too many arguments (4) for constructor SimpleGenericUDAFParameterInfo: (x$1: Array[org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector], x$2: Boolean, x$3: Boolean)org.apache.hadoop.hive.ql.udf.generic.SimpleGenericUDAFParameterInfo
[ERROR] four errors found

說(shuō)明hive1.2.1版本的不兼容

直接修改編譯的hadoop版本

直接修改hadoop的版本為2.6.0-cdh6.13.1
運(yùn)行如下命令:

./dev/make-distribution.sh --name 2.6.0-cdh6.13.1  --pip  --tgz  -Phive-1.2 -Phive-thriftserver -Pyarn -Dhadoop.version=2.6.0-cdh6.13.1

報(bào)錯(cuò):

[INFO] --- scala-maven-plugin:4.3.0:compile (scala-compile-first) @ spark-core_2.12 ---
[INFO] Using incremental compilation using Mixed compile order
[INFO] Compiler bridge file: .sbt/1.0/zinc/org.scala-sbt/org.scala-sbt-compiler-bridge_2.12-1.3.1-bin_2.12.10__52.0-1.3.1_20191012T045515.jar
[INFO] compiler plugin: BasicArtifact(com.github.ghik,silencer-plugin_2.12.10,1.6.0,null)
[INFO] Compiling 560 Scala sources and 99 Java sources to spark/core/target/scala-2.12/classes ...
[ERROR] [Error] spark/core/src/main/scala/org/apache/spark/ui/HttpSecurityFilter.scala:107: type mismatch;
 found   : K where type K
 required: String
[ERROR] [Error] spark/core/src/main/scala/org/apache/spark/ui/HttpSecurityFilter.scala:107: value map is not a member of V
[ERROR] [Error] spark/core/src/main/scala/org/apache/spark/ui/HttpSecurityFilter.scala:107: missing argument list for method stripXSS in class XssSafeRequest
Unapplied methods are only converted to functions when a function type is expected.
You can make this conversion explicit by writing `stripXSS _` or `stripXSS(_)` instead of `stripXSS`.
[ERROR] [Error] spark/core/src/main/scala/org/apache/spark/ui/PagedTable.scala:307: value startsWith is not a member of K
[ERROR] [Error] spark/core/src/main/scala/org/apache/spark/util/Utils.scala:580: value toLowerCase is not a member of object org.apache.hadoop.util.StringUtils
[ERROR] 5 errors found

說(shuō)明對(duì)2.6.0-cdh6.13.1版本的不兼容

在spark運(yùn)行的時(shí)候,動(dòng)態(tài)加載hive對(duì)應(yīng)的版本包

根據(jù)官網(wǎng)的說(shuō)明 ,spark從1.4.0 開(kāi)始就能和不同的hive元數(shù)據(jù)進(jìn)行交互,也就是說(shuō)spark編譯的hive內(nèi)部版本和spark訪問(wèn)hive的元數(shù)據(jù)是獨(dú)立的,可以配置不同的hive版本進(jìn)行對(duì)應(yīng)元數(shù)據(jù)的訪問(wèn)。

“如何修改編譯hadoop”的內(nèi)容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業(yè)相關(guān)的知識(shí)可以關(guān)注億速云網(wǎng)站,小編將為大家輸出更多高質(zhì)量的實(shí)用文章!

向AI問(wèn)一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI