当前位置:Gxlcms > 数据库问题 > 1、spark-sql配置

1、spark-sql配置

时间:2021-07-01 10:21:17 帮助过:14人阅读

  1、在 /soft/spark/conf 下创建 /soft/hive/conf/hive-site.xml 的软链接

ln -s /soft/hive/conf/hive-site.xml /soft/spark/conf/hive-site.xml

  2、复制 /soft/hive/lib 下的mysql连接jar包到,spark的jars下

cp mysql-connector-java-5.1.44.jar /soft/spark/jars/

  3、关闭 hive 的hive-site.xml 中的版本检查,否则会报版本不一致异常

<property>
    <name>hive.metastore.schema.verification</name>
    <value>false</value>
</property>

  4、启动spark shell

//s101上开启
spark-shell --master spark://s101:7077

  

3、在 idea 中配置 spark sql 环境

  1、新建scala模块,添加maven支持

  2、添加依赖

<dependencies>
        <dependency>
            <groupId>org.apache.spark</groupId>
            <artifactId>spark-sql_2.11</artifactId>
            <version>2.1.0</version>
        </dependency>

        <dependency>
            <groupId>org.apache.spark</groupId>
            <artifactId>spark-hive_2.11</artifactId>
            <version>2.1.0</version>
        </dependency>

        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>5.1.44</version>
        </dependency>
    </dependencies>

  3、复制core-site.xml、hdfs-site.xml、hive-site.xml文件到模块的resources目录下

  技术分享图片

 

1、spark-sql配置

标签:rop   实现   spark sql   class   ast   one   sch   构建   code   

人气教程排行