注意:几个小时前我已经开始使用HBase而我来自RDBMS背景:P
我有一个类似RDBMS的表CUSTOMERS,其中包含以下列:
我想到了以下HBase等价物:
table:CUSTOMERS rowkey:CUSTOMER_ID
列系列:CUSTOMER_INFO
列:NAME EMAIL ADDRESS MOBILE
从我读过的内容来看,RDBMS表中的主键与HBase表的rowkey大致相似。因此,我想将CUSTOMER_ID保留为rowkey。
我的问题是愚蠢和直截了当的:
* * *已编辑以添加示例代码段
我只是想在shell中使用'put'为customer表创建一行。我这样做了:
hbase(main):011:0> put 'CUSTOMERS', 'CUSTID12345', 'CUSTOMER_INFO:NAME','Omkar Joshi'
0 row(s) in 0.1030 seconds
hbase(main):012:0> scan 'CUSTOMERS'
ROW COLUMN+CELL
CUSTID12345 column=CUSTOMER_INFO:NAME, timestamp=1365600052104, value=Omkar Joshi
1 row(s) in 0.0500 seconds
hbase(main):013:0> put 'CUSTOMERS', 'CUSTID614', 'CUSTOMER_INFO:NAME','Prachi Shah', 'CUSTOMER_INFO:EMAIL','Prachi.Shah@lntinfotech.com'
ERROR: wrong number of arguments (6 for 5)
Here is some help for this command:
Put a cell 'value' at specified table/row/column and optionally
timestamp coordinates. To put a cell value into table 't1' at
row 'r1' under column 'c1' marked with the time 'ts1', do:
hbase> put 't1', 'r1', 'c1', 'value', ts1
hbase(main):014:0> put 'CUSTOMERS', 'CUSTID12345', 'CUSTOMER_INFO:EMAIL','Omkar.Joshi@lntinfotech.com'
0 row(s) in 0.0160 seconds
hbase(main):015:0>
hbase(main):016:0* scan 'CUSTOMERS'
ROW COLUMN+CELL
CUSTID12345 column=CUSTOMER_INFO:EMAIL, timestamp=1365600369284, value=Omkar.Joshi@lntinfotech.com
CUSTID12345 column=CUSTOMER_INFO:NAME, timestamp=1365600052104, value=Omkar Joshi
1 row(s) in 0.0230 seconds
因为最高限度。 5个参数,我无法弄清楚如何在一个put命令中插入整行。这导致同一行的增量版本不是必需的,我不确定CUSTOMER_ID是否被用作rowkey! 谢谢和问候!
答案 0 :(得分:2)