030
030

Reputation: 11719

Command to provide file to HBase which is subsequently stored in HDFS

Introduction

Follow-up question to this question.

HBase has been connected to HDFS. Is it possible to provide a file to HBase which is subsequently stored in HDFS using a command.

According to this documentation there are several HBase shell commands. However these commands are restricted to e.g. creation, deletion of tables.

Question

Which command needs to be issued to provide a file to HBase which will be subsequently stored in HDFS?

Upvotes: 0

Views: 56

Answers (1)

David
David

Reputation: 3261

The question is not clear. HBase is a key-value store. To put data into HBase you must first create a table with a schema (really, just a list of column families). After the table is created, you can load data into the table; the HBase command is 'put'. Quoting from the HBase book:

"Create a table named test with a single column family named cf. Verify its creation by listing all tables and then insert some values.

hbase(main):003:0> create 'test', 'cf'

0 row(s) in 1.2200 seconds

hbase(main):003:0> list 'test'

..

1 row(s) in 0.0550 seconds

hbase(main):004:0> put 'test', 'row1', 'cf:a', 'value1'

0 row(s) in 0.0560 seconds

hbase(main):005:0> put 'test', 'row2', 'cf:b', 'value2'

0 row(s) in 0.0370 seconds

hbase(main):006:0> put 'test', 'row3', 'cf:c', 'value3'

0 row(s) in 0.0450 seconds "

If you want to load a large file row by row, you will have to either write a program, or google "Bulk loading"

Upvotes: 2

Related Questions