zoukankan      html  css  js  c++  java
  • spark集成hivecontext配置

    spark版本:spark-1.6.0-bin-hadoop2.6
    hive版本:hive 1.2.1

    1.hive-site.xml
    <property>
      <name>hive.metastore.uris</name>
      <value>thrift://master:9083</value>
    </property>

    2.配置
    将hadoop中core-site.xml,hdfs-site.xml, 放在spark中conf下面
    将hive中hive-site.xml,放在spark中conf下面
    然后将上面三个文件分发到其它spark节点上面。

    3.启动 hive metastore
    nohup hive --service metastore > metastore.log 2>&1 &

    4.yarn提交
    spark-submit --master yarn-cluster
    --class com.jp.spark.sparksql.HiveContextSelect
    --files /usr/local/spark-1.6.0-bin-hadoop2.6/conf/hive-site.xml
    --jars datanucleus-api-jdo-3.2.6.jar,datanucleus-core-3.2.10.jar,datanucleus-rdbms-3.2.9.jar,mysql-connector-java-5.1.39.jar,guava-15.0.jar
    /home/jumper/jp_spark-1.0-SNAPSHOT.jar
    guava-15.0.jar 有比较好,否则会报警告。


    4.spark-shell启动
    spark-shell guava-15.0.jar

    5.HiveContextSelect内容

    object HiveContextSelect{
      def main(args: Array[String]) {
        val conf = new SparkConf()
        //  conf.setMaster("local");
        conf.setAppName("FirstSelect")
        val sc = new SparkContext(conf)
        val hiveContext = new HiveContext(sc)
        import hiveContext.implicits._
        import hiveContext.sql
        sql("show databases").collect().foreach(println)
        sc.stop()
      }
    }
    



  • 相关阅读:
    DOM节点的删除(jQuery)
    DOM节点的插入(jQuery)
    DOM节点创建(jQuery)
    jQuery的属性及样式
    jQuery选择器
    jQuery对象及DOM对象
    给大家分享一个很好用的屏幕共享小软件
    Web单浏览器登录
    Winform制作圆弧panel
    Winform 无边框窗口移动自定义边框粗细颜色
  • 原文地址:https://www.cnblogs.com/xunianchong/p/5626352.html
Copyright © 2011-2022 走看看