Hive如何使用Mysql存储元数据

  1. 配置hive-site.xml
<configuration>
    <property>
        <name>hive.metastore.local</name>
        <value>true</value>
    </property>
    <property>
        <name>javax.jdo.option.ConnectionURL</name>
        <value>jdbc:mysql://localhost:3306/hive?createDatabaseIfNotExist=true</value>
    </property>
    <property>
        <name>javax.jdo.option.ConnectionDriverName</name>
        <value>com.mysql.jdbc.Driver</value>
    </property>
    <property>
        <name>javax.jdo.option.ConnectionUserName</name>
        <value>hive</value>
    </property>
    <property>
        <name>javax.jdo.option.ConnectionPassword</name>
        <value>hive</value>
    </property>
</configuration>
  1. 下载mysql-connector-java-*.*.jar,放到lib目录下。
  2. 配置hive-env.sh,添加

HADOOP_HOME=/opt/soft/hadoop/hadoop
export HIVE_CONF_DIR=/opt/hive/conf

  1. 初始化数据库

./schematool -initSchema -dbType mysql

    原文作者:TinyKing86
    原文地址: https://www.jianshu.com/p/7e95b0ebccd6
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