之后创建表一直很顺利,但是到查询表例如我执行:select size from log limit 10;时,又报错如下:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/hadoop/hive/conf/HiveConf 后来问了下百度和google都没有结果,自己觉得是缺少了类文件,我便把hive/lib下所有的hive-*文件拷贝到hadoop的lib下
重启hadoop,问题解决。但是归根结底我觉得是$HADOOP_CLASSPATH变量没有配置清楚,这个之后再解决这里做个标记。
执行select 后运行正常:
hive> select size from log_info limit 12; Total MapReduce jobs = 1 Launching Job 1 out of 1 Number of reduce tasks is set to 0 since there's no reduce operator Starting Job = job_201112061127_0004, Tracking URL = :50030/jobdetails.jsp?jobid=job_201112061127_0004 Kill Command = /root/hadoop-0.20.2/bin/hadoop job -Dmapred.job.tracker=hdfs://192.168.30.149:9004 -kill job_201112061127_0004 2011-12-06 15:35:47,923 Stage-1 map = 0%, reduce = 0% 2011-12-06 15:35:50,952 Stage-1 map = 9%, reduce = 0% 2011-12-06 15:35:52,975 Stage-1 map = 27%, reduce = 0% 2011-12-06 15:35:53,984 Stage-1 map = 45%, reduce = 0% 2011-12-06 15:35:56,001 Stage-1 map = 64%, reduce = 0% 2011-12-06 15:35:59,023 Stage-1 map = 82%, reduce = 0% 2011-12-06 15:36:00,038 Stage-1 map = 100%, reduce = 0% 2011-12-06 15:36:03,062 Stage-1 map = 100%, reduce = 100% Ended Job = job_201112061127_0004 现在又找到的心得问题:在执行删除表操作时,出现如下错误:
NestedThrowables: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Specified key was too long; max key length is 767 bytes FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask 这个问题还没有解决:期待牛人解决
最后附上:内存数据库derby的配置
<configuration> <property> <name>hive.metastore.local</name> <value>true</value> <description>controls whether to connect to remove metastore server or open a new metastore server in Hive Client JVM</description> </property> <property> <name>javax.jdo.option.ConnectionURL</name> <value>jdbc:derby://hadoop149:1527/metastore_db;create=true</value> <description>JDBC connect string for a JDBC metastore</description> </property> <property> <name>javax.jdo.option.ConnectionDriverName</name> <value>org.apache.derby.jdbc.ClientDriver</value> <description>Driver class name for a JDBC metastore</description> </property> </configuration>