搭建 hive 环境 mysql 作为metastore

  • linux 单机模式HBase (一)
  • 使用Hbase 存取数据 (二)
  • 使用java api 访问 hbase (三)
  • 使用phoenix 操作 hbase(四)
  • 使用phoenix-hbase-client 和 squirrel 图形化工具(五)
  • 搭建 hive 环境 mysql 作为metastore

hive 基于hadoop,hadoop 安装参考: hadoop伪分布式搭建

搭建 hive 环境

环境准备:
jdk1.8
hadoop-2.5.1
hbase-1.1.2
hive-0.13.0
下载地址(apache历史归档中要啥有啥):
http://archive.apache.org/dist/
hive 获取:
    wget http://archive.apache.org/dist/hive/hive-0.13.0/apache-hive-0.13.0-bin.tar.gz
创建安装目录:
mkdir -p /opt/hive
下载到 /opt/hive
解压  tar -xzvf apache-hive-0.13.0-bin.tar.gz
将 mysql-connnector-java.jar 放置/lib
环境变量:
记得 $HADOOP_HOME 要配置
hive 启动会依赖
配置文件设置:
hive-env.sh  不用修改

hive-site.xml 内容如下
<configuration>
    
    
    
    
    
    <property>
        <name>javax.jdo.option.ConnectionURLname>
        <value>jdbc:mysql://192.168.1.124:3306/hive?createDatabaseIfNotExist=truevalue>
    property>
    <property>
        <name>javax.jdo.option.ConnectionDriverNamename>
        <value>com.mysql.jdbc.Drivervalue>
    property>
    <property>
        <name>javax.jdo.option.ConnectionUserNamename>
        <value>rootvalue>
    property>
    <property>
        <name>javax.jdo.option.ConnectionPasswordname>
        <value>rootvalue>
    property>
configuration>    
启动 hive:
bin/hive
[root@master bin]# ./hive
Listening for transport dt_socket at address: 8000

Logging initialized using configuration in jar:file:/home/hive/apache-hive-0.13.0-bin/lib/hive-common-0.13.0.jar!/hive-log4j.properties
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/home/hadoop/hadoop-2.5.1/share/hadoop/common/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/home/hbase/hbase-1.1.2/lib/phoenix-4.10.0-HBase-1.1-client.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
Java HotSpot(TM) Server VM warning: You have loaded library /home/hadoop/hadoop-2.5.1/lib/native/libhadoop.so.1.0.0 which might have disabled stack guard. The VM will try to fix the stack guard now.
It's highly recommended that you fix the library with 'execstack -c ', or link it with '-z noexecstack'.
hive> 
    > 
    > select * from t2;    
OK
1   wendy   20
2   happy   30
3   cate    32
Time taken: 0.842 seconds, Fetched: 3 row(s)
hive> 
hive 元数据自动生成到mysql配置

 <property>
        <name>javax.jdo.option.ConnectionURLname>
        <value>jdbc:mysql://192.168.1.124:3306/hive?createDatabaseIfNotExist=truevalue>
    property>
查看hive 启动后的hive 元数据库

搭建 hive 环境 mysql 作为metastore_第1张图片

你可能感兴趣的:(HBase)