zoukankan      html  css  js  c++  java
  • spark cli

    Spark SQL CLI

    Spark1.1增加了Spark SQL CLI和ThriftServer

    SparkSQL CLI配置

    1、创建并配置hive-site.xml

    在运行Spark SQL CLI中需要使用到Hive Metastore,故需要在Spark中添加其uris。具体方法是在SPARK_HOME/conf目录下创建hive-site.xml文件,然后在该配置文件中,添加hive.metastore.uris属性,具体如下:

    <?xml version="1.0"?>
    <configuration>
    <property>
    <name>hive.metastore.uris</name>
    <value>thrift://m1:9083</value>
    </property>
    </configuration>

    2、启动Hive

    在使用Spark SQL CLI之前需要启动Hive Metastore(如果数据存放在HDFS文件系统,还需要启动Hadoop的HDFS),使用如下命令可以使Hive Metastore启动后运行在后台,可以通过jobs查询:

    $nohup hive --service metastore > metastore.log 2>&1 &

    3、启动spark cli

    如果要连接spark集群,应该首先启动spark集群,此处连接spark集群,因此,如下启动spark集群

    ./sbin/start-all.sh
    

      

    启动前建议调整log4j的日志级别,不然控制台输出内容过多,不利于观察。
    具体修改方法如下:
    1、进入spark conf目录下,重命名log4j.properties.template

    mv log4j.properties.template log4j.properties
    

      

    2、编辑log4j.properties,设置日志级别为ERROR

    log4j.rootCategory=ERROR, console
    

      

    启动cli

    ./bin/spark-sql --master spark://m1:7077 --executor-memory 512m


    测试命令行:

    show databases;


    命令行启动成功后就可以对hive数据进行查询了

    通过spark cli创建表,然后使用HQL进行操作

    create table person 
    ( 
    id int, 
    name string, 
    age int 
    )
    
    row format delimited 
    fields terminated by ' ' ;






  • 相关阅读:
    netcore使用IdentityServer在nginx下502错误的解决
    更新到.netcore3.0后找不到dotnet-ef的解决办法
    openssh-win64 on windows2016 ssh pub key config
    405 Method Not Allowed error with PUT or DELETE Request on IIS Server
    minikube windows hyperx填坑记
    angular当router使用userhash:false时路由404问题
    内网gitlab11.2升级至11.4.5
    Angular7上手体验
    动态规划之背包问题
    Union-Find算法详解
  • 原文地址:https://www.cnblogs.com/heml/p/6775191.html
Copyright © 2011-2022 走看看