国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

HBase Shell基本操作

這篇具有很好參考價值的文章主要介紹了HBase Shell基本操作。希望對大家有所幫助。如果存在錯誤或未考慮完全的地方,請大家不吝賜教,您也可以點擊"舉報違法"按鈕提交疑問。

一、進入Hbase Shell客戶端

先在Linux Shell命令行終端執(zhí)行start-dfs.sh腳本啟動HDFS,再執(zhí)行start-hbase.sh腳本啟動HBase。如果Linux系統(tǒng)已配置HBase環(huán)境變量,可直接在任意目錄下執(zhí)行hbase shell腳本命令,就可進入HBase Shell的命令行終端環(huán)境,exit可以退出HBase Shell(我安裝的是偽分布式的HBase)。

(1) help幫助命令(或者help '命令名稱'查看某一具體命令的使用方法)

hbase:055:0> help
HBase Shell, version 2.5.6, r6bac842797dc26bedb7adc0759358e4c8fd5a992, Sat Oct 14 23:36:46 PDT 2023
Type 'help "COMMAND"', (e.g. 'help "get"' -- the quotes are necessary) for help on a specific command.
Commands are grouped. Type 'help "COMMAND_GROUP"', (e.g. 'help "general"') for help on a command group.

COMMAND GROUPS:
  Group name: general
  Commands: processlist, status, table_help, version, whoami

  Group name: ddl
  Commands: alter, alter_async, alter_status, clone_table_schema, create, describe, disable, disable_all, drop, drop_all, enable, enable_all, exists, get_table, is_disabled, is_enabled, list, list_regions, locate_region, show_filters

  Group name: namespace
  Commands: alter_namespace, create_namespace, describe_namespace, drop_namespace, list_namespace, list_namespace_tables

  Group name: dml
  Commands: append, count, delete, deleteall, get, get_counter, get_splits, incr, put, scan, truncate, truncate_preserve

二、General通用操作命令

(1)status:查看HBase集群狀態(tài)

hbase:051:0> status
1 active master, 0 backup masters, 1 servers, 0 dead, 5.0000 average load
Took 2.3419 seconds 

(2)version:查看HBase版本信息

hbase:052:0> version
2.5.6, r6bac842797dc26bedb7adc0759358e4c8fd5a992, Sat Oct 14 23:36:46 PDT 2023
Took 0.0029 seconds 

(3)whoami:查看當(dāng)前登錄HBase的系統(tǒng)用戶信息

hbase:053:0> whoami
root (auth:SIMPLE)
    groups: root
Took 0.1906 seconds 

(4)table_help:查看HBase數(shù)據(jù)表操作的幫助信息

table_help
Help for table-reference commands.

You can either create a table via 'create' and then manipulate the table via commands like 'put', 'get', etc.
See the standard help information for how to use each of these commands.

三、Namespace操作

namespace(命名空間)是HBase對數(shù)據(jù)表的邏輯分組,用于數(shù)據(jù)表的業(yè)務(wù)劃分。例如上層應(yīng)用可以不同業(yè)務(wù)的數(shù)據(jù)表分別放置在不同的名字空間,以實現(xiàn)不同業(yè)務(wù)數(shù)據(jù)表之間的數(shù)據(jù)隔離。命名空間和數(shù)據(jù)表是一對多關(guān)系,命名空間可以包含多張數(shù)據(jù)表,一張數(shù)據(jù)表只能屬于一個名字空間。HBase數(shù)據(jù)庫中的NameSpace類似于MySQL數(shù)據(jù)庫中的database。 命名空間是HBASE對數(shù)據(jù)表的邏輯分組,用于數(shù)據(jù)表的業(yè)務(wù)劃分。

