从 HBase 中的 HDFS 导入 table
Import table from HDFS in HBase
我在 pig 中创建了一个 table 并将其存储在 hdfs 中:
STORE mapping INTO 'hdfs://localhost:9000/hbase/data/default/mapping' USING PigStorage ('\t');
运行 hdfs 上的 ls 命令,我得到 table:
bin/hdfs dfs -ls /hbase/data/default
Found 1 item
drwxr-xr-x - hfu supergroup 0 2015-11-09 13:33 /hbase/data/default/mapping
但是运行HBase中的列表命令shell,table没有出现。
我正在使用:
hbase-0.98.0-hadoop2
hadoop-2.6.1
pig-0.15.0
所有 运行 在一台虚拟机上
如何在 HBase 中导入 table?
首先使用 HBaseHCatStorageHandler 或直接从 HBase shell.
在 HBase 中创建 table
CREATE TABLE meters (col1 STRING, col2 STRING) STORED BY 'org.apache.hcatalog.hbase.HBaseHCatStorageHandler' TBLPROPERTIES ( 'hbase.table.name' = 'meters', 'hbase.columns.mapping' = 'd:col2', 'hcat.hbase.output.bulkMode' = 'true' ) ;
col1-将是HBase的Rowkey table
col2- 将是列族"d"
下的列限定符
现在使用 STORE
命令将数据加载到此 table。
我在 pig 中创建了一个 table 并将其存储在 hdfs 中:
STORE mapping INTO 'hdfs://localhost:9000/hbase/data/default/mapping' USING PigStorage ('\t');
运行 hdfs 上的 ls 命令,我得到 table:
bin/hdfs dfs -ls /hbase/data/default
Found 1 item
drwxr-xr-x - hfu supergroup 0 2015-11-09 13:33 /hbase/data/default/mapping
但是运行HBase中的列表命令shell,table没有出现。
我正在使用:
hbase-0.98.0-hadoop2
hadoop-2.6.1
pig-0.15.0
所有 运行 在一台虚拟机上
如何在 HBase 中导入 table?
首先使用 HBaseHCatStorageHandler 或直接从 HBase shell.
在 HBase 中创建 tableCREATE TABLE meters (col1 STRING, col2 STRING) STORED BY 'org.apache.hcatalog.hbase.HBaseHCatStorageHandler' TBLPROPERTIES ( 'hbase.table.name' = 'meters', 'hbase.columns.mapping' = 'd:col2', 'hcat.hbase.output.bulkMode' = 'true' ) ;
col1-将是HBase的Rowkey table col2- 将是列族"d"
下的列限定符现在使用 STORE
命令将数据加载到此 table。