0
votes

I am trying to load a csv file to Hbase by using Importtsv.

I have uploaded the customers1.csv to hdfs, created a hbase table named t1 by using command

hbase(main):001:0> create 't1','FirstName','LastName'

and when I try to load the csv data to the hbase table t1 by running command:

hbase(main):010:0> hbase org.apache.hadoop.hbase.mapreduce.ImportTsv-Dimporttsv.separator=',' -Dimporttsv.columns='HBASE_ROW_KEY,FirstName,LastName' t1 hdfs://my.cluster.com/user/maapr/test/customers1.csv

I failed to load the data due to:

SyntaxError: (hbase):10: syntax error, unexpected tIDENTIFIER

I followed the syntax from research online but I still got this syntax error. Any idea what is going on? Your solution will be much appreciated.

And another silly question. Is there other way to load the data from HDFS to Hbase besides Importtsv? Thanks.

1

1 Answers

3
votes

You are running the bulk load command from the HBase shell. Come out of the HBase shell and try.. :)

Space is needed in this part: ImportTsv -Dimporttsv.separator=','

hbase org.apache.hadoop.hbase.mapreduce.ImportTsv -Dimporttsv.separator=',' -Dimporttsv.columns='HBASE_ROW_KEY,FirstName,LastName' t1 hdfs://my.cluster.comser/maapr/test/customers1.csv

For bulk loading, you can also write a custom MR job. I am using Apache Phoenix Bulk Load Tool for my Phoenix HBase table.