(1)list_namespace:查詢所有命名空間
hbase:036:0> list_namespace
NAMESPACE                                                                                      
default                                                                                        
hbase                                                                                          
ns1                                                                                            
3 row(s)
Took 0.0654 seconds 
(2)list_namespace_tables : 查詢指定命名空間的表
hbase:038:0> list_namespace_tables 'ns1'
TABLE                                                                                          
t1                                                                                             
1 row(s)
Took 0.1958 seconds                                                                            
=> ["t1"]
(3)create_namespace : 創(chuàng)建指定的命名空間
hbase:039:0> create_namespace 'ns2'
Took 0.4516 seconds 
(4)describe_namespace : 查詢指定命名空間的結(jié)構(gòu)
hbase:041:0> describe_namespace 'ns2'
DESCRIPTION                                                                                    
{NAME => 'ns2'} 
(5)alter_namespace :修改命名空間的結(jié)構(gòu)
hbase:045:0> alter_namespace 'ns2',{METHOD=>'set','authore'=>'Mike'}
Took 1.6665 seconds                                                                            
hbase:046:0> describe_namespace 'ns2'
DESCRIPTION                                                                                    
{NAME => 'ns2', author => 'Mike'}                                                                 
Quota is disabled
Took 0.2023 seconds
hbase:047:0> alter_namespace 'ns2',{METHOD=>'unset','NAME'=>'author'}
Took 0.1602 seconds                                                                            
hbase:048:0> describe_namespace 'ns2'
DESCRIPTION                                                                                    
{NAME => 'ns2'}                                                                                
Quota is disabled
Took 0.0878 seconds 
(6)drop_namespace:刪除命名空間
hbase:049:0> drop_namespace 'ns2'
Took 0.4194 seconds                                                                            
hbase:050:0> list_namespace
NAMESPACE                                                                                      
default                                                                                        
hbase                                                                                          
ns1                                                                                            
3 row(s)
Took 0.0610 seconds

四、DDL操作命令

DDL分組中包含的操作命令很多,主要用于對HBase數(shù)據(jù)庫表的相關(guān)管理操作,主要包括創(chuàng)建表、修改表、刪除表、列出表、啟用表、禁用表等操作。

(1)create:建表(建表的時候,必須至少指定一個列族名稱)

在默認的命名空間中,創(chuàng)建表students,并包含一個名為info的列族,列族屬性默認。

#如果保留默認的列族設(shè)置,建表時直接寫列族的名字就可以了
hbase:070:0> create 'students','info'
2024-03-21 00:25:59,140 INFO  [main] client.HBaseAdmin (HBaseAdmin.java:postOperationResult(3591)) - Operation: CREATE, Table Name: default:students, procId: 131 completed
Created table students
Took 3.4314 seconds                                                                            
=> Hbase::Table - students

?在指定的ns1命名空間中,創(chuàng)建表t1,并包含一個名為f1的列族,列族屬性自定義。

#建表的同時指定列族屬性
hbase:071:0> create 'ns1:t1',{NAME=>'f1',VERSIONS=>5}
2024-03-21 00:28:43,872 INFO  [main] client.HBaseAdmin (HBaseAdmin.java:postOperationResult(3591)) - Operation: CREATE, Table Name: ns1:t1, procId: 134 completed
Created table ns1:t1
Took 2.3465 seconds                                                                            
=> Hbase::Table - ns1:t1

operation: create, table name: default:student, procid: 19 completed,大數(shù)據(jù)開發(fā),hbase,數(shù)據(jù)庫,大數(shù)據(jù)

