hive安装配置

1. 安装MySQL
sudo apt-get install mysql-server mysql-client
 1). 建立数据库hive,并设定为latin1编码,否则出错
create database hive default character set latin1; 
 2). 创建用户hive
create user 'hive'@'%' identified by 'hive'; 
 3).创建hive用户,并授权
grant all on hive.* to hive@'%'  identified by 'hive';  
flush privileges;   
2.安装Hive
  1). 官网下载hive安装包,并解压。
  2).hive配置信息,(hive仅需要在master节点配置即可)
bin/hive-config.sh (可以设置 .profile 文件来略过这步)
export JAVA_HOME=/usr/java
export HIVE_HOME=/home/hadoop/hive-0.11.0
export HADOOP_HOME=/home/hadoop/hadoop-1.2.1
3. 添加环境变量etc/profile
export HIVE_HOME=/home/hadoop/hive-0.11.0
export PATH=$HIVE_HOME/bin:$PATH
4. 修改hive-site.xml文件
<property>     
  <name>javax.jdo.option.ConnectionURL</name>  
  <value>jdbc:mysql://localhost:3306/hive?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>hive</value>     
  <description>username TOUSE against metastore database</description>     
</property>     
<property>     
  <name>javax.jdo.option.ConnectionPassword</name>  
  <value>hive</value>     
  <description>password TOUSE against metastore database</description>     
</property>

5. MySQL 驱动包

下载mysql-connector-java-5.1.18-bin.jar文件,并放到$HIVE_HOME/lib目录下

 6. 启动Hive
•命令行键入  hive
•显示
 WARNING: org.apache.hadoop.metrics.jvm.EventCounter is deprecated. Please use org.apache.hadoop.log.metrics.EventCounter in all the log4j.properties files.
Logging initialized using configuration in jar:file:/home/test/Desktop/hive-0.8.1/lib/hive-common-0.8.1.jar!/hive-log4j.properties
Hive history file=/tmp/test/hive_job_log_test_201208260529_167273830.txt
hive> 
测试语句
•建立测试表test
•create table test (key string);
•show tables;
©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页