本地连接hive

第一步:我们要将相对应集群的三个文件拷贝到本地来,就这三个在这里插入图片描述
位置在/etc/hadoop/conf和/etc/hive/conf下
第二步:要注意core-site.xml中的fs.defaulfFs这个配置项是默认文件系统的名称。一个URI和权威确定文件系统实现的方案。uri的计划决定配置属性(fs.SCHEME.impl)命名文件系统实现类。uri的权威是用来确定主机、端口等对于一个文件系统。我们的cdh或者hadoop集群它都是集群,既然是集群就有主备,这个配置项一定要是活跃的那台机器

第三步:hive.metastore.uris这个配置一定要记得写,否则访问不到数据库,这个是源数据

介绍下metastore: 客户端连接metastore服务,metastore再去连接MySQL数据库来存取元数据。

有了metastore服务,就可以有多个客户端同时连接,而且这些客户端不需要知道MySQL数据库的用户名和密码,只需要连接metastore 服务即可。

随后附上pom文件


4.0.0

org.example
gethive
1.0-SNAPSHOT


    3.2.5
    3.2.5
    2.11.8
    2.6.5
    
    1.9.5
    UTF-8



    
    
        org.scala-lang
        scala-library
        ${scala.version}
    
    
    
    
        org.apache.spark
        spark-core_2.11
        2.2.1
    
    
        org.apache.spark
        spark-sql_2.11
        2.1.1
    
    
        org.apache.spark
        spark-hive_2.11
        2.1.1
        
    

    
    
        org.apache.hadoop
        hadoop-client
        ${hadoop.version}
    

    
        com.typesafe
        config
        1.3.1
    

    
        com.databricks
        spark-xml_2.11
        0.4.1
    


    
        org.apache.hadoop
        hadoop-client
        ${hadoop.version}
    
    
    
        org.apache.spark
        spark-streaming_2.11
        2.2.1
    


    
    
        org.apache.spark
        spark-streaming-kafka-0-8_2.11
        2.2.1
    
    
        org.apache.commons
        commons-pool2
        2.3
    
    
    
        org.apache.kafka
        kafka-clients
        0.10.1.1
    

    
        org.apache.spark
        spark-streaming-kafka-0-10_2.11
        2.2.1
    

    
        mysql
        mysql-connector-java
        5.1.32
    
    
        redis.clients
        jedis
        2.7.2
    


    
        com.lmax
        disruptor
        3.4.2
    



    
        
            
            
                net.alchim31.maven
                scala-maven-plugin
                3.2.2
            
            
            
                org.apache.maven.plugins
                maven-compiler-plugin
                3.5.1
            

        
    
    
        
            net.alchim31.maven
            scala-maven-plugin
            
                
                    scala-compile-first
                    process-resources
                    
                        add-source
                        compile
                    
                
                
                    scala-test-compile
                    process-test-resources
                    
                        testCompile
                    
                
            
        

        
            org.apache.maven.plugins
            maven-compiler-plugin
            
                
                    compile
                    
                        compile
                    
                
            
        


        
        
            org.apache.maven.plugins
            maven-shade-plugin
            2.4.3
            
                
                    package
                    
                        shade
                    
                    
                        
                            
                                *:*
                                
                                    META-INF/*.SF
                                    META-INF/*.DSA
                                    META-INF/*.RSA
                                
                            
                        
                    
                
            
        
    

版本可自行修改

你可能感兴趣的:(spark,hive)