SaprkSql 集成 hive (spark2.0+hive1.22 )

来源:互联网 发布:c#windows窗体程序设计 编辑:程序博客网 时间:2024/06/05 18:18

1.两者安装步骤略:

(参见本博客其他资料)

2.hive-site.xml  

scp  hive-site.xml  $SPARK_HOEM/conf

hive-site.xml内容:

(内容实在多的烦就全清空)

<configuration>
<property>
      <name>javax.jdo.option.ConnectionURL</name>
            <value>jdbc:mysql://mach40:3306/hive?createDatabaseIfNotExist=true&amp;characterEncoding=UTF-8&amp;useSSL=false</value>
            <description>JDBC connect string for a JDBC metastore</description>
</property>
    <property>
          <name>javax.jdo.option.ConnectionDriverName</name>
          <value>com.mysql.jdbc.Driver</value>
          <description>Driver class name for a JDBC metastore</description>
    </property>
<property>
          <name>javax.jdo.option.ConnectionUserName</name>
          <value>hive</value>
 <description>username to use against metastore database</description>
  </property>
  <property>
          <name>javax.jdo.option.ConnectionPassword</name>
           <value>hive</value>
           <description>password to use against metastore database</description>
 </property>
  <property>
    <name>hive.querylog.location</name>
    <value>/home/hive1.22/iotmp</value>
  </property>
  <property>
    <name>hive.exec.scratchdir</name>
    <value>/tmp/hive</value>
  </property>
  <property>
    <name>hive.exec.local.scratchdir</name>
    <value>/home/hive1.22/iotmp</value>
    <description>Local scratch space for Hive jobs</description>
  </property>
  <property>
    <name>hive.downloaded.resources.dir</name>
    <value>/home/hive1.22/iotmp</value>
  <description>Temporary local directory for added resources in the remote file system.</description>
  </property>
  <property>
  <name>hive.metastore.uris</name>
  <value>thrift://mach40:9083</value>
 <description>Thrift uri for the remote metastore. Used by metastore client to connect to remote metastore.</description>
  </property>
  
    <property>
    <name>hive.server2.thrift.min.worker.threads</name>
    <value>5</value>
    <description>Minimum number of Thrift worker threads</description>
  </property>
 
  <property>
    <name>hive.server2.thrift.max.worker.threads</name>
    <value>500</value>
    <description>Maximum number of Thrift worker threads</description>
  </property>
 
  <property>
    <name>hive.server2.thrift.port</name>
    <value>10000</value>
    <description>Port number of HiveServer2 Thrift interface. Can be overridden by setting $HIVE_SERVER2_THRIFT_PORT</description>
  </property>
 
  <property>
    <name>hive.server2.thrift.bind.host</name>
    <value>mach42</value>
    <description>Bind host on which to run the HiveServer2 Thrift interface.Can be overridden by setting$HIVE_SERVER2_THRIFT_BIND_HOST</description>
  </property>
  </configuration>


3.驱动包:

scp mysql-connector-java-5.1.41-bin.jar /home/spark2.10/jars/



关于异常:

spark2.0以上的jar 包在$SPARK_HOME/jars下面,启动hive的时候可能汇报错:

没有文件:spark2.0/lib/spark-assmby......jar


处理方式:

vim bin/hive

 spark2.0/lib/spark-assmby......jar  改成 spark2.0/jars/*jar



0 0