---
title: "hive安装"
author: "demon3780"
date: "2011-12-20T23:03:25Z"
tags: []
categories: ["开源软件"]
slug: "hive"
draft: false
lastmod: "2011-12-20T23:13:39Z"
id: 1318664
url: "https://demon3780.iteye.com/blog/1318664"
---

版本：hive-0.8.0  环境：ubuntu  hadoop0.20.2  jdk6.22

conf目录下有配置文件的模板，复制一个重命名一下，hive-default.xml.template--》
hive-site.xml，hive-env.sh.template是hive环境变量配置文件模板，剩下的就是日志的模板。

环境变量配置一
hadoop和jdk均已在/etc/profile文件中配置
在此文件中添加
export HIVE_HOME=/home/xxx/00ewp/00servers/hive-0.8.0
export PATH=$HIVE_HOME/bin:$PATH

保存退出,执行source /etc/profile
如果环境变量未生效,可重启一下机器。

配置方法二
在bin目录下hive-config.sh
中配置export HIVE_HOME=/home/xxx/00ewp/00servers/hive-0.8.0

启动,执行./bin/hive --auxpath
Logging initialized using configuration in file:/home/xxx/00ewp/00servers/hive-0.8.0/conf/hive-log4j.properties
Hive history file=/tmp/xxx/hive_job_log_xxx201112201450_1253545988.txt
hive> CREATE TABLE pokes (foo INT, bar STRING);  
创建表，如果失败请检查hadoop是否启动，启动顺序不分先后更多操作参加https://cwiki.apache.org/confluence/display/Hive/GettingStarted

启动web管理
./bin/hive --service hwi   
览器输入：http://xxxxx:9999/hwi/


ps:按照官方的列子操作一下，每次执行相同的count 的sql 语句都会向hadoop提交一个job进行计算得出合计条数。
sql语句的关键字必须大写，这个不太方便。
内置一个derby的数据库引擎。