(2)list : 查詢所有的表
hbase:072:0> list
TABLE                                                                                          
students                                                                                       
ns1:t1                                                                                         
2 row(s)
Took 0.2459 seconds                                                                            
=> ["students", "ns1:t1"]
(3)describe/desc : 查詢表結(jié)構(gòu)
hbase:074:0> describe 'students'
Table students is ENABLED                                                                      
students, {TABLE_ATTRIBUTES => {METADATA => {'hbase.store.file-tracker.impl' => DEFAULT'}}}   
COLUMN FAMILIES DESCRIPTION                                                                    
{NAME => 'info', INDEX_BLOCK_ENCODING => 'NONE', VERSIONS => '1', KEEP_DELETED_CELLS => 'FALSE'
, DATA_BLOCK_ENCODING => 'NONE', TTL => 'FOREVER', MIN_VERSIONS => '0', REPLICATION_SCOPE => '0
', BLOOMFILTER => 'ROW', IN_MEMORY => 'false', COMPRESSION => 'NONE', BLOCKCACHE => 'true', BLO
CKSIZE => '65536 B (64KB)'}                                                                    
1 row(s)
Quota is disabled
Took 1.1379 seconds

(4)exists : 判斷指定表明是否存在

hbase:075:0> exists 'ns1:t1'
Table ns1:t1 does exist                                                                        
Took 0.0714 seconds                                                                            
=> true
(5)alter:修改表,添加、修改、刪除列簇信息

為students表格,增加一個列族score。

hbase:076:0> alter 'students','score'
Updating all regions with the new schema...
1/1 regions updated.
Done.
Took 3.8994 seconds                                                                            
hbase:077:0> desc 'students'
Table students is ENABLED                                                                      
students, {TABLE_ATTRIBUTES => {METADATA => {'hbase.store.file-tracker.impl' => 'DEFAULT'}}}   
COLUMN FAMILIES DESCRIPTION                                                                    
{NAME => 'info', INDEX_BLOCK_ENCODING => 'NONE', VERSIONS => '1', KEEP_DELETED_CELLS => 'FALSE'
, DATA_BLOCK_ENCODING => 'NONE', TTL => 'FOREVER', MIN_VERSIONS => '0', REPLICATION_SCOPE => '0
', BLOOMFILTER => 'ROW', IN_MEMORY => 'false', COMPRESSION => 'NONE', BLOCKCACHE => 'true', BLO
CKSIZE => '65536 B (64KB)'}                                                                    

{NAME => 'score', INDEX_BLOCK_ENCODING => 'NONE', VERSIONS => '1', KEEP_DELETED_CELLS => 'FALSE
', DATA_BLOCK_ENCODING => 'NONE', TTL => 'FOREVER', MIN_VERSIONS => '0', REPLICATION_SCOPE => '
0', BLOOMFILTER => 'ROW', IN_MEMORY => 'false', COMPRESSION => 'NONE', BLOCKCACHE => 'true', BL
OCKSIZE => '65536 B (64KB)'}                                                                   

2 row(s)
Quota is disabled
Took 0.0753 seconds

修改表格students的列族score的屬性VERSIONS的值為5。

hbase:078:0> alter 'students',NAME=>'score',VERSIONS=>5
Updating all regions with the new schema...
1/1 regions updated.
Done.
Took 1.9776 seconds

刪除表格表格students的列族score。

hbase:079:0> alter 'students',NAME=>'score',METHOD=>'delete'
Updating all regions with the new schema...
1/1 regions updated.
Done.
Took 2.5517 seconds                                                                            
hbase:080:0> desc 'students'
Table students is ENABLED                                                                      
students, {TABLE_ATTRIBUTES => {METADATA => {'hbase.store.file-tracker.impl' =>'DEFAULT'}}}   
COLUMN FAMILIES DESCRIPTION                                                                    
{NAME => 'info', INDEX_BLOCK_ENCODING => 'NONE', VERSIONS => '1', KEEP_DELETED_CELLS => 'FALSE'
, DATA_BLOCK_ENCODING => 'NONE', TTL => 'FOREVER', MIN_VERSIONS => '0', REPLICATION_SCOPE => '0
', BLOOMFILTER => 'ROW', IN_MEMORY => 'false', COMPRESSION => 'NONE', BLOCKCACHE => 'true', BLO
CKSIZE => '65536 B (64KB)'}                                                                    
1 row(s)
Quota is disabled
Took 0.2625 seconds 

(6)disable:禁用表格

hbase:083:0> disable 'students'
2024-03-21 00:52:29,298 INFO  [main] client.HBaseAdmin (HBaseAdmin.java:rpcCall(926)) - Started disable of students
2024-03-21 00:52:29,810 INFO  [main] client.HBaseAdmin (HBaseAdmin.java:postOperationResult(3591)) - Operation: DISABLE, Table Name: default:students, procId: 158 completed
Took 0.5354 seconds

(7)enable:啟用表格

hbase:084:0> enable 'students'
2024-03-21 00:52:51,239 INFO  [main] client.HBaseAdmin (HBaseAdmin.java:rpcCall(866)) - Started enable of students
2024-03-21 00:52:51,882 INFO  [main] client.HBaseAdmin (HBaseAdmin.java:postOperationResult(3591)) - Operation: ENABLE, Table Name: default:students, procId: 161 completed
Took 0.6636 seconds 

(8)drop:刪除表格(先要disable表,再刪除表

hbase:085:0> disable 'ns1:t1'
2024-03-21 00:53:34,360 INFO  [main] client.HBaseAdmin (HBaseAdmin.java:rpcCall(926)) - Started disable of ns1:t1
2024-03-21 00:53:34,727 INFO  [main] client.HBaseAdmin (HBaseAdmin.java:postOperationResult(3591)) - Operation: DISABLE, Table Name: ns1:t1, procId: 164 completed
Took 0.3910 seconds                                                                            
hbase:086:0> drop 'ns1:t1'
2024-03-21 00:53:43,300 INFO  [main] client.HBaseAdmin (HBaseAdmin.java:postOperationResult(3591)) - Operation: DELETE, Table Name: ns1:t1, procId: 167 completed
Took 0.7044 seconds                                                                            
hbase:087:0> list
TABLE                                                                                          
students                                                                                       
1 row(s)
Took 0.0301 seconds                                                                            
=> ["students"]

五、DML操作命令

DML包含的操作命令很多,主要用于對數(shù)據(jù)表中的數(shù)據(jù)進行操作,主要包括全表掃描、讀取單行數(shù)據(jù)、寫入數(shù)據(jù)和刪除數(shù)據(jù)等操作。

(1)put:插入數(shù)據(jù)(put命令,不能一次性插入多條)

往students表格的info列族,增加2條數(shù)據(jù):

行鍵為s001,列限定符name,單元格值Jack;行鍵為s001,列限定符age,單元格值20;

往students表格的score列族,增加2條數(shù)據(jù):

行鍵為s001,列限定符Chinese,單元格值90;行鍵為s001,列限定符Math,單元格值85;

hbase:088:0> put 'students','s001','info:name','Jack'
Took 2.2121 seconds 
hbase:092:0> put 'students','s001','info:age','20'
Took 0.0543 seconds 
hbase:096:0> put 'students','s001','score:Chinese','90'
Took 0.0380 seconds                                                                            
hbase:097:0> put 'students','s001','score:Math','85'
Took 0.0148 seconds 

修改students表格的單元格值:行鍵為s001,列限定符name,單元格值'Jack'修改為'Mike'。

hbase:089:0> put 'students','s001','info:name','Mike'
Took 0.2027 seconds

(2)get:查詢數(shù)據(jù)

查詢students表格,行鍵為s001的所有數(shù)據(jù)。

hbase:098:0> get 'students','s001'
COLUMN                   CELL                                                                  
 info:age                timestamp=2024-03-21T01:11:05.881, value=20                           
 info:name               timestamp=2024-03-21T01:04:05.318, value=Mike                         
 score:Chinese           timestamp=2024-03-21T01:16:34.006, value=90                           
 score:Math              timestamp=2024-03-21T01:16:48.854, value=85                           
1 row(s)
Took 0.1583 seconds

查詢行鍵為s001,數(shù)據(jù)列為socre:Chinese的單元格值。

hbase:103:0> get 'students','s001','score:Chinese'
COLUMN                   CELL                                                                  
 score:Chinese           timestamp=2024-03-21T01:16:34.006, value=90                           
1 row(s)
Took 0.0142 seconds

查詢學(xué)生Mike的多次數(shù)學(xué)成績。(確保score列族數(shù)學(xué)的VERSION版本不止為1)

hbase:108:0> alter 'students',NAME=>'score',VERSIONS=>5
Updating all regions with the new schema...
1/1 regions updated.
Done.
Took 3.6026 seconds

1)寫入學(xué)生Mike的多次數(shù)學(xué)成績

hbase:100:0> put 'students','s001','score:Math','92'
Took 0.0871 seconds                                                                            
hbase:101:0> put 'students','s001','score:Math','100'
Took 0.0158 seconds

2)讀取學(xué)生Mike最新的一次數(shù)學(xué)成績(get命令默認只讀出最新寫入的單元格值,時間戳版本最大的單元格值內(nèi)容)。

hbase:102:0> get 'students','s001','score:Math'
COLUMN                   CELL                                                                  
 score:Math              timestamp=2024-03-21T01:23:13.668, value=100                          
1 row(s)
Took 0.0771 seconds 

3)查詢學(xué)生Mike的3次數(shù)學(xué)成績。

hbase:111:0> get 'students','s001',{COLUMN=>'score:Math',VERSIONS=>3}
COLUMN                   CELL                                                                  
 score:Math              timestamp=2024-03-21T01:32:55.629, value=85                           
 score:Math              timestamp=2024-03-21T01:32:35.808, value=92                           
 score:Math              timestamp=2024-03-21T01:23:13.668, value=100                          
1 row(s)
Took 0.2027 seconds

(3)scan:掃描數(shù)據(jù)(讀取所有行的每個列族的所有數(shù)據(jù)列的最新時間戳版本的單元格值)

1)為了獲得更好效果,現(xiàn)在students表中寫入多行數(shù)據(jù)。

