【问题标题】:How to load hiveContext in Zeppelin?如何在 Zeppelin 中加载 hiveContext?
【发布时间】:2018-01-09 06:38:25
【问题描述】:

我是 zeppelin 笔记本的新手。但是我注意到一件事,与 spark-shell hiveContext 不同的是,当我启动 notebook 时,不会在 zeppelin 中自动创建。

当我尝试在 zeppelin 中手动加载 hiveContext 时:

import org.apache.spark.sql.hive._
import org.apache.spark.sql.hive.HiveContext

val hiveContext = new HiveContext(sc)

我收到此错误

java.lang.RuntimeException: java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient
    at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:522)
    at org.apache.spark.sql.hive.client.ClientWrapper.<init>(ClientWrapper.scala:204)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at org.apache.spark.sql.hive.client.IsolatedClientLoader.createClient(IsolatedClientLoader.scala:249)
    at org.apache.spark.sql.hive.HiveContext.metadataHive$lzycompute(HiveContext.scala:327)
    at org.apache.spark.sql.hive.HiveContext.metadataHive(HiveContext.scala:237)
    at org.apache.spark.sql.hive.HiveContext.setConf(HiveContext.scala:441)
    at org.apache.spark.sql.hive.HiveContext.defaultOverrides(HiveContext.scala:226)
    at org.apache.spark.sql.hive.HiveContext.<init>(HiveContext.scala:229)
    at org.apache.spark.sql.hive.HiveContext.<init>(HiveContext.scala:101)
    at $iwC$$iwC$$iwC$$iwC$$iwC$$iwC$$iwC$$iwC$$iwC$$iwC.<init>(<console>:33)
    at $iwC$$iwC$$iwC$$iwC$$iwC$$iwC$$iwC$$iwC$$iwC.<init>(<console>:38)
    at $iwC$$iwC$$iwC$$iwC$$iwC$$iwC$$iwC$$iwC.<init>(<console>:40)
    at $iwC$$iwC$$iwC$$iwC$$iwC$$iwC$$iwC.<init>(<console>:42)

我认为错误意味着以前的 metastore_db 不允许覆盖新的。

我使用的是 spark 1.6.1

任何帮助将不胜感激。

【问题讨论】:

    标签: apache-spark apache-zeppelin


    【解决方案1】:

    检查您的 metastore_db 权限... 然后你在 REPL 模式下测试.. 那么你必须移动齐柏林飞艇。

    【讨论】:

      【解决方案2】:

      请您尝试从 shell 连接 Hive。我只是想让你检查一下 Hive 是否安装正确,因为我曾经遇到过类似的问题。还尝试从 Scala shell 连接 Hive。如果它有效,那么它应该可以在 Zeppelin 上运行。

      【讨论】:

      • 我没有安装 hive。我真的需要 hive 才能在 zeppelin 中使用 hiveContext 吗?
      • 是的,您需要安装 Hive。
      【解决方案3】:

      尝试如下创建 HIVE 上下文:

      PYSPARK 代码。

      sc = SparkContext(conf=conf)

      sc._jvm.org.apache.hadoop.hive.conf.HiveConf()

      hiveContext = HiveContext(sc)

      希望对你有帮助。

      问候,

      尼拉杰

      【讨论】:

      • bhadnani 嗨,我在 scala 中做了同样的事情,但得到了这个错误
      猜你喜欢
      • 2016-04-17
      • 2020-04-02
      • 2016-03-12
      • 2017-10-27
      • 2020-05-16
      • 2018-12-14
      • 2015-11-22
      • 2016-07-11
      • 2015-08-11
      相关资源
      最近更新 更多