首页 > 解决方案 > 无法从 Hive 更改表位置

问题描述

我能够位于和Alluxio之间的中间层,根据Running Apache Hive with Alluxio中的教程,我尝试从 Alluxio 为存储在 HDFS 中的现有表提供服务,因为我现在正在使用它来访问数据。 这里的关键步骤是将表位置从 HDFS 和 Ceph 等分布式存储系统修改为 alluxio:CephHiveexternal table

4.2. 将外部表从 HDFS 移动到 Alluxio 假设 Hive 中有一个现有的外部表 u_user,其位置设置为 hdfs://namenode_hostname:port/ml-100k。您可以使用以下 HiveQL 语句来检查其“Location”属性:

hive> desc 格式化的 u_user;
然后使用以下 HiveQL 语句将表数据位置从 HDFS 更改为 Alluxio:</p>

hive> 更改表 u_user 设置位置“alluxio://master_hostname:port/ml-100k”;

我使用的语句是:

alter table call_center set location "alluxio://alluxio_master:19998/tpcds_text_1000.db/call_center";

但是,我收到如下错误:

 ERROR ql.Driver: FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. Unable to alter table. null

通过在 WARN 日志级别打开配置单元,我们获得了更多异常详细信息:

WARN [ main] metastore.RetryingMetaStoreClient: MetaStoreClient lost connection. Attempting to reconnect (1 of 1) after 1s. alter_table_with_environmentContext
org.apache.thrift.transport.TTransportException: null
        at org.apache.thrift.transport.TIOStreamTransport.read(TIOStreamTransport.java:132) ~[hive-exec-3.1.1.jar:3.1.1]
        at org.apache.thrift.transport.TTransport.readAll(TTransport.java:86) ~[hive-exec-3.1.1.jar:3.1.1]
        at org.apache.thrift.protocol.TBinaryProtocol.readAll(TBinaryProtocol.java:429) ~[hive-exec-3.1.1.jar:3.1.1]

当前call_center表格信息如下:

# Detailed Table Information
Database:               tpcds_text_1000
OwnerType:              USER
Owner:                  root
Retention:              0
Location:               s3a://tpcds/user/root/tpcds/1000/call_center
Table Type:             EXTERNAL_TABLE

欢迎任何意见,谢谢。

标签: javahadoophivebigdataalluxio

解决方案


使用 Alluxio 运行 Apache Hive中的一些修改可能仅在重启 Metastore 后生效。

我杀死了元存储并重新启动它hive --service metastore,然后成功修改了表位置。

将此线程留给可能遇到相同情况的任何人。


推荐阅读