通过 Hive external table 将 Hbase 数据索引到 solr
Index Hbase data to solr via Hive external table
我已经通过 Nutch 2.3.1 爬取了一些数据。数据存储在 Hbase 0.98 table。我创建了一个外部 table 从 hbase table 导入数据。现在我必须将此数据索引到 solr 4.10.3。为此,我遵循了 this 众所周知的教程。我已经创建了配置单元 table 就像
create external table if not exists solr_items (
id STRING,
content STRING,
url STRING,
title STRING
) ROW FORMAT DELIMITED FIELDS TERMINATED BY '|'
stored by "com.chimpler.hive.solr.SolrStorageHandler"
with serdeproperties ("solr.column.mapping"="id,content,url,title")
tblproperties ("solr.url" = "http://localhost:8983/solr/collection1") ;
当我尝试从发布的 hbase 复制数据时出现了一些问题 。然后我决定首先索引一些虚拟数据。为此,我决定从
这样的文件加载数据
LOAD DATA LOCAL INPATH 'data.csv3' OVERWRITE INTO TABLE solr_items;
但是报错如下
FAILED: SemanticException [Error 10101]: A non-native table cannot be used as target for LOAD
问题出在哪里
HADOOP版本为1.2.1
您不能将 LOAD DATA
用于外部 table。 Hive LanguageManual DML:
Hive does not do any transformation while loading data into tables.
Load operations are currently pure copy/move operations that move
datafiles into locations corresponding to Hive tables.
Hive 显然不能在 Solr 外部的情况下复制数据 table 因为 Solr 使用它自己的内部数据表示。
不过您可以插入:
insert into table solr_items select * from tempTable;
我已经通过 Nutch 2.3.1 爬取了一些数据。数据存储在 Hbase 0.98 table。我创建了一个外部 table 从 hbase table 导入数据。现在我必须将此数据索引到 solr 4.10.3。为此,我遵循了 this 众所周知的教程。我已经创建了配置单元 table 就像
create external table if not exists solr_items (
id STRING,
content STRING,
url STRING,
title STRING
) ROW FORMAT DELIMITED FIELDS TERMINATED BY '|'
stored by "com.chimpler.hive.solr.SolrStorageHandler"
with serdeproperties ("solr.column.mapping"="id,content,url,title")
tblproperties ("solr.url" = "http://localhost:8983/solr/collection1") ;
当我尝试从发布的 hbase 复制数据时出现了一些问题
LOAD DATA LOCAL INPATH 'data.csv3' OVERWRITE INTO TABLE solr_items;
但是报错如下
FAILED: SemanticException [Error 10101]: A non-native table cannot be used as target for LOAD
问题出在哪里 HADOOP版本为1.2.1
您不能将 LOAD DATA
用于外部 table。 Hive LanguageManual DML:
Hive does not do any transformation while loading data into tables. Load operations are currently pure copy/move operations that move datafiles into locations corresponding to Hive tables.
Hive 显然不能在 Solr 外部的情况下复制数据 table 因为 Solr 使用它自己的内部数据表示。
不过您可以插入:
insert into table solr_items select * from tempTable;