phoenix 利用CsvBulkLoadTool 批量带入数据并自动创建索引

本文介绍如何使用Apache Phoenix的CsvBulkLoadTool工具从CSV文件批量导入数据到HBase表中,并提供具体的命令行参数说明及常见错误处理办法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

需要先创建表:

CREATE TABLE IF NOT EXISTS population (
state CHAR(2) NOT NULL, city VARCHAR NOT NULL, population BIGINT
CONSTRAINT my_pk PRIMARY KEY (state, city));

在phoenix 目录下执行

hadoop jar /home/phoenix-4.6.0-HBase-1.0-bin/phoenix-4.6.0-HBase-1.0-client.jar   org.apache.phoenix.mapreduce.CsvBulkLoadTool -t POPULATION -i /datas/us_population.csv

-t :tableName

-i: input file 文件必须在hdfs文件上。

后查询表数据是空。

问题: ERROR mapreduce.CsvBulkLoadTool: Error Wrong FS: file:/home/hadoop/tmp/partitions_101bd67a-ec2c-4808-bc9f-bf4cd6ea74b9, expected: hdfs://node11:9000 occurred submitting CSVBulkLoad 

 

 参数意义:

-a,--array-delimiter <arg> Array element delimiter (optional)
-c,--import-columns <arg> Comma-separated list of columns to be
imported
-d,--delimiter <arg> Input delimiter, defaults to comma
-e,--escape <arg> Supply a custom escape character, default is
a backslash
-g,--ignore-errors Ignore input errors
-h,--help Show this help and quit
-i,--input <arg> Input CSV path (mandatory)
-it,--index-table <arg> Phoenix index table name when just loading
this particualar index table
-o,--output <arg> Output path for temporary HFiles (optional)
-q,--quote <arg> Supply a custom phrase delimiter, defaults
to double quote character
-s,--schema <arg> Phoenix schema name (optional)
-t,--table <arg> Phoenix table name (mandatory)
-z,--zookeeper <arg> Supply zookeeper connection details
(optional)

转载于:https://www.cnblogs.com/zhanggl/p/5191912.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值