sparksql与hive整合

参考文献:

http://blog.csdn.net/stark_summer/article/details/48443147

hive配置

编辑 $HIVE_HOME/conf/Hive-site.xml,增加如下内容:

<property>
  <name>hive.metastore.uris</name>
  <value>thrift://master:9083</value>
  <description>Thrift uri for the remote metastore. Used by metastore client to connect to remote metastore.</description>
</property>

启动hive metastore

启动 metastore:

hive   --service metastore &

查看  metastore:

jobs

关闭 metastore:

$kill %1

kill %jobid,1代表job id

spark配置

将 $HIVE_HOME/conf/hive-site.xml copy或者软链 到 $SPARK_HOME/conf/
将 $HIVE_HOME/lib/mysql-connector-java-5.1.12.jar copy或者软链到$SPARK_HOME/lib/

copy或者软链$SPARK_HOME/lib/ 是方便spark standalone模式使用

启动spark-sql

注:

如果没有启动  hive metastore  则会:

原文地址:https://www.cnblogs.com/devilmaycry812839668/p/6918225.html