未找到配置单元表

p5cysglq  于 2021-05-27  发布在  Spark
关注(0)|答案(1)|浏览(448)

如何使用headless在hdp3.1上配置spark3.x(https://spark.apache.org/docs/latest/hadoop-provided.html)与Hive互动的spark版本?
首先,我下载并解压缩了headless spark 3.x:

cd ~/development/software/spark-3.0.0-bin-without-hadoop
export HADOOP_CONF_DIR=/etc/hadoop/conf/
export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk
export SPARK_DIST_CLASSPATH=$(hadoop --config /usr/hdp/current/spark2-client/conf classpath)

ls /usr/hdp # note version ad add it below and replace 3.1.x.x-xxx with it

./bin/spark-shell --master yarn --queue myqueue --conf spark.driver.extraJavaOptions='-Dhdp.version=3.1.x.x-xxx' --conf spark.yarn.am.extraJavaOptions='-Dhdp.version=3.1.x.x-xxx' --conf spark.hadoop.metastore.catalog.default=hive --files /usr/hdp/current/hive-client/conf/hive-site.xml

spark.sql("show databases").show
// only showing default namespace, existing hive tables are missing
+---------+
|namespace|
+---------+
|  default|
+---------+

spark.conf.get("spark.sql.catalogImplementation")
res2: String = in-memory # I want to see hive here - how? How to add hive jars onto the classpath?

注意

这是一个更新版本,我如何运行Spark在无头模式在我的自定义版本的hdp?对于spark 3.x ond hdp 3.1和custom spark,当在yarn上运行时找不到配置单元数据库。
此外:我知道的问题,酸Hive表在Spark。现在,我只想看到现有的数据库

编辑

我们必须把Hive放在类路径上。尝试如下:

export SPARK_DIST_CLASSPATH="/usr/hdp/current/hive-client/lib*:${SPARK_DIST_CLASSPATH}"

现在使用spark sql:

./bin/spark-sql --master yarn --queue myqueue--conf spark.driver.extraJavaOptions='-Dhdp.version=3.1.x.x-xxx' --conf spark.yarn.am.extraJavaOptions='-Dhdp.version=3.1.x.x-xxx' --conf spark.hadoop.metastore.catalog.default=hive --files /usr/hdp/current/hive-client/conf/hive-site.xml

失败原因:

Error: Failed to load class org.apache.spark.sql.hive.thriftserver.SparkSQLCLIDriver.
Failed to load main class org.apache.spark.sql.hive.thriftserver.SparkSQLCLIDriver.

i、 e.线路: export SPARK_DIST_CLASSPATH="/usr/hdp/current/hive-client/lib*:${SPARK_DIST_CLASSPATH}" ,没有效果(如果未设置,则为同一问题)。

o2rvlv0m

o2rvlv0m1#

如上所述,当运行在yarn上时,customspark找不到配置单元数据库,因此需要配置单元jar。它们不提供无头版本。
我无法改装这些。
解决方案:不用担心:只需使用带有hadoop3.2的spark构建(在hdp3.1上)

相关问题