hbase:112:0> put 'students','s002','info:name','Tom'                                                                           
hbase:113:0> put 'students','s002','info:age','19'
hbase:114:0> put 'students','s002','score:Chinese','87'                                                                           
hbase:115:0> put 'students','s002','score:Math','70'
hbase:116:0> put 'students','s003','info:name','Lucy'                                                                            
hbase:117:0> put 'students','s003','info:age',18'
hbase:122:0> put 'students','s003','score:Chinese','80'                                                                           
hbase:123:0> put 'students','s003','score:Math','90'

2)對數(shù)據(jù)表students進行全表掃描。

hbase:124:0> scan 'students'
ROW                      COLUMN+CELL                                                           
 s001                    column=info:age, timestamp=2024-03-21T01:11:05.881, value=20          
 s001                    column=info:name, timestamp=2024-03-21T01:04:05.318, value=Mike       
 s001                    column=score:Chines, timestamp=2024-03-21T01:16:34.006, value=90      
 s001                    column=score:Math, timestamp=2024-03-21T01:32:55.629, value=85        
 s002                    column=info:Chinese, timestamp=2024-03-21T01:43:05.067, value=89       
 s002                    column=info:Math, timestamp=2024-03-21T01:43:22.209, value=95         
 s002                    column=info:age, timestamp=2024-03-21T01:42:45.619, value=19          
 s002                    column=info:name, timestamp=2024-03-21T01:42:33.917, value=Tom        
 s003                    column=info:age, timestamp=2024-03-21T01:44:16.318, value=18          
 s003                    column=info:name, timestamp=2024-03-21T01:43:45.397, value=Lucy       
 s003                    column=score:Chinese, timestamp=2024-03-21T01:45:40.078, value=80      
 s003                    column=score:Math, timestamp=2024-03-21T01:45:53.743, value=90        
