Spark SQL读取hive数据时报找不到mysql驱动

CDH Sqoop 同步Mysql 数据至hive 报错The specified datastore driver (“org.apache.derby.jdbc.EmbeddedDriver“) CDH Sqoop 同步Mysql 数据至hive 报错,报错内容为 Caused by: org.datanucleus.exceptions.NucleusException: Attempt to invoke the “BONECP” plugin to create a ConnectionPool gave an error : The specified datastore driver (“org.apache.derby.jdbc.EmbeddedDriver”) was not fou 阅读详情

Exception:

Caused by: org.datanucleus.exceptions.NucleusException: Attempt to invoke the "BoneCP" plugin to create a ConnectionPool gave an error : The specified datastore driver ("com.mysql.jdbc.Driver") was not found in the CLASSPATH. Please check your CLASSPATH specification, and the name of the driver.

Solution:

1、$HIVE_HOME/conf/hive-site.xml中增加关于 hive.metastore.uris 的配置信息,如下:
<property>
  <name>hive.metastore.uris</name>
  <value>thrift://namenode1:9083</value>
  <description>IP address (or fully-qualified domain name) and port of the metastore host</description>
</property>

2、执行:$HIVE_HOME/bin/hive --service metastore,启动元数据存储服务;

3、将$HIVE_HOME/conf/hive-site.xml拷贝至$SPARK_HOME/conf/目录下;

4、启动spark-shell进行验证:$SPARK_HOME/bin/spark-shell --master namenode1:7077或spark-sql -> show databases.

Note:
1. 当在Intellij IDE中编写Spark SQL程序时(val hiveContext = new HiveContext(sc); import hiveContext.sql; sql("show databases")),打包成相应的.jar文件,并利用如下脚本将任务提交到Spark集群运行时,Spark默认采用derby进行metastore,即元数据的存储;当再次在不同目录下执行该任务时,之前创建的数据库或表数据无法获取,有点即用即删的感觉。故要想访问Hive下的元数据,首先需要将Hive目录下的配置文件中的hive-site.xml文件放到Spark目录下的配置文件中,让Spark集群执行程序时能识别进入Hive元数据的路径,然后启动上述服务(hive --service metastore)即可访问Hive相应数据。

2.
复制代码
/**
* An instance of the Spark SQL execution engine that integrates with data stored in Hive.
* Configuration for Hive is read from hive-site.xml on the classpath.
*/
class HiveContext(sc: SparkContext) extends SQLContext(sc) {

 ....................................

}
复制代码

3. 

Use HiveContext instead.  It will still create a local metastore if one is not specified. However, note that the default directory is ./metastore_db, not ./metastore

 

测试程序如下:

复制代码
package com.husor.Hive

import org.apache.spark.{SparkContext, SparkConf}
import org.apache.spark.sql.hive.HiveContext

/* Spark SQL执行时的sql是临时的,即用即删 **/

/**
 * Created by kelvin on 2015/1/27.
 */
