无法在hdfs上查看表

vsikbqxv  于 2021-06-03  发布在  Hadoop
关注(0)|答案(1)|浏览(361)

我已经创建了以下表格。

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

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

  1. hive> show tables;
  2. OK
  3. apachelog
  4. Time taken: 14.376 seconds

我找到了仓库的位置。

  1. hadoop@domU-12-31-39-02-5D-B7:~$ cat hive/conf/hive-default.xml | grep warehouse
  2. <name>hive.metastore.warehouse.dir</name>
  3. <value>/mnt/hive_081/warehouse</value>
  4. <description>location of default database for the warehouse</description>

当我这样做的时候,我会收到一条错误信息。

  1. hadoop fs -lsr /mnt/hive_081
  2. lsr: Cannot access /mnt/hive_081: No such file or directory.
  3. Same thing when I look for /mnt/hive_081/warehouse

我做错了什么?我已经做了所有的设置从一开始3次,我仍然得到相同的错误。

hm2xizp9

hm2xizp91#

因为在创建表时,您显式地将表数据位置指定在“s3”文件系统上,而不是在hive default中使用关键字location定义的文件系统上。[。。。位置's3://dinendra80/h4p3'…]
此关键字将覆盖conf文件中指定的表的默认hdfs存储位置。
如果删除位置“s3://dinendra80/h4p3”,则hive将在“/mnt/hive\u 081/warehouse”存储表,并且您可以从hadoop cli中使用它。

相关问题