zoukankan      html  css  js  c++  java
  • Hive元数据配置到MySql

    1 驱动拷贝

    1.在/opt/software/mysql-libs目录下解压mysql-connector-java-5.1.27.tar.gz驱动包

    [root@hadoop102 mysql-libs]# tar -zxvf mysql-connector-java-5.1.27.tar.gz

    2.拷贝/opt/software/mysql-libs/mysql-connector-java-5.1.27目录下的mysql-connector-java-5.1.27-bin.jar到/opt/module/hive/lib/

    [root@hadoop102 mysql-connector-java-5.1.27]# cp mysql-connector-java-5.1.27-bin.jar
     /opt/module/hive/lib/

    2 配置Metastore到MySql

    1.在/opt/module/hive/conf目录下创建一个hive-site.xml

    [FLY@hadoop102 conf]$ touch hive-site.xml
    [FLY@hadoop102 conf]$ vi hive-site.xml

    2 配置Metastore到MySql

    1.在/opt/module/hive/conf目录下创建一个hive-site.xml

    [FLY@hadoop102 conf]$ touch hive-site.xml
    [FLY@hadoop102 conf]$ vi hive-site.xml

    2.根据官方文档配置参数,拷贝数据到hive-site.xml文件中

    https://cwiki.apache.org/confluence/display/Hive/AdminManual+MetastoreAdmin

    <?xml version="1.0"?>
    <?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
    <configuration>
        <property>
          <name>javax.jdo.option.ConnectionURL</name>
          <value>jdbc:mysql://hadoop102:3306/metastore?createDatabaseIfNotExist=true</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>000000</value>
          <description>password to use against metastore database</description>
        </property>
    </configuration>

    3.配置完毕后,如果启动hive异常,可以重新启动虚拟机。(重启后,别忘了启动hadoop集群)

    3 多窗口启动Hive测试

    1.先启动MySQL

    [FLY@hadoop102 mysql-libs]$ mysql -uroot -p000000

    查看有几个数据库

    mysql> show databases;
    +--------------------+
    | Database           |
    +--------------------+
    | information_schema |
    | mysql             |
    | performance_schema |
    | test               |
    +--------------------+

    2.再次打开多个窗口,分别启动hive

    [FLY@hadoop102 hive]$ bin/hive

    3.启动hive后,回到MySQL窗口查看数据库,显示增加了metastore数据库

        mysql> show databases;
    +--------------------+
    | Database           |
    +--------------------+
    | information_schema |
    | metastore          |
    | mysql             |
    | performance_schema |
    | test               |
    +--------------------+
  • 相关阅读:
    H5上传图片
    关于mysql本地无法连接问题
    node.js、git、bootstrap等安装配置
    angularJS2-日志
    day21-python操作mysql1
    day20-正则表达式练习
    day19-python的正则表达式2
    day18-python的正则表达式
    day17-json格式转换
    day16-python常用的内置模块2
  • 原文地址:https://www.cnblogs.com/tesla-turing/p/11668610.html
Copyright © 2011-2022 走看看