object Recommendation {
  def main(args: Array[String]) {

    println("Test is starting......")

    if (args.length < 1) {
      System.err.println("Usage:HDFS_OutputDir <Directory>")
      System.exit(1)
    }

    //System.setProperty("hadoop.home.dir", "d:\\winutil\\")

    val conf = new SparkConf().setAppName("Recommendation")
    val spark = new SparkContext(conf)

    val hiveContext = new HiveContext(spark)

    import hiveContext.sql

    /*sql("create database if not exists baby")
    val databases = sql("show databases")
    databases.collect.foreach(println)*/

    sql("use baby")
    /*sql("CREATE EXTERNAL TABLE if not exists origin_orders (oid string, uid INT, gmt_create INT) ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t' LINES TERMINATED BY '\n' LOCATION '/beibei/order'")
    sql("CREATE EXTERNAL TABLE if not exists items (iid INT, pid INT, title string, cid INT, brand INT) ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t' LINES TERMINATED BY '\n' LOCATION '/beibei/item'")
    sql("CREATE EXTERNAL TABLE if not exists order_item (oid string, iid INT) ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t' LINES TERMINATED BY '\n' LOCATION '/beibei/order_item'")
    sql("create table if not exists test_orders(oid string, uid INT, gmt_create INT)")
    sql("create table if not exists verify_orders(oid string, uid INT, gmt_create INT)")
    sql("insert OVERWRITE table test_orders select * from origin_orders where gmt_create <= 1415635200")
    sql("insert OVERWRITE table verify_orders select * from origin_orders where gmt_create > 1415635200")

    val tables = sql("show tables")
    tables.collect.foreach(println)*/

    sql("SET spark.sql.shuffle.partitions = 5")

    val olderTime = System.currentTimeMillis()

    val userOrderData = sql("select i.pid, o.uid, o.gmt_create from items i " +
                                         "join order_item oi " +
                                         "on i.iid = oi.iid     " +
                                         "join test_orders o " +
                                         "on oi.oid = o.oid")

    userOrderData.take(10).foreach(println)

    val newTime = System.currentTimeMillis()

    println("Consume Time: " + (newTime - olderTime))

    userOrderData.saveAsTextFile(args(0))
    spark.stop()

    println("Test is Succeed!!!")

  }

}
The specified datastore driver ("com.mysql.jdbc.Driver") was not found in the CLASSPATH The specified datastore driver (“com.mysql.jdbc.Driver”) was not found in the CLASSPATH. Please check your CLASSPATH specification, and the name of the driver已解决 要执行的代码如下: object HiveRead { def mai... 阅读详情

相关推荐

Spark SQL读取Hive数据配置及使用Thrift JDBC/ODBC Server访问Spark SQL

[TOC] Spark SQL可以读取hive中的数据,开启Thrift JDBC/ODBC Server服务可以使其他语言客户端使用Spark SQL.关于Spark SQL中对hive的支持,官方文档说明让人疑惑,好像没有把hive编译进去,需要自己手动编译,官方文档提及: Spark SQL also supports reading and writing data stored in

Fang的博客 1万+

Spark 提交.jar程序遇到的问题

1、缺少驱动类包 Caused by: org.datanucleus.exceptions.NucleusException: Attempt to invoke the "BONECP" plugin to create a ConnectionPool gave an error : The specified datastore driver ("com.mysql.jdbc.Dri

大师兄你家猴跑啦的博客 3077

Spark SQL报错:The specified datastore driver (“com.mysql.jdbc.Driver“) was not found in the CLASSPATH.

Spark SQL报错:The specified datastore driver (“com.mysql.jdbc.Driver”) was not found in the CLASSPATH. 启动Spark SQL报错: ./spark-sql Caused by: org.datanucleus.exceptions.NucleusException: Attempt to invoke the "BONECP" plugin to create a ConnectionPool gave

zhengzaifeidelushang的博客 1000

Caused by: org.datanucleus.exceptions.NucleusException: Attempt to invoke the “BONECP“ plugin to cre

解决思路:一般这种框架,在启动的时候都会去加载相应的jar包和配置文件,比如hadoop、hive、spark、zookeeper等等,他们默认加载的jar包都会有一个稍微固定的文件夹的,你可以去他们的安装路径里面找一下,我相信你能找到的。操作办法:你需要把hive里的这个mysql驱动,拷贝到spark默认加载的jar包路径里去,再重启一下应该就可以解决了。我启动kyuubi(基于spark)

Knight 1196

【Hive进阶】-- Hive SQL、Spark SQL和 Hive on Spark SQL

Hive由Facebook开发,用于解决海量结构化日志的数据统计,于2008年贡献给 Apache 基金会。Hive是基于Hadoop的数据仓库工具,可以将结构化数据映射为一张表,提供类似SQL语句查询功能本质:将Hive SQL转化成MapReduce程序。Spark SQL主要用于结构型数据处理,它的前身为Shark,在Spark 1.3.0版本后才成长为正式版,可以彻底摆脱之前Shark必须依赖HIVE的局面。

欢迎来到我的博客,一起探索代码里的世界! 3928

手把手教你搞定JBI投稿:从Statement of Significance到Declaration Statement的保姆级避坑指南

本文提供了一份详细的JBI投稿指南,重点解析Statement of Significance和Declaration of Interests的撰写技巧,帮助研究者避开常见格式陷阱。通过实战案例和检查清单,确保投稿符合JBI的学术严谨性和临床转化价值要求,提升稿件通过率。

weixin_29278805的博客 622

hive 找不到mysql jar包_Spark SQL读取hive数据时报找不到mysql驱动

package com.husor.Hiveimport org.apache.spark.{SparkContext, SparkConf}import org.apache.spark.sql.hive.HiveContext/*Spark SQL执行时的sql是临时的,即用即删 **//*** Created by kelvin on 2015/1/27.*/objectRecommenda...

weixin_33270404的博客 326

避开这些坑!DS18B20温度读取不准、时序混乱的5个常见问题与调试方法

本文深入解析DS18B20温度传感器在应用中常见的5个问题,包括温度读取不准、时序混乱等,并提供详细的调试方法。通过硬件设计优化、精准延时实现和数据解析技巧,帮助开发者有效解决温度值跳变、初始化失败等典型问题,提升OneWire协议下的温度测量精度。

weixin_29185493的博客 463

SPARK Spark SQL读取hive数据时报找不到mysql驱动

错误提示:Attempt to invoke the "DBCP" plugin to create a ConnectionPool gave an error 将$HIVE_HOME/conf/hive-site.xml拷贝至$SPARK_HOME/conf/目录下;

80后大叔爱学习 834

GEE生物量预测:利用多源遥感数据和随机森林算法RF构建地上生物量(AGB)预测模型,并实现未来年份的生态变化模拟(大面积生物量反演)

数据融合策略:整合5类遥感产品(AGB、NDVI、LAI、土地覆盖、地形)时序特征构建:采用生长季中值法降低云污染影响机器学习优化分层采样保证数据代表性80棵决策树平衡精度与效率预测可靠性基准期R²达0.76需结合地面实测数据校正。

此星光明博客 419

流体仿真软件:COMSOL Multiphysics二次开发_(11).COMSOL与外部软件的数据交换

通过上述方法,您可以实现 COMSOL Multiphysics 与外部软件的数据交换,从而更好地集成和分析仿真结果。无论是从文本文件导入数据,导出数据到 MATLAB,还是通过 API 和 COMSOL Server 实现实时通信,都能满足不同场景下的需求。希望这些内容对您在流体仿真领域的开发工作有所帮助。

kkchenjj的博客 1553

spark sql读取hive数据时报找不到mysql驱动的解决办法

spark sql读取hive数据时报找不到mysql驱动

chx3515的专栏 2880

回归预测 | MATLAB实现SVR(支持向量机回归)K折交叉验证

回归预测 | MATLAB实现SVR(支持向量机回归)K折交叉验证 目录回归预测 | MATLAB实现SVR(支持向量机回归)K折交叉验证基本介绍划分原理留一划分交叉验证K折交叉数据下载程序设计参考资料致谢 基本介绍 在机器学习里,通常来说我们不能将全部用于数据训练模型,否则我们将没有数据集对该模型进行验证,从而评估我们的模型的预测效果。为了解决这一问题,有如下常用的方法: 第一种是最简单的,也是很容易就想到的。我们可以把整个数据集分成两部分,一部分用于训练,一部分用于验证,这也就是我们经常提到的训练集

机器学习之心的博客,关注并私信文章链接,获取对应文章源码和数据。 6375

使用Spark SQL读取Hive上的数据

Spark SQL主要目的是使得用户可以在Spark上使用SQL,其数据源既可以是RDD,也可以是外部的数据源(比如Parquet、Hive、Json等)。Spark SQL的其中一个分支就是Spark on Hive,也就是使用Hive中HQL的解析、逻辑执行计划翻译、执行计划优化等逻辑,可以近似认为仅将物理执行计划从MR作业替换成了Spark作业。本文就是来介绍如何通过Spark SQL来读取...

杜海的博客 6820

第95章 安全工程师:Shell 脚本实现安全扫描、漏洞检测、日志审计

随着网络安全威胁日益复杂,传统的手动安全管理已无法满足现代企业的安全需求。Shell 脚本为安全工程师提供了强大的自动化能力,能够实现 7×24 小时的安全监控、快速漏洞扫描、智能日志分析和实时威胁响应。本章将系统介绍如何使用 Shell 脚本构建完整的安全防护体系,从基线检查到实时监控,帮助你打造自动化的安全运维能力。

猪猪侠 90

程序员应用AI大模型创业实现财务自由的100种赚钱方案原理与实战指南

成功的 AI 创业者都遵循着 “技术 + 需求 + 变现” 的铁三角法则。记住:不是要做 “全能大模型”,而是成为某个垂直领域的 “AI 解决方案专家”。现在就开始行动:用周末 2 小时完成第一个 MVP,下周启动种子用户测试,三个月内找到可复制的盈利模式。当你实现第一个 10 万用户时,会发现财务自由的密码藏在持续迭代的每个 0.1 版本更新中。延伸思考:你的技术背景适合切入哪个细分领域?

AI天才研究院 1380

Spark大数据分析与实战笔记(第四章 Spark SQL结构化数据文件处理-05)

Spark的开发工程师们考虑到了这个问题,利用SQL语言的语法简洁、学习门槛低以及在编程语言普及程度和流行程度高等诸多优势,从而开发了Spark SQL模块,通过Spark SQL,开发人员能够通过使用SQL语句,实现对结构化数据的处理。Apache Hive是Hadoop上的SQL引擎,也是大数据系统中重要的数据仓库工具,Spark SQL支持访问Hive数据仓库,然后在Spark引擎中进行统计分析。下面在Spark-Shell中编写代码,添加两条数据到person表中,代码具体如下所示。

从事移动开发八年,csdn博客专家,阿里云特邀专家,华为云云享专家,高级网络信息安全工程师,大数据工程师(高级),python技术开发(高级),HarmonyOS 应用开发者高级认证,现在某学校任教。 2万+

C#里使用NModbus来创建一个TCP从站服务

摘要:本文介绍了一个用C#实现的Modbus TCP从站服务器,基于.NET Framework 4.6.1开发。代码使用NModbus库创建TcpListener和ModbusSlaveNetwork,支持设置IP地址、端口号和从站ID。服务器实现了数据存储初始化功能(包括线圈和保持寄存器),并提供了启动/停止操作的UI界面和日志记录功能。该解决方案适用于需要调试Modbus TCP协议的场景,特别适合无法升级到更高版本.NET Framework的环境。

大坡3D软件开发 478

Spark(第六节—1)Spark中直接执行hive查询,Spark整合hive,SparkSQL的使用案例,Spark读取MySQL,Spark写入MySQL

Spark中执行hql 创建maven工程,pom如下: <properties> <scala.version>2.11.8</scala.version> <spark.version>2.2.0</spark.version> </properties> <dependencies> <dependency> <groupId>org.scala-lang</groupId&gt

hwq317622817的博客 901

Outlook Express 6 (OE6) for Win7/Win8/Win10

英文版 Outlook Express6.0, 兼容Win7/Win10/WinXP,解压就可用。

jdk-8u144-linux-x64.tar.gz.

该资源为搭建Linux系统Java环境用,资源的后缀为tar.gz格式的压缩包

Spark 读写Hive 表

Spark 操作Hive可以采用两种方式,一种是在Spark-sql中操作Hive表,另一种是通过Hive 的MetaStore在IDEA中操作Hive表,接下来分别介绍这两种方式 Spark-Shell操作Hive表 1.环境配置 将hive.xml 放置到Spark的conf目录下面,这里可以采用软连接的方式操作 将MySQL的驱动包放到Spark的jars目录下面,方便Spark连接MySQL 2.进入spark-sql客户端 $SPARK_HOME/bin/spark-sql spark-.

Nice的博客 8396

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

Spark-SQL核心编程

Spark SQL CLI 可以很方便的在本地运行 Hive 元数据服务以及从命令行执行查询任务。在 Spark 目录下执行如下命令启动 Spark SQL CLI,直接执行 SQL 语句,类似于 Hive 窗口。➢ Spark 要接管 Hive 需要把 hive-site.xml 拷贝到 conf/目录下,并将url中的localhost改为node01。D:\spark\spark-3.0.0-bin-hadoop3.2\bin当中直接运行spark-sql。Spark-SQL连接Hive。

2401_82459288的博客 2083

汉书HE8,好用的汇编代码编写工具

汉书HE8,好用的汇编代码编写工具早期编写汇编代码所用功能强大

使用pyspark读取hive数据

之前试过pyhive直接读取hive数据,有几个依赖一直装不上,经过几天的摸索,终于使用spark自带的sql支持能够成功读取hive的数据。 其中的坑很大,有很多配置文件需要写,特此记录一下。 第一步全局环境变量: vim ~/.bash_profile(mac) vim ~/.bashrc(linux) 配置好hadoop spark hive java的环境变量 以及pyspark的默认python解释器的路径和pyspark-shell的ippython路径,不然后报错。 5 ##homebre

weixin_45939774的博客 3576

spark sql之访问 hive 和 MySQL

一,准备工作: 1,添加mysql的驱动jar包。 将mysql-connector-java-5.0.6-bin.jar 添加到 SPARK_HOME/lib/目录下. 2, 曾加SPARK_HOME/conf目录下的文件: hive的hive-site.xml, hadoop的core-site.xml(为安全起见),hdfs-sit

young_so_nice的博客 5546

hive on spark 集成(spark-sql 整合hive)

hive on spark的整合配置及具体实现文档

Siobhan_Mxin的博客 1610
上一篇: 执行spark sql 遇到的问题
下一篇: Hive的内置服务和hiveserver/hiveserver2的比较
TheManOfCoding
博客等级 码龄9年 24粉丝 21原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值