gpt4 book ai didi

hadoop - 从配置单元加载 Hbase 表

转载 作者:可可西里 更新时间:2023-11-01 15:50:05 24 4
gpt4 key购买 nike

我正在尝试从 hive 表加载 hbase 表,因为我正在使用以下方法,如果我在 hbase 表中只有一个列族,它工作正常,但是如果我有多个列族,它会抛出错误。

方法

源表

CREATE EXTERNAL TABLE temp.employee_orc(id String, name String, Age int)
STORED AS ORC
LOCATION '/tmp/employee_orc/table';

使用Hbase Serde创建Hive表

CREATE TABLE temp.employee_hbase(id String, name String, age int)
STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler'
WITH SERDEPROPERTIES ('hbase.columns.mapping' = ':key,emp:name,emp:Age')
TBLPROPERTIES("hbase.table.name" = "bda:employee_hbase", "hfile.family.path"="/tmp/employee_hbase/emp", "hive.hbase.generatehfiles"="true");

导出hbase文件

SET hive.hbase.generatehfiles=true;
INSERT OVERWRITE TABLE temp.employee_hbase SELECT DISTINCT id, name, Age FROM temp.employee_orc CLUSTER BY id;

加载hbase表

export HADOOP_CLASSPATH=`hbase classpath`
hadoop jar /usr/hdp/current/hbase-client/lib/hbase-server.jar completebulkload /tmp/employee_hbase/ 'bda:employee_hbase'

错误如果我在 Hbase 表中有多个列族,我会收到以下错误,

java.lang.RuntimeException: Hive Runtime Error while closing operators: java.io.IOException: Multiple family directories found in hdfs://hadoopdev/apps/hive/warehouse/temp.db/employee_hbase/_temporary/0/_temporary/attempt_1527799542731_1180_r_000000_0

如果不是这种方法,还有其他方法加载 Hbase 表吗?

最佳答案

从hive批量加载到hbase,目标表只能有一个列族。

bulk load of hbase

关于hadoop - 从配置单元加载 Hbase 表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50708184/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com