sparksql與hive整合
編輯 $HIVE_HOME/conf/hive-site.xml,增加如下內容:
Prettyprint程式碼- <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>
<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>12345
啟動hive metastore
Prettyprint程式碼- 啟動 metastore: $hive --service metastore &
- 檢視 metastore: $jobs[1]+ Running hive --service metastore &
- 關閉 metastore:$kill %1kill %jobid,1代表job id1234567891011
啟動 metastore: $hive --service metastore & 檢視 metastore: $jobs[1]+ Running hive --service metastore & 關閉 metastore:$kill %1kill %jobid,1代表job id1234567891011
spark配置
Prettyprint程式碼- 將 $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模式使用123
將 $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模式使用123
啟動spark-sql
-
standalone模式
Prettyprint程式碼- ./bin/spark-sql --master spark:master:7077 --jars /home/stark_summer/spark/spark-1.4/spark-1.4.1/lib/mysql-connector-java-5.1.12.jar
./bin/spark-sql --master spark:master:7077 --jars /home/stark_summer/spark/spark-1.4/spark-1.4.1/lib/mysql-connector-java-5.1.12.jar
-
1
yarn-client模式
Prettyprint程式碼- $./bin/spark-sql --master yarn-client --jars /home/stark_summer/spark/spark-1.4/spark-1.4.1/lib/mysql-connector-java-5.1.12.jar執行 sql:
- select count(*) from o2o_app;結果:302Time taken: 0.828 seconds, Fetched 1 row(s)2015-09-1418:27:43,158 INFO [main] CliDriver (SessionState.java:printInfo(536)) - Time taken: 0.828 seconds, Fetched 1 row(s)
- spark-sql> 2015-09-1418:27:43,160 INFO [SparkListenerBus] scheduler.StatsReportListener (Logging.scala:logInfo(59)) - Finished stage: [email protected]09-1418:27:43,161 INFO [SparkListenerBus] scheduler.StatsReportListener (Logging.scala:logInfo(59)) - task runtime:(count: 1, mean: 242.000000, stdev: 0.000000, max: 242.000000, min: 242.000000)2015-09-1418:27:43,161 INFO [SparkListenerBus] scheduler.StatsReportListener (Logging.scala:logInfo(59)) - 0% 5% 10% 25% 50% 75% 90% 95% 100%2015-09-1418:27:43,161 INFO [SparkListenerBus] scheduler.StatsReportListener (Logging.scala:logInfo(59)) - 242.0 ms 242.0 ms 242.0 ms 242.0 ms 242.0 ms 242.0 ms 242.0 ms 242.0 ms 242.0 ms2015-09-1418:27:43,162 INFO [SparkListenerBus] scheduler.StatsReportListener (Logging.scala:logInfo(59)) - fetch wait time:(count: 1, mean: 0.000000, stdev: 0.000000, max: 0.000000, min: 0.000000)2015-09-1418:27:43,162 INFO [SparkListenerBus] scheduler.StatsReportListener (Logging.scala:logInfo(59)) - 0% 5% 10% 25% 50% 75% 90% 95% 100%2015-09-1418:27:43,162 INFO [SparkListenerBus] scheduler.StatsReportListener (Logging.scala:logInfo(59)) - 0.0 ms 0.0 ms 0.0 ms 0.0 ms 0.0 ms 0.0 ms 0.0 ms 0.0 ms 0.0 ms2015-09-1418:27:43,163 INFO [SparkListenerBus] scheduler.StatsReportListener (Logging.scala:logInfo(59)) - remote bytes read:(count: 1, mean: 31.000000, stdev: 0.000000, max: 31.000000, min: 31.000000)2015-09-1418:27:43,163 INFO [SparkListenerBus] scheduler.StatsReportListener (Logging.scala:logInfo(59)) - 0% 5% 10% 25% 50% 75% 90% 95% 100%2015-09-1418:27:43,163 INFO [SparkListenerBus] scheduler.StatsReportListener (Logging.scala:logInfo(59)) - 31.0 B 31.0 B 31.0 B 31.0 B 31.0 B 31.0 B 31.0 B 31.0 B 31.0 B2015-09-1418:27:43,163 INFO [SparkListenerBus] scheduler.StatsReportListener (Logging.scala:logInfo(59)) - task result size:(count: 1, mean: 1228.000000, stdev: 0.000000, max: 1228.000000, min: 1228.000000)2015-09-1418:27:43,163 INFO [SparkListenerBus] scheduler.StatsReportListener (Logging.scala:logInfo(59)) - 0% 5% 10% 25% 50% 75% 90% 95% 100%2015-09-1418:27:43,163 INFO [SparkListenerBus] scheduler.StatsReportListener (Logging.scala:logInfo(59)) - 1228.0 B 1228.0 B 1228.0 B 1228.0 B 1228.0 B 1228.0 B 1228.0 B 1228.0 B 1228.0 B2015-09-1418:27:43,164 INFO [SparkListenerBus] scheduler.StatsReportListener (Logging.scala:logInfo(59)) - executor (non-fetch) time pct: (count: 1, mean: 69.834711, stdev: 0.000000, max: 69.834711, min: 69.834711)2015-09-1418:27:43,164 INFO [SparkListenerBus] scheduler.StatsReportListener (Logging.scala:logInfo(59)) - 0% 5% 10% 25% 50% 75% 90% 95% 100%2015-09-1418:27:43,164 INFO [SparkListenerBus] scheduler.StatsReportListener (Logging.scala:logInfo(59)) - 70 % 70 % 70 % 70 % 70 % 70 % 70 % 70 % 70 %2015-09-1418:27:43,165 INFO [SparkListenerBus] scheduler.StatsReportListener (Logging.scala:logInfo(59)) - fetch wait time pct: (count: 1, mean: 0.000000, stdev: 0.000000, max: 0.000000, min: 0.000000)2015-09-1418:27:43,165 INFO [SparkListenerBus] scheduler.StatsReportListener (Logging.scala:logInfo(59)) - 0% 5% 10% 25% 50% 75% 90% 95% 100%2015-09-1418:27:43,165 INFO [SparkListenerBus] scheduler.StatsReportListener (Logging.scala:logInfo(59)) - 0 % 0 % 0 % 0 % 0 % 0 % 0 % 0 % 0 %2015-09-1418:27:43,166 INFO [SparkListenerBus] scheduler.StatsReportListener (Logging.scala:logInfo(59)) - other time pct: (count: 1, mean: 30.165289, stdev: 0.000000, max: 30.165289, min: 30.165289)2015-09-1418:27:43,166 INFO [SparkListenerBus] scheduler.StatsReportListener (Logging.scala:logInfo(59)) - 0% 5% 10% 25% 50% 75% 90% 95% 100%2015-09-1418:27:43,166 INFO [SparkListenerBus] scheduler.StatsReportListener (Logging.scala:logInfo(59)) - 30 % 30 % 30 % 30 % 30 % 30 % 30 % 30 % 30 %12345678910111213141516171819202122232425262728293031
$./bin/spark-sql --master yarn-client --jars /home/stark_summer/spark/spark-1.4/spark-1.4.1/lib/mysql-connector-java-5.1.12.jar執行 sql:
select count(*) from o2o_app;結果:302Time taken: 0.828 seconds, Fetched 1 row(s)2015-09-14 18:27:43,158 INFO [main] CliDriver (SessionState.java:printInfo(536)) - Time taken: 0.828 seconds, Fetched 1 row(s)
spark-sql> 2015-09-14 18:27:43,160 INFO [SparkListenerBus] scheduler.StatsReportListener (Logging.scala:logInfo(59)) - Finished stage: [email protected] 18:27:43,161 INFO [SparkListenerBus] scheduler.StatsReportListener (Logging.scala:logInfo(59)) - task runtime:(count: 1, mean: 242.000000, stdev: 0.000000, max: 242.000000, min: 242.000000)2015-09-14 18:27:43,161 INFO [SparkListenerBus] scheduler.StatsReportListener (Logging.scala:logInfo(59)) - 0% 5% 10% 25% 50% 75% 90% 95% 100%2015-09-14 18:27:43,161 INFO [SparkListenerBus] scheduler.StatsReportListener (Logging.scala:logInfo(59)) - 242.0 ms 242.0 ms 242.0 ms 242.0 ms 242.0 ms 242.0 ms 242.0 ms 242.0 ms 242.0 ms2015-09-14 18:27:43,162 INFO [SparkListenerBus] scheduler.StatsReportListener (Logging.scala:logInfo(59)) - fetch wait time:(count: 1, mean: 0.000000, stdev: 0.000000, max: 0.000000, min: 0.000000)2015-09-14 18:27:43,162 INFO [SparkListenerBus] scheduler.StatsReportListener (Logging.scala:logInfo(59)) - 0% 5% 10% 25% 50% 75% 90% 95% 100%2015-09-14 18:27:43,162 INFO [SparkListenerBus] scheduler.StatsReportListener (Logging.scala:logInfo(59)) - 0.0 ms 0.0 ms 0.0 ms 0.0 ms 0.0 ms 0.0 ms 0.0 ms 0.0 ms 0.0 ms2015-09-14 18:27:43,163 INFO [SparkListenerBus] scheduler.StatsReportListener (Logging.scala:logInfo(59)) - remote bytes read:(count: 1, mean: 31.000000, stdev: 0.000000, max: 31.000000, min: 31.000000)2015-09-14 18:27:43,163 INFO [SparkListenerBus] scheduler.StatsReportListener (Logging.scala:logInfo(59)) - 0% 5% 10% 25% 50% 75% 90% 95% 100%2015-09-14 18:27:43,163 INFO [SparkListenerBus] scheduler.StatsReportListener (Logging.scala:logInfo(59)) - 31.0 B 31.0 B 31.0 B 31.0 B 31.0 B 31.0 B 31.0 B 31.0 B 31.0 B2015-09-14 18:27:43,163 INFO [SparkListenerBus] scheduler.StatsReportListener (Logging.scala:logInfo(59)) - task result size:(count: 1, mean: 1228.000000, stdev: 0.000000, max: 1228.000000, min: 1228.000000)2015-09-14 18:27:43,163 INFO [SparkListenerBus] scheduler.StatsReportListener (Logging.scala:logInfo(59)) - 0% 5% 10% 25% 50% 75% 90% 95% 100%2015-09-14 18:27:43,163 INFO [SparkListenerBus] scheduler.StatsReportListener (Logging.scala:logInfo(59)) - 1228.0 B 1228.0 B 1228.0 B 1228.0 B 1228.0 B 1228.0 B 1228.0 B 1228.0 B 1228.0 B2015-09-14 18:27:43,164 INFO [SparkListenerBus] scheduler.StatsReportListener (Logging.scala:logInfo(59)) - executor (non-fetch) time pct: (count: 1, mean: 69.834711, stdev: 0.000000, max: 69.834711, min: 69.834711)2015-09-14 18:27:43,164 INFO [SparkListenerBus] scheduler.StatsReportListener (Logging.scala:logInfo(59)) - 0% 5% 10% 25% 50% 75% 90% 95% 100%2015-09-14 18:27:43,164 INFO [SparkListenerBus] scheduler.StatsReportListener (Logging.scala:logInfo(59)) - 70 % 70 % 70 % 70 % 70 % 70 % 70 % 70 % 70 %2015-09-14 18:27:43,165 INFO [SparkListenerBus] scheduler.StatsReportListener (Logging.scala:logInfo(59)) - fetch wait time pct: (count: 1, mean: 0.000000, stdev: 0.000000, max: 0.000000, min: 0.000000)2015-09-14 18:27:43,165 INFO [SparkListenerBus] scheduler.StatsReportListener (Logging.scala:logInfo(59)) - 0% 5% 10% 25% 50% 75% 90% 95% 100%2015-09-14 18:27:43,165 INFO [SparkListenerBus] scheduler.StatsReportListener (Logging.scala:logInfo(59)) - 0 % 0 % 0 % 0 % 0 % 0 % 0 % 0 % 0 %2015-09-14 18:27:43,166 INFO [SparkListenerBus] scheduler.StatsReportListener (Logging.scala:logInfo(59)) - other time pct: (count: 1, mean: 30.165289, stdev: 0.000000, max: 30.165289, min: 30.165289)2015-09-14 18:27:43,166 INFO [SparkListenerBus] scheduler.StatsReportListener (Logging.scala:logInfo(59)) - 0% 5% 10% 25% 50% 75% 90% 95% 100%2015-09-14 18:27:43,166 INFO [SparkListenerBus] scheduler.StatsReportListener (Logging.scala:logInfo(59)) - 30 % 30 % 30 % 30 % 30 % 30 % 30 % 30 % 30 %12345678910111213141516171819202122232425262728293031
-
yarn-cluster模式
- ./bin/spark-sql --master yarn-cluster --jars /home/dp/spark/spark-1.4/spark-1.4.1/lib/mysql-connector-java-5.1.12.jarError: Cluster deploy mode is not applicable to Spark SQL shell.
- Run with --help for usage help or --verbose for debug output2015-09-1418:28:28,291 INFO [Thread-0] util.Utils (Logging.scala:logInfo(59)) - Shutdown hook called
- Cluster deploy mode 不支援的123456
./bin/spark-sql --master yarn-cluster --jars /home/dp/spark/spark-1.4/spark-1.4.1/lib/mysql-connector-java-5.1.12.jarError: Cluster deploy mode is not applicable to Spark SQL shell.
Run with --help for usage help or --verbose for debug output2015-09-14 18:28:28,291 INFO [Thread-0] util.Utils (Logging.scala:logInfo(59)) - Shutdown hook called
Cluster deploy mode 不支援的123456
啟動 spark-shell
-
standalone模式
- ./bin/spark-shell --master spark:master:7077 --jars /home/stark_summer/spark/spark-1.4/spark-1.4.1/lib/mysql-connector-java-5.1.12.jar1
./bin/spark-shell --master spark:master:7077 --jars /home/stark_summer/spark/spark-1.4/spark-1.4.1/lib/mysql-connector-java-5.1.12.jar1
-
yarn-client模式
- ./bin/spark-shell --master yarn-client --jars /home/dp/spark/spark-1.4/spark-1.4.1/lib/mysql-connector-java-5.1.12.jarsqlContext.sql("from o2o_app SELECT count(appkey,name1,name2)").collect().foreach(println)1234
./bin/spark-shell --master yarn-client --jars /home/dp/spark/spark-1.4/spark-1.4.1/lib/mysql-connector-java-5.1.12.jarsqlContext.sql("from o2o_app SELECT count(appkey,name1,name2)").collect().foreach(println)1234
相關推薦
sparksql與hive整合
編輯 $HIVE_HOME/conf/hive-site.xml,增加如下內容: Prettyprint程式碼 <property> <name>hive.metastore.uris</name> <value>thrift://ma
SparkSQL與Hive的整合
cto home 添加 usr onf cal apach local -c 其他的配置hive基本配置就不記錄了!! 1. 拷貝$HIVE_HOME/conf/hive-site.xml $SPARK_HOME/conf/2. 在$SPARK_HOME/conf/目錄
SparkSQL與Hive on Spark的比較
.cn local 順序 沒有 針對 ast custom spark manager 簡要介紹了SparkSQL與Hive on Spark的區別與聯系一、關於Spark簡介在Hadoop的整個生態系統中,Spark和MapReduce在同一個層級,即主要解決分布式計算框
hue(3):Hue與Hive整合
1.修改hive-site.xml <property> <name>hive.server2.thrift.bind.host</name> <value>hadoop</value> </property> &l
elasticsearch 與 hive整合
ElasticSearch是一個基於Lucene構建的開源,分散式,RESTful搜尋引擎。設計用於雲端計算中,能夠達到實時搜尋,穩定,可靠,快速,安裝使用方便。 hive是一個基於hdfs的資料倉庫,方便使用者可以通過一種類sql(HiveQL)的語言對hdfs上面的打
Flume與Hive整合-配置檔案
轉自: https://blog.csdn.net/u013360689/article/details/80361278 https://yq.aliyun.com/ziliao/343865 https://henning.kropponline.de/2015/05/19/hive
SparkSQL和Hive整合
-a. 啟動hive的metastore服務[[email protected] ~]$ /opt/cdh-5.3.6/hive-0.13.1-cdh5.3.6/bin/hive --service metastore &Q>org.apache.th
Hadoop Hive與Hbase整合+thrift
分享一下我老師大神的人工智慧教程!零基礎,通俗易懂!http://blog.csdn.net/jiangjunshow 也歡迎大家轉載本篇文章。分享知識,造福人民,實現我們中華民族偉大復興!  
HBase與Hive的整合案例二
1.案例需求 在 HBase 中已經儲存了某一張表hbase_hive,然後在Hive中建立一個外部表來關聯HBase中的hbase_hive這張表,使之可以藉助 Hive來分析 HBase 這張表中的資料,案例二是緊接著案例一進行的,所以在做案例二之前應該先進行案例一 2.在Hive中建立
HBase與Hive的整合案例一
1.Hive與HBase的對比 Hive 1)資料倉庫 Hive 的本質其實就相當於將 HDFS 中已經儲存的檔案在 Mysql 中做了一個雙射關係,以方便使用 HQL 去管理查詢 2)用於資料分析、清洗
Spark SQL與hive hbase mysql整合
虛擬機器環境:centos7 一、Spark SQL 與Hive整合(spark-shell) 1.需要配置的專案 1)將hive的配置檔案hive-site.xml拷貝到spark conf目錄,同時新增metastore的url配置。 執行
Hive與HBase整合(例項)
例項1 1.先在Hbase中建立表(三列族): create 'ceshi7', {NAME=>'TIME',VERSIONS=>1,BLOCKCACHE=>true,BLOOMFILTER=>'ROW',COMPRESSION=>'SNA
HBase-與Hive的區別、與Sqoop的整合
1、HBase 與 Hive 的對比 Hive: 1)、資料倉庫 Hive 的本質其實就相當於將 HDFS 中已經儲存的檔案在 Mysql 中做了一個雙射關係,以方 便使用 HQL 去管理查詢。 2)、用於資料分析、清洗 Hive 適用於離線的資料分析和清洗,延遲較高。 3)
Hadoop與MongoDB整合(Hive篇)
1.背景 公司希望使用MongoDB作為後端業務資料庫,使用Hadoop平臺作為資料平臺。最開始是先把資料從MongoDB匯出來,然後傳到HDFS,然後用Hive/MR處理。我感覺這也太麻煩了,現在不可能沒有人想到這個問題,於是就搜了一下,結果真找到一個Mon
【伊利丹】Hadoop-2.5.0-CDH5.2.0/Hive與Hbase整合實驗
<value>file:///home/kkzhangtao/hive-0.13.1-cdh5.2.0/lib/hive-hbase-handler-0.8.0.jar,file:///home/kkzhangtao/hive-0.13.1-cdh5.2.0/lib/hbase-common-0.
hive與hbase整合
Hive整合HBase原理Hive與HBase整合的實現是利用兩者本身對外的API介面互相通訊來完成的,其具體工作交由Hive的lib目錄中的hive-hbase-handler-*.jar工具類來實現,通訊原理如下圖所示。Hive整合HBase後的使用場景:(一)通過Hiv
HIVE與mysql的關係 hive常用命令整理 hive與hdfs整合過程
轉:https://my.oschina.net/winHerson/blog/190131 二、hive常用命令 1. 開啟行轉列功能之後: set hive.cli.print.header=true; // 列印列名 set hive.cli.print.row.to.vertical=true; /
Mybatis中Mapper代理形式開發與spring整合
can sna 修改 jar xid oca pac user cal 1.導入jar包 2.分包 cogfig:存放配置文件 mapper:存放映射與接口 pojo:存放實體類 test:測試代碼 3.編寫配置文件 SqlMapConfig.xml <?
Spring與Mybatis整合
base package div classpath conf data pac 是否 ner 一 概述 1.整合的目的 將Mapper映射器的創建任務交給Spring容器。 二 具體實現 1.創建sqlSessionFactory: <bean id="sql
spring與struts2整合出現錯誤HTTP Status 500 - Unable to instantiate Action
alt 問題 blog src nbsp 文件 spa XML color 在進行spring和struts2整合的時候因為大意遇到了一個問題,費了半天神終於找到了問題所在,故分享出來望廣大博友引以為戒!! 我們都知道在spring和struts2整合時,spring接管了