在Hadoop单机环境搭建成功后(见 ),可以搭建hive。
在hdfs上建目录:
$ hmkdir /tmp $ hmkdir /user/hive/warehouse
添加权限:
$ hchmod g+w /tmp $ hchmod g+w /user/hive/warehouse
设置HADOOP_HOME,并将其添加到~/.bashrc
export HADOOP_HOME=/home/zxm/hadoop/hadoop-1.0.3
下载解压hive:
$ wget .
$ tar -zxvf hive-0.8.1.tar.gz
启动hive:
$ cd /home/zxm/hadoop/hive-0.8.1 ; ./bin/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/zxm/hadoop/hive-0.8.1/lib/hive-common-0.8.1.jar!/hive-log4j.properties
Hive history file=/tmp/work/hive_job_log_work_201207051945_218572007.txt
hive> SHOW TABLES;
OK
Time taken: 7.281 seconds
hive> CREATE TABLE pokes (foo INT, bar STRING);
OK
Time taken: 0.398 seconds
hive> SHOW TABLES;
OK
pokes
Time taken: 0.181 seconds
hive> DESCRIBE pokes;
OK
foo int
bar string
Time taken: 0.58 seconds
hive>