Hive入门

一、安装

下载后解压,配置很简单,底层是MR程序,所以只需要设置一下环境变量就可以使用了。

# hadoop的安装目录和hive的conf目录
# Set HADOOP_HOME to point to a specific hadoop install directory
HADOOP_HOME=/home/hadoop/cdh/hadoop-2.5.0-cdh5.3.6

# Hive Configuration Directory can be controlled by:
export HIVE_CONF_DIR=/home/hadoop/cdh/hive-0.13.1-cdh5.3.6/conf

进入hive进行测试

bin/hive
show databases;

二、案例

1、mysql数据库需要的配置


  javax.jdo.option.ConnectionURL
  jdbc:mysql://master:3306/hive?createDatabaseIfNotExists=true
  JDBC connect string for a JDBC metastore



  javax.jdo.option.ConnectionDriverName
  com.mysql.jdbc.Driver
  Driver class name for a JDBC metastore



  javax.jdo.option.ConnectionUserName
  root
  username to use against metastore database



  javax.jdo.option.ConnectionPassword
  x5
  password to use against metastore database

2、接入hue需要的配置


  hive.server2.thrift.port
  10000
  Port number of HiveServer2 Thrift interface.
  Can be overridden by setting $HIVE_SERVER2_THRIFT_PORT



  hive.server2.thrift.bind.host
  master
  Bind host on which to run the HiveServer2 Thrift interface.
  Can be overridden by setting $HIVE_SERVER2_THRIFT_BIND_HOST



  hive.metastore.uris
  thrift://master:9083

启动hiveserver2

bin/hiveserver2

启动Hive Metastore Server

bin/hive --service metastore -p 9083

你可能感兴趣的:(Hive入门)