apache-spark - Pyspark 不显示 hive 数据库
问题描述
我尝试通过 pyspark 连接到 hive 数据库,但看不到我的数据库(仅默认)
Welcome to
____ __
/ __/__ ___ _____/ /__
_\ \/ _ \/ _ `/ __/ '_/
/__ / .__/\_,_/_/ /_/\_\ version 2.4.5
/_/
Using Python version 3.7.4 (default, Aug 13 2019 20:35:49)
SparkSession available as 'spark'.
>>> spark.sql('show databases')
DataFrame[databaseName: string]
>>> spark.sql('show databases').show()
+------------+
|databaseName|
+------------+
| default|
+------------+
但是,如果我使用 hive 执行此命令,则会得到以下信息:
hive> show databases;
OK
signals
default
test
Time taken: 0.973 seconds, Fetched: 3 row(s)
hive>
我应该怎么做才能连接到我的配置单元实例?
解决方案
请检查您是否已将 spark 配置为使用 hive 元存储。
去SPARK_HOME/conf/hive-site.xml
。
并检查以下属性,如果不存在则添加。
<configuration>
<property>
<name>hive.metastore.uris</name>
<!-- hostname must point to the Hive metastore URI in your cluster -->
<value>thrift://hostname:port</value>
<description>URI for client to contact metastore server</description>
</property>
</configuration>
注意:如果您不知道 Metastore 的主机名和端口,请转到HIVE_HOME/conf/hive-site.xml
. 你可以在那里找到那些财产
推荐阅读
- java - 如何使用 Jsoup 监听 WebView 中的元素变化?
- python - 内存友好的应用生成器而不是熊猫我可以读写同一个文件吗?
- algorithm - 删除异或链接列表中的节点
- flutter - 如何直接执行 login() 方法而不是覆盖 build 方法并在 AccountKit 上返回一个小部件
- tensorflow - 在 Google Colab 中使用 pickle.dump 时会话因未知原因而崩溃
- flutter - Flutter Bloc:更新后未调用 BlocBuilder,ListView 仍显示旧数据
- ruby-on-rails - 命令“rails generate model xxx”的问题
- android - 基于现有布局以编程方式添加按钮
- javascript - 如何在混合 Javascript/Typescript 项目中引用“window”变量
- javascript - 如何让我的联系表在提交时发送电子邮件?