3 row(s)
Took 0.2514 seconds 

3)對數(shù)據(jù)表students的指定行鍵范圍的數(shù)據(jù)進行掃描。

#若只指定開始的行鍵STARTROW,會一直掃描到最后,包含STARTROW和最后一行數(shù)據(jù)
hbase:135:0> scan 'students',{STARTROW=>'s002'}
ROW                      COLUMN+CELL                                                           
 s002                    column=info:age, timestamp=2024-03-21T01:42:45.619, value=19          
 s002                    column=info:name, timestamp=2024-03-21T01:42:33.917, value=Tom        
 s002                    column=score:Chinese, timestamp=2024-03-21T01:48:44.123, value=87      
 s002                    column=score:Math, timestamp=2024-03-21T01:48:59.578, value=70        
 s003                    column=info:age, timestamp=2024-03-21T01:44:16.318, value=18          
 s003                    column=info:name, timestamp=2024-03-21T01:43:45.397, value=Lucy       
 s003                    column=score:Chinese, timestamp=2024-03-21T01:45:40.078, value=80      
 s003                    column=score:Math, timestamp=2024-03-21T01:45:53.743, value=90        
2 row(s)
Took 0.6646 seconds 
#同時指定STARTROW和STOPROW,行鍵范圍包括STARTROW,但不包含STOPROW的數(shù)據(jù)
hbase:136:0> scan 'students',{STARTROW=>'s002',STOPROW=>'s003'}
ROW                      COLUMN+CELL                                                           
 s002                    column=info:age, timestamp=2024-03-21T01:42:45.619, value=19          
 s002                    column=info:name, timestamp=2024-03-21T01:42:33.917, value=Tom        
 s002                    column=score:Chinese, timestamp=2024-03-21T01:48:44.123, value=87      
 s002                    column=score:Math, timestamp=2024-03-21T01:48:59.578, value=70        
1 row(s)
Took 0.0566 seconds

4)對數(shù)據(jù)表students的指定列族info進行掃描。

hbase:137:0> scan 'students',{COLUMNS=>['info']}
ROW                      COLUMN+CELL                                                           
 s001                    column=info:age, timestamp=2024-03-21T01:11:05.881, value=20          
 s001                    column=info:name, timestamp=2024-03-21T01:04:05.318, value=Mike       
 s002                    column=info:age, timestamp=2024-03-21T01:42:45.619, value=19          
 s002                    column=info:name, timestamp=2024-03-21T01:42:33.917, value=Tom        
 s003                    column=info:age, timestamp=2024-03-21T01:44:16.318, value=18          
 s003                    column=info:name, timestamp=2024-03-21T01:43:45.397, value=Lucy       
3 row(s)
Took 0.2538 seconds

5)對數(shù)據(jù)表students的指定列族info下的name數(shù)據(jù)列進行掃描。

hbase:138:0> scan 'students',{COLUMNS=>['info:name']}
ROW                      COLUMN+CELL                                                           
 s001                    column=info:name, timestamp=2024-03-21T01:04:05.318, value=Mike       
 s002                    column=info:name, timestamp=2024-03-21T01:42:33.917, value=Tom        
 s003                    column=info:name, timestamp=2024-03-21T01:43:45.397, value=Lucy       
3 row(s)
Took 0.0447 seconds

6)對數(shù)據(jù)表students的前2行數(shù)據(jù)進行掃描。

