安装Hive的时候出现:
问题 (1):
Cannot find hadoop installation: $HADOOP_HOME or $HADOOP_PREFIX must be set or hadoop must be in the path
错误可是发现执行 : echo $HADOOP_HOME时可以看到内容
最后发现问题修改 conf/hive-env.sh 中Hadoop的路径设置不正确。。
HADOOP_HOME=~/hadoop/hadoop-1.2.1
问题 (2):
FAILED: Error in metadata: java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.metastore.HiveMetaStoreClient
FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask
发现忘记了 mysql-connector-java-5.1.28-bin.jar
问题(3):
FAILED: Error in metadata: MetaException(message:Got exception: org.apache.hadoop.hive.metastore.api.MetaException javax.jdo.JDODataStoreException: An exception was thrown while adding/validating class(es) : Specified key was too long; max key length is 767 bytes
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Specified key was too long; max key length is 767 bytes
解决方法:alter database hive character set latin1;
以下测试内容转载自:http://www.cnblogs.com/ZJUKasuosuo/archive/2012/07/03/2574420.html
vim /root/hadoop/sample/example.txt
粘贴如下数据:制表符分隔。。
1990 23 2
1990 21 2
1990 25 2
1991 32 2
1991 34 2
1991 24 2
1992 42 2
1992 32 2
1992 25 2
create table records(year string,temperature int,quality int)
row format delimited
fields terminated by '\t';
load data local inpath '/root/hadoop/sample/example.txt'
overwrite into table records;
select year, max(temperature) from records group by year;