2013-03-07 85 views
0

我已经创建了如下表格。无法在HDFS上看到TABLE

CREATE TABLE apachelog (
    host STRING, identity STRING, user STRING, time STRING, request STRING, status STRING, 
    size STRING, referer STRING, agent STRING) 
    ROW FORMAT SERDE 'org.apache.hadoop.hive.contrib.serde2.RegexSerDe' 
    WITH SERDEPROPERTIES ("input.regex" = "([^ ]*) ([^ ]*) ([^ ]*) (- 
    |\\[[^\\]]*\\]) ([^ \"]*|\"[^\"]*\") (-|[0-9]*) (-|[0-9]*)(?: ([^ 
    \"]*|\"[^\"]*\") ([^ \"]*|\"[^\"]*\"))?", "output.format.string" = 
    "%1$s %2$s %3$s %4$s %5$s %6$s %7$s %8$s %9$s") 
    STORED AS TEXTFILE 
    LOCATION 's3://dinendra80/H4P3'; 

我可以看到表在那里,并有正确的行数。

hive> show tables; 
OK 
apachelog 
Time taken: 14.376 seconds 

我找到仓库位置。

[email protected]:~$ cat hive/conf/hive-default.xml | grep warehouse 
<name>hive.metastore.warehouse.dir</name> 
<value>/mnt/hive_081/warehouse</value> 
<description>location of default database for the warehouse</description> 

然后当我这样做时,我收到一条错误消息。

hadoop fs -lsr /mnt/hive_081 

lsr: Cannot access /mnt/hive_081: No such file or directory. 

Same thing when I look for /mnt/hive_081/warehouse 

我做错了什么?我从一开始就完成了所有设置3次,但仍然出现相同的错误。

+0

如何使用此工具? https://ccp.cloudera.com/display/CDHDOC/File+Browser – Alper 2013-03-07 13:42:32

回答

0

因为在创建表时,您明确指定表中的数据的位置是在“S3”文件系统,而不是在蜂房默认定义的关键字LOCATION之一。 [... LOCATION's3:// dinendra80/H4P3'..]

此关键字将覆盖在conf文件中指定的表的默认HDFS存储位置。

如果您删除LOCATION的s3:// dinendra80/H4P3,配置单元会将表存储在'/ mnt/hive_081/warehouse'中,您将可以使用Hadoop cli进行播放。