Hbase common operation commands

Hbase common operation commands

1. Enter hbase

./hbase shell
  • Parameter Description
    1. Go to the hbase directory and enter hbase

2. Browse all tables

list
  • Parameter Description
    1. View table list

3. View the table structure

describe 'BizvaneV2.VipSearch'
  • Parameter Description
    1. describe action command, BizvaneV2.VipSearch is the table name to view the table structure

4. Create the table

create 'UserInfo', { NAME => 'info', REPLICATION_SCOPE => '1' }
  • Parameter Description
    1. create action command, UserInfo is the name of the table to be created
    2. NAME column family name, info is the column family name
    3. Whether REPLICATION_SCOPE is replicated, 0 means no replication, 1 means replication

5. Modify the table structure

disable 'UserInfo'
alter 'UserInfo', {NAME => 'extendInfo', REPLICATION_SCOPE => '1'}
describe 'UserInfo'
  • Parameter Description
    • Modify the table structure to make the table not enabled
    1. disable action command to invalidate the table whose structure is to be modified, UserInfo is the table name
    2. Modify command
      1. alter action command
      2. UserInfo table name to modify
      3. {NAME => 'extendInfo', REPLICATION_SCOPE => '1'} The structure to be modified
    3. describe action command, view the table structure description, verify whether the modification is successful

6. Add data

put 'UserInfo','row_1','info:firstname','liu'
  • Parameter Description
    1. add command
      1. put action command,
      2. UserInfo table name to add data to
      3. row_1 data row
      4. info:firstname column and column name
      5. liu value to add

7. View data

 scan 'UserInfo'
  • Parameter Description
    1. scan action command
      1. To see the name of the table

8. Modify data

put 'UserInfo','row_1','info:firstname','liu_copy'
  • Parameter Description
    1. add command
      1. put action command,
      2. UserInfo table name to modify data
      3. row_1 data row
      4. info:firstname column and column name
      5. liu new data value

9. Deletion of data

delete ' UserInfo ' , ' row_1 ' , ' info:firstname ' Parameter description
    1. delete command
      1. delete action command,
      2. UserInfo table name to modify data
      3. row_1 data row
      4. info:firstname column and column name

10. delete table

disable 'UserInfo'
drop 'UserInfo'
  • Parameter Description
    • Modify the table structure to make the table not enabled
    1. delete command
      1. disable disables the table, the name of the table that UserInfo wants to enable
      2. drop delete command UserInfo table name to be dropped

11. Help

help
  • Parameter Description
    1. help Help command, you can view the list of commands provided by Hbase

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325037431&siteId=291194637