hive配置

./hive --service metastore

初始化 将元数据存储在MySQL

 bin/schematool -initSchema -dbType mysql

hive-env.sh:

export HADOOP_HOME=/opt/module/hadoop

export HIVE_CONF_DIR=/opt/module/hive/conf

hive-site.xml:

<configuration>
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://hadoop102:3306/metastore?createDatabaseIfNotExist=true</value>
<!--<value>jdbc:mysql://hadoop102:3306/metastore?createDatabaseIfNotExist=true&useUnicode=true&characterEncoding=utf-8</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>root</value>
<description>username to use against metastore database</description>
</property>

<property>
<name>javax.jdo.option.ConnectionPassword</name>
<value>root</value>
<description>password to use against metastore database</description>
</property>

<property>
<name>hive.metastore.schema.verification</name>
<value>false</value>
</property>
<property>
<name>hive.cli.print.current.db</name>
<value>true</value>
</property>
<property>
<name>hive.cli.print.header</name>
<value>true</value>
</property>
<!-- 这是hiveserver2 -->
<property>
<name>hive.server2.thrift.port</name>
<value>10000</value>
</property>

<property>
<name>hive.server2.thrift.bind.host</name>
<value>192.168.200.102</value>
</property>
<!--spark连接hive-->

 <!--spark连接hive-->

  <property>

    <name>hive.metastore.warehouse.dir</name>

    <value>/user/hive/warehouse</value>

  </property>

  <property>

    <name>hive.metastore.local</name>

    <value>false</value>

  </property>

   <property>

     <name>hive.metastore.uris</name>

     <value>thrift://hadoop102:9083</value>

   </property>

</configuration>

<configuration>        <property>          <name>javax.jdo.option.ConnectionURL</name>          <value>jdbc:mysql://hadoop102:3306/metastore?createDatabaseIfNotExist=true</value>          <!--<value>jdbc:mysql://hadoop102:3306/metastore?createDatabaseIfNotExist=true&useUnicode=true&characterEncoding=utf-8</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>root</value>          <description>username to use against metastore database</description>        </property>
        <property>          <name>javax.jdo.option.ConnectionPassword</name>          <value>root</value>          <description>password to use against metastore database</description>        </property>
       <property>                <name>hive.metastore.schema.verification</name>                <value>false</value>        </property>        <property>                 <name>hive.cli.print.current.db</name>                 <value>true</value>        </property>        <property>                 <name>hive.cli.print.header</name>                 <value>true</value>        </property>        <!-- 这是hiveserver2 -->        <property>                 <name>hive.server2.thrift.port</name>                 <value>10000</value>        </property>
        <property>                <name>hive.server2.thrift.bind.host</name>                <value>192.168.200.102</value>        </property> <!--spark连接hive-->
</configuration>

原文地址:https://www.cnblogs.com/chang09/p/15783624.html