Database Reference
In-Depth Information
hbase(main):001:0> create 'test', 'data'
0 row(s) in 0.9810 seconds
TIP
If the previous command does not complete successfully, and the shell displays an error and a stack
trace, your install was not successful. Check the master logs under the HBase logs directory — the de-
fault location for the logs directory is ${HBASE_HOME}/logs — for a clue as to where things went
awry.
See the help output for examples of adding table and column family attributes when spe-
cifying a schema.
To prove the new table was created successfully, run the list command. This will output
all tables in user space:
hbase(main):002:0> list
TABLE
test
1 row(s) in 0.0260 seconds
To insert data into three different rows and columns in the data column family, get the
first row, and then list the table content, do the following:
hbase(main):003:0> put 'test', 'row1', 'data:1', 'value1'
hbase(main):004:0> put 'test', 'row2', 'data:2', 'value2'
hbase(main):005:0> put 'test', 'row3', 'data:3', 'value3'
hbase(main):006:0> get 'test', 'row1'
COLUMN
CELL
data:1 timestamp=1414927084811,
value=value1
1 row(s) in 0.0240 seconds
hbase(main):007:0> scan 'test'
ROW
COLUMN+CELL
row1 column=data:1, timestamp=1414927084811,
value=value1
row2 column=data:2, timestamp=1414927125174,
value=value2
row3 column=data:3, timestamp=1414927131931,
value=value3
3 row(s) in 0.0240 seconds
Notice how we added three new columns without changing the schema.
Search WWH ::




Custom Search