hbase:139:0> scan 'students',{LIMIT=>2}
ROW                      COLUMN+CELL                                                           
 s001                    column=info:age, timestamp=2024-03-21T01:11:05.881, value=20          
 s001                    column=info:name, timestamp=2024-03-21T01:04:05.318, value=Mike       
 s001                    column=score:Chinese, timestamp=2024-03-21T01:16:34.006, value=90      
 s001                    column=score:Math, timestamp=2024-03-21T01:32:55.629, value=85        
 s002                    column=info:age, timestamp=2024-03-21T01:42:45.619, value=19          
 s002                    column=info:name, timestamp=2024-03-21T01:42:33.917, value=Tom        
 s002                    column=score:Chinese, timestamp=2024-03-21T01:48:44.123, value=87      
 s002                    column=score:Math, timestamp=2024-03-21T01:48:59.578, value=70        
2 row(s)
Took 0.0328 seconds 
(4)count:統(tǒng)計表行數(shù)
hbase:141:0> count 'students'
3 row(s)
Took 1.1445 seconds                                                                            
=> 3
(5)delete:刪除指定數(shù)據(jù)列單元格

刪除數(shù)據(jù)表students的指定數(shù)據(jù)列單元格(刪除行鍵003的列族score下的列限定符Math單元格)。

hbase:143:0> delete 'students','s003','score:Math'
Took 0.0677 seconds                                                                            
hbase:144:0> get 'students','s003'
COLUMN                   CELL                                                                  
 info:age                timestamp=2024-03-21T01:44:16.318, value=18                           
 info:name               timestamp=2024-03-21T01:43:45.397, value=Lucy                         
 score:Chines            timestamp=2024-03-21T01:45:40.078, value=80                           
1 row(s)
Took 0.1472 seconds

(6)deleteall:刪除指定數(shù)據(jù)行

1)刪除數(shù)據(jù)表students的行鍵為s003的數(shù)據(jù)。

hbase:145:0> deleteall 'students','s003'
Took 0.1017 seconds                                                                            
hbase:146:0> get 'students','s003'
COLUMN                   CELL                                                                  
0 row(s)
Took 0.0270 seconds 

2)刪除數(shù)據(jù)表students的行鍵為s002,列名為score:chinese的所有數(shù)據(jù)。

hbase:148:0> deleteall 'students','s002','score:Chinese'
Took 0.0182 seconds                                                                            
hbase:149:0> get 'students','s002'
COLUMN                   CELL                                                                  
 info:age                timestamp=2024-03-21T01:42:45.619, value=19                           
 info:name               timestamp=2024-03-21T01:42:33.917, value=Tom                          
 score:Math              timestamp=2024-03-21T01:48:59.578, value=70                           
1 row(s)
Took 0.0348 seconds

(7)append:給指定列的單元格追加內(nèi)容

給行鍵s002,列名info: name的數(shù)據(jù)列單元格值Tom后面追加son后變成Tomson。

hbase:007:0> append 'students','s002','info:name','son'
CURRENT VALUE = Tomson
Took 0.9325 seconds 
hbase:008:0> get 'students','s002'
COLUMN                                         CELL                                                                                                                                 
 info:age                                      timestamp=2024-03-21T01:42:45.619, value=19                                                                                          
 info:name                                     timestamp=2024-03-21T06:16:33.838, value=Tomson                                                                                      
 score:Math                                    timestamp=2024-03-21T01:48:59.578, value=70                                                                                          
1 row(s)
Took 0.4914 seconds 

(8)truncate:清空指定數(shù)據(jù)表的全部數(shù)據(jù)內(nèi)容

清空數(shù)據(jù)表students的內(nèi)容。

hbase:009:0> truncate 'students'
Truncating 'students' table (it may take a while):
Disabling table...
2024-03-21 06:17:52,730 INFO  [main] client.HBaseAdmin (HBaseAdmin.java:rpcCall(926)) - Started disable of students
2024-03-21 06:17:57,843 INFO  [main] client.HBaseAdmin (HBaseAdmin.java:postOperationResult(3591)) - Operation: DISABLE, Table Name: default:students, procId: 194 completed
Truncating table...
2024-03-21 06:17:57,898 INFO  [main] client.HBaseAdmin (HBaseAdmin.java:rpcCall(806)) - Started truncating students
2024-03-21 06:18:02,439 INFO  [main] client.HBaseAdmin (HBaseAdmin.java:postOperationResult(3591)) - Operation: TRUNCATE, Table Name: default:students, procId: 197 completed
Took 10.4274 seconds                                                                                                                                                                
hbase:010:0> scan 'students'
ROW                                            COLUMN+CELL                                                                                                                          
0 row(s)
Took 6.5341 seconds

六、查詢數(shù)據(jù)時顯示中文內(nèi)容

直接通過設(shè)置FORMATTER的屬性值為'toString'即可。

