本文主要是介绍配置spark令其支持hive,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
确保scala版本Spark1.4搭配Scala 2.10
Spark1.6搭配Scala 2.10
Spark2.0搭配Scala 2.11
查看lib
Hive需要三个jar包,分别是datanucleus-api-jdo-3.2.6.jar、datanucleus-core-3.2.10.jar、datanucleus-rdbms-3.2.9.jar,如果已经有了就不需要重新编译了。如果需要重新编译,源码下载地址如下:https://github.com/apache/spark/releases/tag/v1.6.2
复制hive/hdfs配置文件
cd /appl/hive-1.2.1/conf
cp hive-site.xml /appl/spark-1.6.2/conf/
cd /appl/hadoop-2.7.0/etc/hadoop
cp core-site.xml /appl/spark-1.6.2/conf/
cp hdfs-site.xml /appl/spark-1.6.2/conf/
(the datanucleus jars under the lib directory and hive-site.xml under conf/ directory need to be available on the driver and all executors launched by the YARN cluster.)
启动
./bin/spark-shell --jars /appl/hive-1.2.1/lib/mysql-connector-java-5.1.30-bin.jar
测试
import org.apache.spark.sql.SQLContext
val sqlContext = new org.apache
这篇关于配置spark令其支持hive的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!