0
0
Hadoopdata~10 mins

HBase data model (column families) in Hadoop - Step-by-Step Execution

Choose your learning style9 modes available
Concept Flow - HBase data model (column families)
Start: Create Table
Define Column Families
Store Data in Column Families
Retrieve Data by Column Family
End
This flow shows how an HBase table is created with column families, data is stored inside them, and then retrieved by column family.
Execution Sample
Hadoop
create 'mytable', 'info', 'stats'
put 'mytable', 'row1', 'info:name', 'Alice'
put 'mytable', 'row1', 'stats:visits', '5'
get 'mytable', 'row1', {COLUMN => 'info:name'}
Create a table with two column families, add data to each family, then get data from one family.
Execution Table
StepCommandActionResult
1create 'mytable', 'info', 'stats'Create table 'mytable' with column families 'info' and 'stats'Table 'mytable' created with 2 column families
2put 'mytable', 'row1', 'info:name', 'Alice'Store 'Alice' in 'info:name' for row 'row1'Data stored in 'info' family under 'name' qualifier
3put 'mytable', 'row1', 'stats:visits', '5'Store '5' in 'stats:visits' for row 'row1'Data stored in 'stats' family under 'visits' qualifier
4get 'mytable', 'row1', {COLUMN => 'info:name'}Retrieve 'info:name' from 'row1'Returns 'Alice' from 'info' family
💡 All commands executed; data stored and retrieved by column family.
Variable Tracker
VariableAfter Step 1After Step 2After Step 3After Step 4
Table 'mytable'Created with column families 'info', 'stats'Row 'row1' has 'info:name'='Alice'Row 'row1' has 'stats:visits'='5'No change; data retrieved from 'info:name'
Key Moments - 2 Insights
Why do we define column families before adding data?
Column families group related columns and define storage settings. You must create them first (see Step 1) before storing data in those families (Steps 2 and 3).
Can data from one column family be retrieved without accessing others?
Yes, as shown in Step 4, you can get data from a specific column family without reading other families, improving efficiency.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution table, what column family stores the 'visits' data?
Ainfo
Bstats
Cname
Drow1
💡 Hint
Check Step 3 in the execution table where 'stats:visits' is stored.
At which step is the table 'mytable' created with column families?
AStep 2
BStep 3
CStep 1
DStep 4
💡 Hint
Look at Step 1 in the execution table for table creation.
If you want to retrieve 'Alice' from 'info:name', which command is used?
Aput 'mytable', 'row1', 'info:name', 'Alice'
Bget 'mytable', 'row1', {COLUMN => 'info:name'}
Ccreate 'mytable', 'info', 'stats'
Dput 'mytable', 'row1', 'stats:visits', '5'
💡 Hint
Check Step 4 in the execution table for data retrieval.
Concept Snapshot
HBase tables have column families grouping columns.
Define column families when creating the table.
Store data by specifying 'family:qualifier'.
Retrieve data by column family for efficiency.
Column families control storage and access patterns.
Full Transcript
This visual execution shows how to create an HBase table with column families, store data in them, and retrieve data by specifying the column family. First, the table 'mytable' is created with two column families: 'info' and 'stats'. Then, data 'Alice' is stored in the 'info' family under the 'name' qualifier for row 'row1'. Next, the number '5' is stored in the 'stats' family under the 'visits' qualifier for the same row. Finally, data is retrieved from the 'info:name' column, returning 'Alice'. This demonstrates how column families organize data and allow efficient access.