第一步:下载hive并解压
tar zxvf hive-0.8.1-bin.tar.gz
重命名: mv hive-0.8.1-bin hive
给权限:chown hadoop:hadoop hive -R
创建文件:mkdir -p /usr/local/hive/hiveData
第二步:配置hive-config.sh及hive-default.xml
开始编辑hive配置文件添加hadoop和JDK路径
vi /usr/local/hive/bin/hive-config.sh export HIVE_HOME=/usr/local/hive export HADOOP_HOME=/usr/local/hadoop export JAVA_HOME=/usr/Java/jre1.6.0_25
建立几个文件夹
cd /usr/local/hadoop bin/hadoop fs -mkdir tmp bin/hadoop fs -mkdir user/hive/warehouse bin/hadoop fs -chmod g+w tmp bin/hadoop fs -chmod g+w user/hive/warehouse
vi /usr/local/hive-default.xml <property> <name>hive.exec.scratchdir</name> <value>/usr/local/hiveData/HIVE-${user.name}</value> <description>Scratch space fro Hive jobs</description> </property>
第三步:测试hive
cd /usr/local/hive/bin
hive> create table t_afan_test(info1 array<int>,info2 array<string>) ROW FORMAT DELIMITED FIELDS TERMINATED BY ' ' COLLECTION ITEMS TERMINATED BY ',' ;
OK
Time taken: 22.469 seconds
hive> show tables;
OK
t_afan_test
Time taken: 0.368 seconds