spark创建外部表时报错

jerryliun 2017-09-22 11:23:46
环境如下:

vi /hadoop/spark/conf/spark-env.sh
export SPARK_CLASSPATH="/hadoop/spark/lib/mysql-connector-java.jar:/hadoop/spark/lib/sequoiadb-driver-1.12.jar:/hadoop/spark/lib/spark-sequoiadb_2.10-1.12.0.jar"
复制代码


在创建外部临时表时报错如下:

scala> sqlContext.sql("CREATE temporary table foobar USING com.sequoiadb.spark OPTIONS ( host 'master:11810,node1:11810,node2:11810', collectionspace 'foo', collection 'bar')")
16/06/14 18:22:52 WARN NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
java.lang.RuntimeException: Failed to load class for data source: com.sequoiadb.spark
at scala.sys.package$.error(package.scala:27)
at org.apache.spark.sql.sources.ResolvedDataSource$.lookupDataSource(ddl.scala:220)
at org.apache.spark.sql.sources.ResolvedDataSource$.apply(ddl.scala:233)
at org.apache.spark.sql.sources.CreateTempTableUsing.run(ddl.scala:412)
at org.apache.spark.sql.execution.ExecutedCommand.sideEffectResult$lzycompute(commands.scala:57)
at org.apache.spark.sql.execution.ExecutedCommand.sideEffectResult(commands.scala:57)
at org.apache.spark.sql.execution.ExecutedCommand.doExecute(commands.scala:68)
at org.apache.spark.sql.execution.SparkPlan$anonfun$execute$1.apply(SparkPlan.scala:88)
at org.apache.spark.sql.execution.SparkPlan$anonfun$execute$1.apply(SparkPlan.scala:88)
at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:147)
at org.apache.spark.sql.execution.SparkPlan.execute(SparkPlan.scala:87)
at org.apache.spark.sql.SQLContext$QueryExecution.toRdd$lzycompute(SQLContext.scala:950)
at org.apache.spark.sql.SQLContext$QueryExecution.toRdd(SQLContext.scala:950)
at org.apache.spark.sql.DataFrame.<init>(DataFrame.scala:144)
at org.apache.spark.sql.DataFrame.<init>(DataFrame.scala:128)
at org.apache.spark.sql.DataFrame$.apply(DataFrame.scala:51)
at org.apache.spark.sql.SQLContext.sql(SQLContext.scala:755)
at $iwC$iwC$iwC$iwC$iwC$iwC$iwC$iwC.<init>(<console>:20)
at $iwC$iwC$iwC$iwC$iwC$iwC$iwC.<init>(<console>:25)
at $iwC$iwC$iwC$iwC$iwC$iwC.<init>(<console>:27)
at $iwC$iwC$iwC$iwC$iwC.<init>(<console>:29)
at $iwC$iwC$iwC$iwC.<init>(<console>:31)
at $iwC$iwC$iwC.<init>(<console>:33)
at $iwC$iwC.<init>(<console>:35)
at $iwC.<init>(<console>:37)
at <init>(<console>:39)
at .<init>(<console>:43)
at .<clinit>(<console>)
at .<init>(<console>:7)
at .<clinit>(<console>)
at $print(<console>)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.spark.repl.SparkIMain$ReadEvalPrint.call(SparkIMain.scala:1065)
at org.apache.spark.repl.SparkIMain$Request.loadAndRun(SparkIMain.scala:1338)
at org.apache.spark.repl.SparkIMain.loadAndRunReq$1(SparkIMain.scala:840)
at org.apache.spark.repl.SparkIMain.interpret(SparkIMain.scala:871)
at org.apache.spark.repl.SparkIMain.interpret(SparkIMain.scala:819)
at org.apache.spark.repl.SparkILoop.reallyInterpret$1(SparkILoop.scala:857)
at org.apache.spark.repl.SparkILoop.interpretStartingWith(SparkILoop.scala:902)
at org.apache.spark.repl.SparkILoop.command(SparkILoop.scala:814)
at org.apache.spark.repl.SparkILoop.processLine$1(SparkILoop.scala:657)
at org.apache.spark.repl.SparkILoop.innerLoop$1(SparkILoop.scala:665)
at org.apache.spark.repl.SparkILoop.org$apache$spark$repl$SparkILoop$loop(SparkILoop.scala:670)
at org.apache.spark.repl.SparkILoop$anonfun$org$apache$spark$repl$SparkILoop$process$1.apply$mcZ$sp(SparkILoop.scala:997)
at org.apache.spark.repl.SparkILoop$anonfun$org$apache$spark$repl$SparkILoop$process$1.apply(SparkILoop.scala:945)
at org.apache.spark.repl.SparkILoop$anonfun$org$apache$spark$repl$SparkILoop$process$1.apply(SparkILoop.scala:945)
at scala.tools.nsc.util.ScalaClassLoader$.savingContextLoader(ScalaClassLoader.scala:135)
at org.apache.spark.repl.SparkILoop.org$apache$spark$repl$SparkILoop$process(SparkILoop.scala:945)
at org.apache.spark.repl.SparkILoop.process(SparkILoop.scala:1059)
at org.apache.spark.repl.Main$.main(Main.scala:31)
at org.apache.spark.repl.Main.main(Main.scala)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.spark.deploy.SparkSubmit$.org$apache$spark$deploy$SparkSubmit$runMain(SparkSubmit.scala:665)
at org.apache.spark.deploy.SparkSubmit$.doRunMain$1(SparkSubmit.scala:170)
at org.apache.spark.deploy.SparkSubmit$.submit(SparkSubmit.scala:193)
at org.apache.spark.deploy.SparkSubmit$.main(SparkSubmit.scala:112)
at org.apache.spark.deploy.SparkSubmit.main(SparkSubmit.scala)
...全文
683 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复
可能是scala驱动版本不匹配
⼤数据应⽤测试经验总结 ⼤数据应⽤测试经验总结 ⼤数据应⽤测试过程与传统的web系统有较⼤的不同,⼤数据应⽤测试通常会分为web侧和ETL侧测试,web侧基本就是功能测试,⽽ETL(Extracting-Transfroming- Loading)测试主要指从任何外部系统提取、转换、载⼊数据到⽬标地。从底层数据采集、数据处理、到上层应⽤展现。 ⼀、从技术架构设计上,分为以下⼏块: 1. 数据采集:采集使⽤java和python程序从⽂件服务器下载⽂件,并把⽂件写⼊kafka、Hbase和Hive、Mysql中; 2. 计算引擎:使⽤Hive on Tez计算引擎实现ETL跑批任务;使⽤spark streaming实现实时计算;使⽤Phoenix做前台交互式查询。 3. 数据存储:使⽤Kafka、Hive、Hbase、MySQL满⾜各层次存储技术需求。 4. 任务调度:使⽤Quartz实现作业调度及管理。 5. 监控接⼝:使⽤Kafka、⽂件接⼝对接统⼀监控平台。 6. 数据可视化:使⽤JQuery、Echarts、Easy UI等技术实现图表、表格展⽰;使⽤Apache POI实现excel、CSV的导⼊导出;使⽤Log4J记录⽇志;使⽤Spring框架实现 页⾯、服务、数据的集成管理;使⽤DBCP实现数据库连接池。 7. 数据模型层次说明 ODS:贴源层,存储原始数据,数据采集直接写⼊; DWD:数据仓库明细层,存储从源数据抽去过来的明细数据; DW:数据仓库层,保存经过数据降维汇聚的计算后⽣成的汇总数据; DM:数据集市层,满⾜特定功能⽽建⽴的各种数据集市。 1. 数据处理过程说明 1. 数据采集模块从采集机采集相关业务数据; 2. 数据采集模块定期把原始数据导⼊Hive库中的ODS层相关表中;实时数据及时写⼊kafka提供给spark streaming处理;公参数据写⼊mysql中。 3. ETL模块从ODS层相关表中抽取数据到DWD层; 4. ETL模块根据轻度汇总要求进⾏数据轻度汇总操作,并把汇总后的数据放到DW层中; 5. ⼀些功能所需数据⽆法从轻度汇总表计算出来,需要从DWD中原始表进⾏汇总; 6. ETL模块从DW层获取轻度汇总数据,根据各业务功能要求进⼀步汇总数据,形成DM层数据; 7. 即席查询数据从Hive关联到Hbase中; 8. Phoenix关联到HBase中,供页⾯查询使⽤; 9. 部分ETL模块数据把Hive中汇总后数据导⼊MySQL中,供模型建模使⽤; ⼆、Hadoop运⾏: mapreduce机制: 常⽤命令: 功能 功能 命令 命令 查看⽬录 hadoop fs -ls dir 上传⽂件 hadoop fs -put ${local file} ${hdfs file} 创建⽬录 hadoop fs -mkdir ${dirname} 获取⽂件 hadoop fs -get ${hdfs file} ${local file} 删除多个⽂件或⽬录 hadoop fs -rm ${hdfs file} ... hadoop fs -rm -r ${hdfs file}... 复制⽂件 hadoop fs -cp ${hdfs file} ${hdfs file} 移动⽂件 hadoop fs -mv ${hdfs file} ${hdfs file} 三、hive和hbase⽐较: Hive(⾮数据库) Hbase(数据库) 适⽤场景 ⽤于对⼀段时间内的数据进⾏分析查询,离线批处理 ⼤数据的实时查询 特点 1、⼀种类SQL的引擎,运⾏MapReduce任务; 2、查询⼀般是全量查询,时间较长,可通过分区来优化; 3、基于⾏查询,定义时每⾏有固定列数据,每列数据固定⼤⼩; 4、操作:不⽀持更新操作 1、⼀种在Hadoop之上的NoSQL型Key/Value数据库; 2、查询是通过特定语⾔编写,可通过Phonenix实现类SQL功能; 3、基于列查询,可定义各种不同的列,每列数据⼤⼩不固定; 四、hive常⽤操作 hive 基础操作 基础操作 说明 说明 查看数据 库 show databases 使⽤数据 库 use DbName 删除数据 库 drop database if exists DbName CASCADE 如果数据库不为空,删除会报错,加上cascade可忽略 查看表 show tables in DbName ; show tables like 'h*' 创建表 内部表:CREATE TABLE page_view if not exists(viewTime INT, userid BIGINT, page_url STRING, referrer_url STRIN

2,209

社区成员

发帖
与我相关
我的任务
社区描述
其他数据库开发 其他数据库
社区管理员
  • 其他数据库社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