Enter the hbase command line. hbaseshell view status display hbase table list create user table, including info and data columns createuser, info1, data1createuser, {NAMEinfo, VERSIONS3} insert information to the user table, the rowkey is rk0001, and the name column label is added to the info column family.
Enter the hbase command line. /hbase shell view status display hbase table list create user table, including info, data columnfamily create 'user', 'info1', 'data1' create 'user ', {NAME = 'info', VERSIONS = '3'} inserts information into the user table. The row key is rk0001, and the name column label is added to the info column family.
Go to hbase command line
./Hbase shell
View status
Status
Show tables in hbase
List
Create a user table, including info and data Columns
Create 'user', 'info1', 'data1'
Create 'user', {NAME => 'info', VERSIONS => '3 '}
Insert information to the user table. The row key is rk0001, and the name column identifier is added to the info column family. The value is zhangsan.
Put 'user', 'rk0001 ', 'info: name', 'zhangsan'
Insert information to the user table. The row key is rk0001, and the gender column identifier is added to the info column family. The value is female.
Put 'user', 'rk0001 ', 'info: gender', 'female'
Insert information to the user table. The row key is rk0001, and the age column identifier is added to the info column family. The value is 20.
Put 'user', 'rk0001 ', 'info: age', 20
Insert information to the user table. The row key is rk0001, and the pic column identifier is added to the column family data. The value is picture.
Put 'user', 'rk0001 ', 'Data: pic', 'picture'
Obtain all the information in the user table with the row key rk0001
Get 'user', 'rk0001'
Obtains all information of the info column family whose row key is rk0001 in the user table.
Get 'user', 'rk0001 ', 'info'
Obtains information about the name and age column identifier of the info column family whose row key is rk0001 in the user table.
Get 'user', 'rk0001 ', 'info: name', 'info: age'
Obtains the information of the info and data columns whose row key is rk0001 in the user table.
Get 'user', 'rk0001 ', 'info', 'data'
Get 'user', 'rk0001 ', {COLUMN => ['info', 'data']}
Get 'user', 'rk0001 ', {COLUMN => ['info: name', 'Data: pic']}
Obtain the latest five versions of row key rk0001, column family info, and version number in the user table.
Get 'user', 'rk0001 ', {COLUMN => 'info', VERSIONS => 2}
Get 'user', 'rk0001 ', {COLUMN => 'info: name', VERSIONS => 5}
Get 'user', 'rk0001 ', {COLUMN => 'info: name', VERSIONS => 5, TIMERANGE => [1392368783980,139 2380169184]}
Obtain the information of zhangsan with the row key rk0001 and cell value in the user table.
Get 'people', 'rk0001 ', {FILTER => "ValueFilter (=, 'binary: image ')"}
Obtain the row key rk0001 in the user table. The column identifier contains the information of.
Get 'people', 'rk0001 ', {FILTER => "(QualifierFilter (=, 'substring: '))"}
Put 'user', 'rk0002', 'info: name', 'fanbing'
Put 'user', 'rk0002', 'info: gender ', 'female'
Put 'user', 'rk0002', 'info: nationality ', 'China'
Get 'user', 'rk0002', {FILTER => "ValueFilter (=, 'binary: China ')"}
Query all information in the user table
Scan 'user'
Query the info column family in the user table.
Scan 'user', {COLUMNS => 'info '}
Scan 'user', {COLUMNS => 'info', RAW => true, VERSIONS => 5}
Scan 'persion', {COLUMNS => 'info', RAW => true, VERSIONS => 3}
Query the info and data columns in the user table.
Scan 'user', {COLUMNS => ['info', 'data']}
Scan 'user', {COLUMNS => ['info: name', 'Data: pic ']}
Query Information in the user table where the column family is info and the column identifier is name.
Scan 'user', {COLUMNS => 'info: name '}
Query the info column family and name column identifier in the user table, and the latest five
Scan 'user', {COLUMNS => 'info: name', VERSIONS => 5}
Query the info and data columns in the user table that contain a characters.
Scan 'user', {COLUMNS => ['info', 'data'], FILTER => "(QualifierFilter (=, 'substring: '))"}
Query data with the column Family info and rk range [rk0001, rk0003) in the user table.
Scan 'people', {COLUMNS => 'info', STARTROW => 'rk0001 ', ENDROW => 'rk0003 '}
Query the rows whose keys start with rk in the user table.
Scan 'user', {FILTER => "PrefixFilter ('rk ')"}
Query data within a specified range in the user table
Scan 'user', {TIMERANGE => [1392368783980,139 2380169184]}
Delete data
Delete data whose row key is rk0001 and whose column identifier is info: name
Delete 'people', 'rk0001 ', 'info: name'
Delete data with the row key rk0001, column identifier info: name, and timestamp 1392383705316 in the user table.
Delete 'user', 'rk0001 ', 'info: name', 1392383705316
Clear Data in the user table
Truncate 'people'
Modify Table Structure
Stop the user table first (new version is not required)
Disable 'user'
Add two columnfamily f1 and f2
Alter 'people', NAME => 'f1'
Alter 'user', NAME => 'F2'
Enable table
Enable 'user'
### Disable 'user' (new version not required)
Delete A columnfamily:
Alter 'user', NAME => 'f1', METHOD => 'delete' or alter 'user', 'delete' => 'f1'
Add column family f1 and delete column family f2
Alter 'user', {NAME => 'f1'}, {NAME => 'F2', METHOD => 'delete '}
Change the f1 column family version number of the user table to 5.
Alter 'people', NAME => 'info', VERSIONS => 5
Enable table
Enable 'user'
Delete table
Disable 'user'
Drop 'user'