Hbase common operation commands
1. Enter hbase
- Parameter Description
- Go to the hbase directory and enter hbase
2. Browse all tables
- Parameter Description
- View table list
3. View the table structure
describe 'BizvaneV2.VipSearch'
- Parameter Description
- 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
- create action command, UserInfo is the name of the table to be created
- NAME column family name, info is the column family name
- 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
- disable action command to invalidate the table whose structure is to be modified, UserInfo is the table name
- Modify command
- alter action command
- UserInfo table name to modify
- {NAME => 'extendInfo', REPLICATION_SCOPE => '1'} The structure to be modified
- 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
- add command
- put action command,
- UserInfo table name to add data to
- row_1 data row
- info:firstname column and column name
- liu value to add
7. View data
- Parameter Description
- scan action command
- To see the name of the table
8. Modify data
put 'UserInfo','row_1','info:firstname','liu_copy'
- Parameter Description
- add command
- put action command,
- UserInfo table name to modify data
- row_1 data row
- info:firstname column and column name
- liu new data value
9. Deletion of data
delete ' UserInfo ' , ' row_1 ' , ' info:firstname ' Parameter description
-
- delete command
- delete action command,
- UserInfo table name to modify data
- row_1 data row
- 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
- delete command
- disable disables the table, the name of the table that UserInfo wants to enable
- drop delete command UserInfo table name to be dropped
11. Help
- Parameter Description
- help Help command, you can view the list of commands provided by Hbase