In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Table structure of HBase
HBase stores data as a table. The table consists of rows and columns. Columns are divided into column families / column clusters (column family).
As shown in the figure above, key1,key2,key3 is the only row key value for three records, and column-family1,column-family2,column-family3 is three column families, each of which includes several columns. For example, column-family1 consists of two columns under the column family, and the name is column1 and column2,t1:abc,t2:gdxdf is the only unit cell determined by row key1 and column-family1-column1. There are two data in this cell, abc and gdxdf. The timestamps of the two values are different. They are T1 and T2 respectively. Hbase will return the latest time value to the requestor.
The specific meanings of these nouns are as follows:
(1) Row Key
Like nosql databases, row key is the primary key used to retrieve records. There are only three ways to access rows in hbase table:
(1.1) access through a single row key
(1.2) range through row key
(1.3) full table scan
The Row key line key (Row key) can be any string (the maximum length is 64KB, which is usually 10-100bytes in practical applications). Within hbase, row key is saved as a byte array.
When storing, the data is sorted and stored according to the byte order of Row key. When designing a key, you should fully sort the storage feature and put together the row stores that are often read together. (location correlation)
Note:
The result of lexicographic order of int is 1, 10, 100, 11, 12, 13, 14, 14, 16, 17, 18, 19, 20, 21, … , 9,91,92,93,94,95,96,97,98,99 . To maintain the natural order of × ×, the row key must be filled to the left with 0.
One read and write of a row is an atomic operation (no matter how many columns are read and written at a time). This design decision makes it easy for users to understand the behavior of the program when concurrent updates are performed on the same row.
(2) column family of column families
Each column in the hbase table belongs to a column family. Column families are part of the chema of the table (while columns are not) and must be defined before using the table. Column names are prefixed with column families. For example, courses:history and courses:math all belong to the courses column family.
Access control, disk and memory usage statistics are all carried out at the column family level. In practical applications, control permissions on column families can help us manage different types of applications: we allow some applications to add new basic data, some applications can read basic data and create inherited column families, and some applications are only allowed to browse data (or even not all data for privacy reasons).
(3) Unit Cell
The storage unit determined by row and columns in HBase is called cell. The unit uniquely determined by {row key, column (= +), version}. The data in cell is typeless and is all stored in bytecode form.
(4) timestamp timestamp
Each cell holds multiple versions of the same data. The version is indexed by timestamp. The type of timestamp is 64-bit integer. The timestamp can be assigned by hbase (automatically when the data is written), where the timestamp is the current system time accurate to milliseconds. The timestamp can also be explicitly assigned by the customer. If the application wants to avoid data version conflicts, it must generate its own unique timestamps. In each cell, different versions of the data are sorted in reverse chronological order, meaning that the latest data comes first.
In order to avoid the burden of management (including storage and indexing) caused by too many versions of data, hbase provides two ways to recycle data versions. One is to save the last n versions of the data, and the other is to save the most recent version (for example, the last seven days). You can set it for each column family.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.