hbase:022:0> scan 'major',FORMATTER=>'toString'
ROW                                         COLUMN+CELL                                                                                                                   
 row1                                       column=info:college, timestamp=2024-04-08T04:50:16.954, value=信息工程學(xué)院                                                          
 row1                                       column=info:mname, timestamp=2024-04-08T04:49:59.301, value=大數(shù)據(jù)技術(shù)                                                             
 row1                                       column=info:mnum, timestamp=2024-04-08T04:49:29.291, value=m001                                                               
 row1                                       column=other:class, timestamp=2024-04-08T04:50:40.604, value=engineer                                                         
 row2                                       column=info:college, timestamp=2024-04-08T04:52:15.739, value=信息工程學(xué)院                                                          
 row2                                       column=info:mname, timestamp=2024-04-08T04:52:10.160, value=網(wǎng)絡(luò)技術(shù)                                                              
 row2                                       column=info:mnum, timestamp=2024-04-08T04:52:03.393, value=m002                                                               
 row2                                       column=other:class, timestamp=2024-04-08T04:52:23.712, value=engineer                                                         
2 row(s)
Took 0.0779 seconds                                                                                                                                                       

?文章來源地址http://www.zghlxwxcb.cn/news/detail-850176.html

到了這里,關(guān)于HBase Shell基本操作的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實不符,請點擊違法舉報進行投訴反饋,一經(jīng)查實,立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費用

