Hbase data structure
basic elements: namespace, tables, rows, columns, cells, Region, timestamp.
1. namespace: the role of NameSpaces
Table: table, all tables are named after members of the space, that table will belong to a namespace, if not specified, the default default namespace.
RegionServer group: namespace contains the default RegionServer Group.
Permission: Permissions, namespaces can define access control list ACL (Access Control List). For example, create a table, the table read, delete, update, etc. operations.
Quota: quota, you can force a region of space containing the number of names.
Table 2: Table can be understood as a relational database concept.
3. OK: OK key rowkey unique identification element row, the data storage table are sorted according to the row key, the data is accessed by the row key.
4. Column :( column family: the column name) of each column of the table, belongs to a family row, column family is part of the schema of the table (not listed) must be defined before using the table and column names to column group prefix; e.g. info: name, info: age,info belongs to the column group.
The cell: cell stored in the cell is an integral byte array, each cell has version information, if the version is not inserted in the data set, or the default version.
6.region: region horizontal division table, Hbase cluster is the smallest unit of data distribution, all regions of the line would constitute a table of contents.
7. timestamp: Hbase each cell are stored in a plurality of versions of the same data, indexed by timestamp version, can set the value of the time stamp is inserted into the data, if not set the default time stamp is generated.
Hbase Shell operators
use hbase shell on any node to connect to the host Hbase instance has been started:
1 # hbase shell
Enter help to display the help document content, status Hbase can view the status of the cluster:
1 > help
status offer HBase states:
1 > status
version is being used to provide Hbase version:
1 > version
create to create a table, you must specify the table name and ColumnFamily name when you create:
1 > create 'testtable','infofamily'
list to view all the tables in HBase:
1 > list
describe command to view a table of information:
1 > describe 'testtable'
alter modify a table, for example, add a column group:
1 > alter 'testtable',NAME=>'basic'
Use the describe command to view the table information added after the column family: Use alter command to delete the column family:
1 > alter 'testtable',NAME=>'basic','METHOD'=>'delete'
Use the disable command to disable the table, delete the table or in doing other operations, the need to operate in the case of a disabled table, use the enable command to re-enable a disabled table:
1 > disable 'testtable'
1 > enable 'testtable'
Use the drop command to delete the disabled list (you must first disable the table, otherwise it will report an error prompt):
1 > disable 'testtable' 2 > drop 'testtable'
Then create a table testtableone:
1 > create 'testtableone','info'
Using the put command to add data to the table, put command Format:
. 1 > PUT 'table', 'OK button', 'Group columns: Column name', 'of VALUE'
1 > put 'testtableone','row1','info:name','Jack'
Use get command can see a row of data:
1 > get 'testtableone','row1'
Use scan can view the data information table of all lines:
1 > scan 'testtableone'
delete means for deleting the cell value in the table, delete command format:
. 1 > Delete 'table', 'OK button', 'Group columns: Column name', timestamps
Inserted into the first few multi-table data.
Note: This data is inserted in first row insertion row2 data Bob, since when the subsequent insertion of data, row2 row of keys has not changed, so the data is directly replaced Bob Lucy. Delete Jack's class cell data:
1 > delete 'testtableone','row1','info:class',1566182654321
deleteall used to delete all the cells in a given row:
. 1 > Delete 'table', 'OK button'
All cells delete data row1 line:
1 > deleteall 'testtableone','row1'
for counting a count value in the table and returns the rows:
1 > count 'testtableone'
Thus commonly used commands enumeration is complete.