Hive的SemanticException Unable to determine if hdfs BUG(八)

1. 查看NameNode状态

先来分享两条查看NameNode节点状态的命令:

hdfs haadmin -getServiceState nn1
hdfs haadmin -getServiceState nn2

在这里插入图片描述

2. 寻找错误

接着上一篇来吧,不过这次我们通过master001来写入文件,使用lhd数据库,然后使用以下命令创表:

create external table person(
id int,
name string,
age int,
fav array<string>,
addr map<string, string>
)
comment 'This is the person table'
row format delimited fields terminated by '\t'
collection items terminated by '-'
map keys terminated by ':'
stored as textfile
location 'hdfs://master001:9000/input/';

在这里插入图片描述
再来查看表目录:
在这里插入图片描述
还是没找到,然后我查看person表发现出现了新的bug:

FAILED: SemanticException Unable to determine if hdfs://master001:9000/input is encrypted: java.lang.IllegalArgumentException: Wrong FS: hdfs://master001:9000/input, expected: hdfs://mycluster

出错原因:因为已经设置了NameNode高可用,产生的HDFS路径不对。
在这里插入图片描述

查看DBS表:
在这里插入图片描述查看SDS表:
结果发现其LOCATION标记的是master001节点,应该更改为mycluster:

update SDS set LOCATION = REPLACE(LOCATION,'master001:9000','mycluster');

在这里插入图片描述
再来查看:
在这里插入图片描述

3. 结论

正确的创表语句:

create external table person(
id int,
name string,
age int,
fav array<string>,
addr map<string, string>
)
comment 'This is the person table'
row format delimited fields terminated by '\t'
collection items terminated by '-'
map keys terminated by ':'
stored as textfile
location 'hdfs://mycluster/input/';

location指定的时候应当直接指定mycluster集群,而不是指定集群上某一个节点。

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值