相關(guān)文章

  • 【大數(shù)據(jù)存儲與處理】實驗一 HBase 的基本操作

    【大數(shù)據(jù)存儲與處理】實驗一 HBase 的基本操作

    一、實驗?zāi)康模?1.?掌握?Hbase?創(chuàng)建數(shù)據(jù)庫表及刪除數(shù)據(jù)庫表? 2.?掌握?Hbase?對數(shù)據(jù)庫表數(shù)據(jù)的增、刪、改、查。 二、實驗內(nèi)容: 1、 題目?0:進入?hbase?shell? 2 、 題目 ?1 :Hbase?創(chuàng)建數(shù)據(jù)庫表?創(chuàng)建數(shù)據(jù)庫表的命令:create?\\\'表名\\\',?\\\'列族名?1\\\',\\\'列族名?2\\\',\\\'列族名?N\\\' 3、 題

    2024年02月03日
    瀏覽(24)
  • 【大數(shù)據(jù)存儲】實驗3 HBase的安裝和基本操作

    【大數(shù)據(jù)存儲】實驗3 HBase的安裝和基本操作

    Ubuntu 22.04.3 Jdk 1.8.0_341 Hadoop 3.2.3 Hbase 2.4.17 HBase偽分布式安裝的配置 1. 配置hbase-env.sh文件 3. 啟動運行HBase 4. 停止運行HBase HBase常用的Shell命令 打開hbase 在HBase中創(chuàng)建表 create \\\'template\\\',\\\'f1\\\',\\\'f2\\\',\\\'f3\\\' 添加數(shù)據(jù) put \\\'template\\\',\\\'r1\\\',\\\'f1:c1\\\',\\\'hello\\\' scan \\\'template\\\' 查看數(shù)據(jù) get:通過表名、行、列、時

    2024年04月15日
    瀏覽(27)
  • HDFS 基本 shell 操作

    HDFS 基本 shell 操作

    調(diào)用格式: 例如: 調(diào)用格式: 注意: 直接寫/是省略了文件系統(tǒng)的名稱hdfs://ip:port。 例如: 調(diào)用格式: 例如: 調(diào)用格式: 本地文件 hello1.txt 的內(nèi)容追加到 hdfs 文件 hello.txt 的后面操作如下: 原 hello.txt:hello world 原 hello1.txt:hello 追加的 hello.txt 中內(nèi)容如下 查看分布式文件系統(tǒng)的目錄

    2024年02月15日
    瀏覽(18)
  • 云計算與大數(shù)據(jù)實驗七 HBase的安裝與基本操作

    云計算與大數(shù)據(jù)實驗七 HBase的安裝與基本操作

    一、實驗?zāi)康?回顧 Hadoop 和 Zookeeper安裝與配置 掌握 HBase 安裝與配置 理解HBase工作原理 掌握HBase表的基本操作 二、實驗內(nèi)容 HBase 安裝與配置 使用 HBase shell 指令創(chuàng)建表 使用 HBase shell 命令添加/刪除數(shù)據(jù) 使用命令刪除表 三、實驗步驟 (一)HBase 安裝與配置 HBase安裝 HBase 的安

    2024年02月03日
    瀏覽(29)
  • Layui Table 鼠標(biāo)懸浮彈層顯示超出內(nèi)容、Table基本操作

    Layui Table 鼠標(biāo)懸浮彈層顯示超出內(nèi)容、Table基本操作

    JS的DOM之鼠標(biāo)懸浮事件 鼠標(biāo)懸浮事件之 mouseover()和 mouseout()事件 鼠標(biāo)在這塊區(qū)域時候會觸發(fā)相應(yīng)事件,將鼠標(biāo)挪開則恢復(fù)原先事件 懸浮事件編寫 實現(xiàn)效果 ?

    2024年02月11日
    瀏覽(28)
  • 【lesson13】MySQL表的基本操作之create(創(chuàng)建),update(更新)和replace(替換)

    【lesson13】MySQL表的基本操作之create(創(chuàng)建),update(更新)和replace(替換)

    CRUD : Create(創(chuàng)建), Retrieve(讀取),Update(更新),Delete(刪除) 建表 基礎(chǔ)測試 全列插入 指定列插入 注意: 1.指定列插入時一定要按前面指定列的順序,插入數(shù)據(jù),否則就會報錯。 2.如果忽略某些列,那么這些列一定要有,默認值或者是自增長的,否則就會報錯 3.into 也可以省略

    2024年02月04日
    瀏覽(19)
  • HIVE 表 DLL 基本操作(一)——第1關(guān):Create/Alter/Drop 數(shù)據(jù)庫

    第1關(guān):Create/Alter/Drop 數(shù)據(jù)庫 任務(wù)描述 本關(guān)任務(wù):根據(jù)編程要求對數(shù)據(jù)庫進行相關(guān)操作。 相關(guān)知識 為了完成本關(guān)任務(wù),你需要掌握: 1.如何創(chuàng)建數(shù)據(jù)庫; 2.如何修改數(shù)據(jù)庫; 3.如何刪除數(shù)據(jù)庫。 Create 創(chuàng)建數(shù)據(jù)庫 數(shù)據(jù)庫本質(zhì)上是一個目錄或命名空間,用于解決表命名沖突。

    2024年02月03日
    瀏覽(22)
  • 【Linux】操作系統(tǒng)的基本概念 {馮諾依曼體系結(jié)構(gòu),操作系統(tǒng)的基本概念,系統(tǒng)調(diào)用及用戶操作接口,shell程序}

    【Linux】操作系統(tǒng)的基本概念 {馮諾依曼體系結(jié)構(gòu),操作系統(tǒng)的基本概念,系統(tǒng)調(diào)用及用戶操作接口,shell程序}

    現(xiàn)代計算機設(shè)計大都遵守馮·諾依曼體系結(jié)構(gòu): 截至目前,我們所認識的計算機,都是由一個個的硬件組件組成 輸入單元:包括鍵盤, 鼠標(biāo),掃描儀, 磁盤,網(wǎng)卡等 存儲器: 內(nèi)存(提高數(shù)據(jù)讀寫速度,降低硬件成本) 中央處理器(CPU):含有運算器(算數(shù)運算,邏輯運算)和控

    2024年02月11日
    瀏覽(53)
  • [NAND Flash 6.4] NAND FLASH基本讀操作及原理_NAND FLASH Read Operation源碼實現(xiàn)

    [NAND Flash 6.4] NAND FLASH基本讀操作及原理_NAND FLASH Read Operation源碼實現(xiàn)

    依公知及經(jīng)驗整理,原創(chuàng)保護,禁止轉(zhuǎn)載。 專欄 《深入理解NAND Flash》 返回總目錄 ?全文 6000 字 內(nèi)容摘要 NAND Flash 引腳功能 讀操作步驟 NAND Flash 中的特殊硬件結(jié)構(gòu) NAND Flash 讀寫時的數(shù)據(jù)流向 Read 操作時序 讀時序操作過程的解釋 Read 操作實戰(zhàn)流程設(shè)計 NAND Read 源碼 前言 上面

    2024年01月19日
    瀏覽(40)
  • [NAND Flash 6.3] NAND FLASH基本編程(寫)操作及原理_NAND FLASH Program Operation 源碼實現(xiàn)

    依公知及經(jīng)驗整理,原創(chuàng)保護,禁止轉(zhuǎn)載。 專欄 《深入理解NAND Flash》 返回總目錄 全文 3244 字 ? 前言 使用的 NAND FLASH 的硬件原理圖,面對這些引腳,很難明白他們是什么含義,下面先來個熱身: 問1. 原理圖上 NAND FLASH 只有數(shù)據(jù)線,怎么傳輸?shù)刂罚?答1. 在 DATA0~DATA7 上既傳

    2024年01月19日
    瀏覽(29)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包