Because the impact of the epidemic, it has recently also trapped at home, so take advantage of this opportunity to sort out several knowledge modules relating to large data base of it, today is about the shell operation in hbase
Operation a shell
1. HBase client to enter command line
[atguigu @ hadoop102 HBase] $ bin / HBase shell
2. View Help command
HBase (main): 001: 0> Help
3. See the table in the current database which has
hbase (main): 002: 0 > list
operation 2 Table
1. Create a table
HBase (main): 002: 0> Create 'Student', 'info'
2. Inserting data into the table
HBase (main): 003: 0> PUT 'Student', '1001', 'info: Sex', 'MALE'
HBase (main): 004: 0> PUT 'Student', '1001', ' info: Age ',' 18 is '
HBase (main): 005: 0> PUT' Student ',' 1002 ',' info: name ',' Janna '
HBase (main): 006: 0> PUT' Student ',' 1002 ',' info: Sex ',' FEMALE '
HBase (main): 007: 0> PUT' Student ',' 1002 ',' info: Age ',' 20 is'
. 3. Display scan data
HB ASE (main): 008: 0> Scan 'Student'
HBase (main): 009: 0> Scan 'Student', {StartRow => '1001', STOPROW => '1001'}
HBase (main): 010: 0> Scan 'Student', {StartRow => '1001' }
4. See Table Structure
HBase (main): 011: 0> DESCRIBE 'Student'
. 5. Update specified field data
HBase (main): 012: 0> PUT 'Student', '1001', 'info: name', 'Nick'
HBase (main): 013: 0> PUT 'Student', '1001', 'info: Age', '100'
. 6. See "Line" or "specified column group: column" data
HBase (main): 014: 0> GET 'Student', '1001'
HBase (main): 015: 0> GET 'Student', '1001', 'info: name'
. 7. Rows of data tables
HBase (main): 021: 0> COUNT 'Student'
. 8. Delete data
to delete a rowkey all the data:
HBase (main): 016: 0> deleteAll 'Student', '1001'
to delete a column of data in a rowkey of:
HBase (main): 017: 0> Delete 'Student', '1002 ',' info: Sex '
. 9. Empty Table data
hbase (main): 018: 0 > truncate 'student'
Tip: operation sequence table is emptied first disable, and then truncate.
10. Delete table
first need to let the table to disable status:
HBase (main): 019: 0> disable 'Student'
before you can drop this table:
HBase (main): 020: 0> drop 'Student'
Tip: If the direct drop table , you will get an error: ERROR: the Table Student IS IT Enabled Disable First..
11. Changing the table information
to info data column family stored three versions:
HBase (main): 022: 0> ALTER 'Student', {NAME => 'info', the VERSIONS =>. 3}
HBase (main): 022: 0 > get 'student', '1001 ', {COLUMN => 'info: name', VERSIONS => 3}
Data structure of two hbase