- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
这个问题在这里已经有了答案:
How to connect Spark SQL to remote Hive metastore (via thrift protocol) with no hive-site.xml?
(9 个回答)
去年关闭。
我正在尝试使用 Spark SQL 从 Hive Metastore 读取表,但 Spark 给出有关未找到表的错误。恐怕 Spark SQL 会创建一个全新的空元存储。
我通过这个命令提交 spark 任务:
spark-submit --class etl.EIServerSpark --driver-class-path '/opt/cloudera/parcels/CDH/lib/hive/lib/*' --driver-java-options '-Dspark.executor.extraClassPath=/opt/cloudera/parcels/CDH/lib/hive/lib/*' --jars $HIVE_CLASSPATH --files /etc/hive/conf/hive-site.xml,/etc/hadoop/conf/yarn-site.xml --master yarn-client /root/etl.jar
2015-06-30 17:50:51,563 INFO [main] util.Utils (Logging.scala:logInfo(59)) - Copying /etc/hive/conf/hive-site.xml to /tmp/spark-568de027-8b66-40fa-97a4-2ec50614f486/hive-site.xml
2015-06-30 17:50:51,568 INFO [main] spark.SparkContext (Logging.scala:logInfo(59)) - Added file file:/etc/hive/conf/hive-site.xml at http://10.136.149.126:43349/files/hive-site.xml with timestamp 1435683051561
2015-06-30 17:50:51,568 INFO [main] util.Utils (Logging.scala:logInfo(59)) - Copying /etc/hadoop/conf/yarn-site.xml to /tmp/spark-568de027-8b66-40fa-97a4-2ec50614f486/yarn-site.xml
2015-06-30 17:50:51,570 INFO [main] spark.SparkContext (Logging.scala:logInfo(59)) - Added file file:/etc/hadoop/conf/yarn-site.xml at http://10.136.149.126:43349/files/yarn-site.xml with timestamp 1435683051568
2015-06-30 17:50:51,637 INFO [sparkDriver-akka.actor.default-dispatcher-5] util.AkkaUtils (Logging.scala:logInfo(59)) - Connecting to HeartbeatReceiver: akka.tcp://sparkDriver@gateway.edp.hadoop:52818/user/HeartbeatReceiver
2015-06-30 17:50:51,756 INFO [main] netty.NettyBlockTransferService (Logging.scala:logInfo(59)) - Server created on 40198
2015-06-30 17:50:51,757 INFO [main] storage.BlockManagerMaster (Logging.scala:logInfo(59)) - Trying to register BlockManager
2015-06-30 17:50:51,759 INFO [sparkDriver-akka.actor.default-dispatcher-2] storage.BlockManagerMasterActor (Logging.scala:logInfo(59)) - Registering block manager localhost:40198 with 265.4 MB RAM, BlockManagerId(<driver>, localhost, 40198)
2015-06-30 17:50:51,761 INFO [main] storage.BlockManagerMaster (Logging.scala:logInfo(59)) - Registered BlockManager
2015-06-30 17:50:52,840 INFO [main] parse.ParseDriver (ParseDriver.java:parse(185)) - Parsing command: SELECT id, name FROM eiserver.eismpt
2015-06-30 17:50:53,141 INFO [main] parse.ParseDriver (ParseDriver.java:parse(206)) - Parse Completed
2015-06-30 17:50:54,041 INFO [main] metastore.HiveMetaStore (HiveMetaStore.java:newRawStore(502)) - 0: Opening raw store with implemenation class:org.apache.hadoop.hive.metastore.ObjectStore
2015-06-30 17:50:54,064 INFO [main] metastore.ObjectStore (ObjectStore.java:initialize(247)) - ObjectStore, initialize called
2015-06-30 17:50:54,227 WARN [main] DataNucleus.General (Log4JLogger.java:warn(96)) - Plugin (Bundle) "org.datanucleus.store.rdbms" is already registered. Ensure you dont have multiple JAR versions of the same plugin in the classpath. The URL "file:/opt/cloudera/parcels/CDH-5.3.2-1.cdh5.3.2.p0.10/lib/hive/lib/datanucleus-rdbms-3.2.9.jar" is already registered, and you are trying to register an identical plugin located at URL "file:/opt/cloudera/parcels/CDH-5.3.2-1.cdh5.3.2.p0.10/jars/datanucleus-rdbms-3.2.9.jar."
2015-06-30 17:50:54,268 WARN [main] DataNucleus.General (Log4JLogger.java:warn(96)) - Plugin (Bundle) "org.datanucleus.api.jdo" is already registered. Ensure you dont have multiple JAR versions of the same plugin in the classpath. The URL "file:/opt/cloudera/parcels/CDH-5.3.2-1.cdh5.3.2.p0.10/lib/hive/lib/datanucleus-api-jdo-3.2.6.jar" is already registered, and you are trying to register an identical plugin located at URL "file:/opt/cloudera/parcels/CDH-5.3.2-1.cdh5.3.2.p0.10/jars/datanucleus-api-jdo-3.2.6.jar."
2015-06-30 17:50:54,274 WARN [main] DataNucleus.General (Log4JLogger.java:warn(96)) - Plugin (Bundle) "org.datanucleus" is already registered. Ensure you dont have multiple JAR versions of the same plugin in the classpath. The URL "file:/opt/cloudera/parcels/CDH-5.3.2-1.cdh5.3.2.p0.10/lib/hive/lib/datanucleus-core-3.2.10.jar" is already registered, and you are trying to register an identical plugin located at URL "file:/opt/cloudera/parcels/CDH-5.3.2-1.cdh5.3.2.p0.10/jars/datanucleus-core-3.2.10.jar."
2015-06-30 17:50:54,314 INFO [main] DataNucleus.Persistence (Log4JLogger.java:info(77)) - Property datanucleus.cache.level2 unknown - will be ignored
2015-06-30 17:50:54,315 INFO [main] DataNucleus.Persistence (Log4JLogger.java:info(77)) - Property hive.metastore.integral.jdo.pushdown unknown - will be ignored
2015-06-30 17:50:56,109 INFO [main] metastore.ObjectStore (ObjectStore.java:getPMF(318)) - Setting MetaStore object pin classes with hive.metastore.cache.pinobjtypes="Table,StorageDescriptor,SerDeInfo,Partition,Database,Type,FieldSchema,Order"
2015-06-30 17:50:56,170 INFO [main] metastore.MetaStoreDirectSql (MetaStoreDirectSql.java:<init>(110)) - MySQL check failed, assuming we are not on mysql: Lexical error at line 1, column 5. Encountered: "@" (64), after : "".
2015-06-30 17:50:57,315 INFO [main] DataNucleus.Datastore (Log4JLogger.java:info(77)) - The class "org.apache.hadoop.hive.metastore.model.MFieldSchema" is tagged as "embedded-only" so does not have its own datastore table.
2015-06-30 17:50:57,316 INFO [main] DataNucleus.Datastore (Log4JLogger.java:info(77)) - The class "org.apache.hadoop.hive.metastore.model.MOrder" is tagged as "embedded-only" so does not have its own datastore table.
2015-06-30 17:50:57,688 INFO [main] DataNucleus.Datastore (Log4JLogger.java:info(77)) - The class "org.apache.hadoop.hive.metastore.model.MFieldSchema" is tagged as "embedded-only" so does not have its own datastore table.
2015-06-30 17:50:57,688 INFO [main] DataNucleus.Datastore (Log4JLogger.java:info(77)) - The class "org.apache.hadoop.hive.metastore.model.MOrder" is tagged as "embedded-only" so does not have its own datastore table.
2015-06-30 17:50:57,842 INFO [main] DataNucleus.Query (Log4JLogger.java:info(77)) - Reading in results for query "org.datanucleus.store.rdbms.query.SQLQuery@0" since the connection used is closing
2015-06-30 17:50:57,844 INFO [main] metastore.ObjectStore (ObjectStore.java:setConf(230)) - Initialized ObjectStore
2015-06-30 17:50:58,113 INFO [main] metastore.HiveMetaStore (HiveMetaStore.java:createDefaultRoles(560)) - Added admin role in metastore
2015-06-30 17:50:58,115 INFO [main] metastore.HiveMetaStore (HiveMetaStore.java:createDefaultRoles(569)) - Added public role in metastore
2015-06-30 17:50:58,198 INFO [main] metastore.HiveMetaStore (HiveMetaStore.java:addAdminUsers(597)) - No user is added in admin role, since config is empty
2015-06-30 17:50:58,376 INFO [main] session.SessionState (SessionState.java:start(383)) - No Tez session required at this point. hive.execution.engine=mr.
2015-06-30 17:50:58,525 INFO [main] metastore.HiveMetaStore (HiveMetaStore.java:logInfo(632)) - 0: get_table : db=eiserver tbl=eismpt
2015-06-30 17:50:58,525 INFO [main] HiveMetaStore.audit (HiveMetaStore.java:logAuditEvent(314)) - ugi=root ip=unknown-ip-addr cmd=get_table : db=eiserver tbl=eismpt
2015-06-30 17:50:58,567 ERROR [main] metadata.Hive (Hive.java:getTable(1003)) - NoSuchObjectException(message:eiserver.eismpt table not found)
at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.get_table(HiveMetaStore.java:1569)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
最佳答案
配置 Spark 以使用 Hive Metastore thriftserver:
编辑 $SPARK_HOME/conf/hive-site.xml
删除直接连接信息并添加此属性:
<configuration>
<property>
<name>hive.metastore.uris</name>
<value>thrift://localhost:9083</value> /*make sure to replace with your hive-metastore service's thrift url*/
<description>URI for client to contact metastore server</description>
</property>
</configuration>
hive-site.xml
不在
$SPARK_HOME/conf
然后,要连接到 hive Metastore,您需要复制
hive-site.xml
文件到 spark/conf 目录。所以以root用户登录后运行以下命令,
cp /usr/lib/hive/conf/hive-site.xml /usr/lib/spark/conf/
scala>
REPL 提示键入以下内容:
import org.apache.spark.sql.hive.HiveContext
val hiveContext = new org.apache.spark.sql.hive.HiveContext(sc)
hiveContext.sql("CREATE TABLE IF NOT EXISTS TestTable (key INT, value STRING)")
scala> hiveContext.hql("SHOW TABLES").collect().foreach(println)
cd $SPARK_HOME; sbin/stop-thriftserver.sh
停止 Spark SQL thriftserver cd;./start-thriftserver.sh
启动 Hive Metastore thriftserver $HIVE_HOME/logs/metastore.out
对于任何错误。 cd $SPARK_HOME; sbin/start-thriftserver.sh
检查返回行中指示的日志文件。 16/12/29 20:22:19 INFO metastore: Trying to connect to metastore with URI thrift://localhost:9083
16/12/29 20:22:19 INFO metastore: Connected to metastore.
$SPARK_HOME/bin/beeline -u 'jdbc:hive2://localhost:10000/'
并试用
!tables
命令以确保您能够列出元数据。
关于apache-spark - 应该如何配置spark sql来访问hive Metastore?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31144272/
我可以将 CSV 或任何其他平面文件导入到 hive 中,而无需先在 hive 中创建和定义表结构吗?假设我的 csv 文件有 200 列,需要导入到 hive 表中。所以我必须首先在 hive 中创
我有以下示例数据,我试图在 hive 中爆炸它.. 我使用了 split 但我知道我错过了一些东西.. ["[[-80.742426,35.23248],[-80.740424,35.23184],[
我有一个很大的日志文件,我加载到 HDFS . HDFS将根据机架感知复制到不同的节点。 现在我将相同的文件加载到配置单元表中。命令如下: create table log_analysis (log
我正在尝试使用 UDF在 hive 中。但是当我尝试使用 userdate as 'unixtimeToDate' 创建一个临时函数时,我得到这个异常(exception) hive> create
在Mysql中,我们可以使用DO sleep(5) ;来进行暂停。但它在 Hive 中不起作用。 Hive有 sleep 功能吗? 最佳答案 你可以通过反射调用Thread让hive在处理每一行后多等
我正在将数据从 csv 文件导入 Hive。我的表包含字符串和整数。但是,在我的输入文件中,整数周围有空格,所以它看起来像这样: some string, 2 ,another stri
我可以嵌套吗select在 Hive 中具有不同的条件?例如 如果我有以下两个 Hive 查询: select percentile(x, 0.95) from t1 where y = 1; sel
hive 安装有什么特定的模式吗? 例如,Hadoop 安装有 3 种模式:独立、伪分布式和完全分布式。 同样,Hive 是否有任何特定类型的分布? Hive 可以分布式安装吗? 最佳答案 Hive
我正在使用 Hive,我有一个结构如下的表: CREATE TABLE t1 ( id INT, created TIMESTAMP, some_value BIGINT ); 我需要找到
我是 Hadoop 生态系统工具的新手。 任何人都可以帮助我了解 hive 、直线和 hive 之间的区别。 提前致谢! 最佳答案 Apache hive : 1] Apache Hive 是一个建立
如何在 Hive 中写出数组文字? SELECT PERCENTILE(my_column, [0.5, 0.25, 0.50, 0.75, 0.95]) AS quantiles FROM my_t
我正在尝试在Hive中重命名columnName。是否可以在Hive中重命名列名称。 tableA(栏1,_c1,_c2) 至 tableA(column1,column2,column3) ?? 最
减号查询似乎在 HIVE 中不起作用。 尝试过: select x from abc minus select x from bcd ; 我做错了还是没有为 HIVE 定义负查询?如果是这样,还有其他
我正在尝试使用 hive-jdbc 连接将数据插入 Hive (NON-ACID) 表。如果我在“语句”中执行单个 SQL 查询,它就可以工作。如果我尝试使用“addBatch”对 SQL 进行批处理
我知道这些, 要获取表中的列名,我们可以触发: show columns in . 要获取表的描述(包括 column_name、column_type 和许多其他详细信息): describe [f
无法找到有关 Hive 表最大字符限制的合适规范。 我正在开发一个涉及 hive 表的 ETL 过程,这些表已指定格式为 _ 的命名约定,并且提供的表名称远大于 30 字节(pl/sql 的正常限制)
在安装了Hive的集群中,metastore和namenode有什么?我了解 Metastore 拥有所有表架构、分区详细信息和元数据。现在这个元数据是什么?那么namenode有什么呢?这个元存储在
Hive 中静态分区和动态分区的主要区别是什么?使用单独的插入意味着静态,而对分区表的单个插入意味着动态。还有什么优点吗? 最佳答案 在静态分区中,我们需要在每个 LOAD 语句中指定分区列值。 假设
我是 hadoop 和 hive 的新手。如果有人研究过pivot in hive的概念,请与我分享。 例如:来自 teradata 或 oracle 的数据未转置,这些数据应在 hive 中转置。那
1)如果分区列没有数据,那么当你查询它时,你会得到什么错误? 2)如果某些行没有分区列,这些行将如何处理?会不会有数据丢失? 3)为什么需要对数字列进行分桶?我们也可以使用字符串列吗?流程是什么?您将
我是一名优秀的程序员,十分优秀!