当前位置: 首页 > news >正文

用python做的电商网站网站开发软件

用python做的电商网站,网站开发软件,电影网站做流量,在旅行社做网站运营电商( eshop)平台具有海量数据、高并发访问、高速读写等特征,适合使用HBase分布式数据库进行数据存储。本节通过一个 HBase在电商平台的应用案例,熟练掌握并综合运用HBase Shell命令行终端提供的各种操作命令。 一、电商(eshop)平台的逻辑数据模型 在H…

电商( eshop)平台具有海量数据、高并发访问、高速读写等特征,适合使用HBase分布式数据库进行数据存储。本节通过一个 HBase在电商平台的应用案例,熟练掌握并综合运用HBase Shell命令行终端提供的各种操作命令。

一、电商(eshop)平台的逻辑数据模型

在HBase创建一个自定义命名空间eshop,用于存放电商平台的用户表shopping(客户商品订单表)。用户表shopping 包括customer、order和 item共三个列族,用逻辑数据模型来表示表中存放的数据。如表1所示:

表1 用逻辑数据模型表示电商系统用户表shopping中存放的数据
行键(RowKey)列族:customer列族:order列族:item
列限定符单元格值列限定符单元格值列限定符单元格值
s001nameJacknumber1item_nameiphone8
s001phone00000000001datetime2020-4-21price8000.00 
s001addressWuHanpay-statenot payed
s001levelnormal
s002nameTomnumber2item_nameHAWEI MATE X2
s002phone00000000002datetime2020-4-22price6000.00 
s002addressBeiJing
s002preferencee-product
s003nameMikenumber3item_nameXIAO MI 11
s003phone00000000003datetime2020-4-23price5000.00 
s003addressShangHai
s003age20
s004nameLucynumber4item_nameLancome
s004phone00000000004datetime2020-4-23price10000.00 
s004addressHangZhoupay-statepayed
s004preferencecosmeticspost-staterecieved
s004levelVIP
s005nameLilynumber10item_nameLV
s005phone00000000005datetime2020-4-23price20000.00 
s005preferencehandbagpay-statepayed
s005levelVIPpost-statedelivered
s005emailabc@qq.com

二、使用HBase Shell操作电商平台数据

1.对电商平台数据执行简单读写操作

1)创建一个名称为eshop的名字空间,并列出HBase系统所有的名字空间。

hbase:003:0> create_namespace 'eshop'
Took 3.5909 seconds                                                                            
hbase:004:0> list_namespace
NAMESPACE                                                                                      
default                                                                                        
eshop                                                                                          
hbase                                                                                          
3 row(s)
Took 0.0606 seconds

2)在eshop名字空间中创建表名为shopping的用户表,包含1个列族customer;再列出HBase的所有数据表。

hbase:012:0> create 'eshop:shopping','customer'
2024-03-22 01:33:35,528 INFO  [main] client.HBaseAdmin (HBaseAdmin.java:postOperationResult(3591)) - Operation: CREATE, Table Name: eshop:shopping, procId: 216 completed
Created table eshop:shopping
Took 2.5136 seconds                                                                            
=> Hbase::Table - eshop:shopping
hbase:013:0> list
TABLE                                                                                          
eshop:shopping                                                                                 
1 row(s)
Took 0.0670 seconds                                                                            
=> ["eshop:shopping"]

3)给eshop 名字空间中的shopping表增加两个新的列族order和 item;再查看其表格结构。

hbase:018:0> alter 'eshop:shopping','order','item'
Updating all regions with the new schema...
1/1 regions updated.
Done.
Took 3.4106 seconds                                                                            
hbase:019:0> desc 'eshop:shopping'
Table eshop:shopping is ENABLED                                                                
eshop:shopping, {TABLE_ATTRIBUTES => {METADATA => {'hbase.store.file-tracker.impl' => 'DEFAULT'
}}}                                                                                            
COLUMN FAMILIES DESCRIPTION                                                                    
{NAME => 'customer', INDEX_BLOCK_ENCODING => 'NONE', VERSIONS => '1', KEEP_DELETED_CELLS => 'FA
LSE', DATA_BLOCK_ENCODING => 'NONE', TTL => 'FOREVER', MIN_VERSIONS => '0', REPLICATION_SCOPE =
> '0', BLOOMFILTER => 'ROW', IN_MEMORY => 'false', COMPRESSION => 'NONE', BLOCKCACHE => 'true',BLOCKSIZE => '65536 B (64KB)'}                                                                {NAME => 'item', 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 => 'order', 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)'}                                                                   3 row(s)

4)先删除 shopping表后再重新创建shopping表,包含3个列族customer,order和 item。

hbase:020:0> disable 'eshop:shopping'
2024-03-22 01:38:46,086 INFO  [main] client.HBaseAdmin (HBaseAdmin.java:rpcCall(926)) - Started disable of eshop:shopping
2024-03-22 01:38:46,764 INFO  [main] client.HBaseAdmin (HBaseAdmin.java:postOperationResult(3591)) - Operation: DISABLE, Table Name: eshop:shopping, procId: 228 completed
Took 0.7314 seconds                                                                            
hbase:021:0> drop 'eshop:shopping'
2024-03-22 01:38:58,599 INFO  [main] client.HBaseAdmin (HBaseAdmin.java:postOperationResult(3591)) - Operation: DELETE, Table Name: eshop:shopping, procId: 231 completed
Took 0.4091 seconds                                                                            
hbase:022:0> list
TABLE                                                                                          
0 row(s)
Took 0.0491 seconds                                                                            
=> []
hbase:023:0> create 'eshop:shopping','customer','order','item'
2024-03-22 01:39:52,129 INFO  [main] client.HBaseAdmin (HBaseAdmin.java:postOperationResult(3591)) - Operation: CREATE, Table Name: eshop:shopping, procId: 232 completed
Created table eshop:shopping
Took 2.2332 seconds                                                                            
=> Hbase::Table - eshop:shopping

5)修改shopping表的表级别属性,将文件大小最大值修改为134217728字节。

hbase:024:0> alter 'eshop:shopping',MAX_FILESIZE=>134217728
Updating all regions with the new schema...
1/1 regions updated.
Done.
Took 2.2104 seconds

6)描述shopping表的列族属性信息。

hbase:025:0> desc 'eshop:shopping'
Table eshop:shopping is ENABLED                                                                
eshop:shopping, {TABLE_ATTRIBUTES => {MAX_FILESIZE => '134217728 B (128MB)', METADATA => {'hbas
e.store.file-tracker.impl' => 'DEFAULT'}}}                                                     
COLUMN FAMILIES DESCRIPTION                                                                    
{NAME => 'customer', INDEX_BLOCK_ENCODING => 'NONE', VERSIONS => '1', KEEP_DELETED_CELLS => 'FA
LSE', DATA_BLOCK_ENCODING => 'NONE', TTL => 'FOREVER', MIN_VERSIONS => '0', REPLICATION_SCOPE =
> '0', BLOOMFILTER => 'ROW', IN_MEMORY => 'false', COMPRESSION => 'NONE', BLOCKCACHE => 'true',BLOCKSIZE => '65536 B (64KB)'}                                                                {NAME => 'item', 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 => 'order', 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)'}                                                                   3 row(s)
Quota is disabled
Took 0.0846 seconds

7)将用户表shopping逻辑数据模型中的所有数据写入到shooping表中。

hbase:026:0> put 'eshop:shopping','s001','customer:name','Jack'
Took 0.6497 seconds                                                                            
hbase:027:0> put 'eshop:shopping','s001','customer:phone','00000000001'
Took 0.0513 seconds                                                                            
hbase:028:0> put 'eshop:shopping','s001','customer:address','WuHan'
Took 0.0231 seconds                                                                            
hbase:029:0> put 'eshop:shopping','s001','customer:level','normal'
Took 0.0139 seconds                                                                            
hbase:030:0> put 'eshop:shopping','s001','order:number','1'
Took 0.0282 seconds                                                                            
hbase:031:0> put 'eshop:shopping','s001','order:datetime','2020-4-21'
Took 0.0488 seconds                                                                            
hbase:032:0> put 'eshop:shopping','s001','order:pay-state','not-payed'
Took 0.0215 seconds                                                                            
hbase:033:0> put 'eshop:shopping','s001','item:item_name','iphone8'
Took 0.0396 seconds                                                                            
hbase:034:0> put 'eshop:shopping','s001','item:price','8000.00'
Took 0.0133 seconds
hbase:040:0> put 'eshop:shopping','s002','customer:name','Tom'
Took 0.0170 seconds                                                                                                                    
hbase:041:0> put 'eshop:shopping','s002','customer:phone','00000000002'
Took 0.0196 seconds                                                                                                                    
hbase:042:0> put 'eshop:shopping','s002','customer:address','BeiJing'
Took 0.0214 seconds                                                                                                                    
hbase:043:0> put 'eshop:shopping','s002','customer:preference','e-product'
Took 0.0196 seconds                                                                                                                    
hbase:044:0> put 'eshop:shopping','s002','order:number','2'
Took 0.0150 seconds                                                                                                                    
hbase:045:0> put 'eshop:shopping','s002','order:datetime','2020-4-22'
Took 0.0149 seconds                                                                                                                    
hbase:046:0> put 'eshop:shopping','s002','item:item_name','HUAWEI MATE X2'
Took 0.0471 seconds                                                                                                                    
hbase:047:0> put 'eshop:shopping','s002','item:price','6000.00'
Took 0.0421 seconds 
hbase:053:0> put 'eshop:shopping','s003','customer:name','Mike'
Took 0.0621 seconds                                                                                                                    
hbase:054:0> put 'eshop:shopping','s003','customer:phone','00000000003'
Took 0.0216 seconds                                                                                                                    
hbase:055:0> put 'eshop:shopping','s003','customer:address','Shanghai'
Took 0.0172 seconds                                                                                                                    
hbase:056:0> put 'eshop:shopping','s003','customer:age','20'
Took 0.0390 seconds                                                                                                                    
hbase:057:0> put 'eshop:shopping','s003','order:number','3'
Took 0.0605 seconds                                                                                                                    
hbase:058:0> put 'eshop:shopping','s003','order:datetime','2020-4-23'
Took 0.0120 seconds                                                                                                                    
hbase:059:0> put 'eshop:shopping','s003','item:item_name','XIAO MI 11'
Took 0.0084 seconds                                                                                                                    
hbase:060:0> put 'eshop:shopping','s003','item:price','5000.00'
Took 0.0207 seconds 
hbase:061:0> put 'eshop:shopping','s004','customer:name','Lucy'
Took 0.0157 seconds                                                                                                                    
hbase:062:0> put 'eshop:shopping','s004','customer:phone','00000000004'
Took 0.0085 seconds                                                                                                                    
hbase:063:0> put 'eshop:shopping','s004','customer:address','HangZhou'
Took 0.0165 seconds                                                                                                                    
hbase:064:0> put 'eshop:shopping','s004','customer:preference','cosmetics'
Took 0.0166 seconds                                                                                                                    
hbase:065:0> put 'eshop:shopping','s004','customer:level','VIP'
Took 0.0113 seconds                                                                                                                    
hbase:066:0> put 'eshop:shopping','s004','order:number','4'
Took 0.0145 seconds                                                                                                                    
hbase:067:0> put 'eshop:shopping','s004','order:datetime','202-4-23'
Took 0.0300 seconds                                                                                                                    
hbase:068:0> put 'eshop:shopping','s004','order:pay-state','payed'
Took 0.0086 seconds                                                                                                                    
hbase:069:0> put 'eshop:shopping','s004','order:post_state','recieved'
Took 0.0148 seconds                                                                                                                    
hbase:070:0> put 'eshop:shopping','s004','item:item_name','Lancome'
Took 0.0251 seconds                                                                                                                    
hbase:071:0> put 'eshop:shopping','s004','item:price','10000.00'
Took 0.0289 seconds                                                                                                                    
hbase:072:0> put 'eshop:shopping','s005','customer:name','Lily'
Took 0.0249 seconds                                                                                                                    
hbase:073:0> put 'eshop:shopping','s005','customer:phone','00000000005'
Took 0.0286 seconds                                                                                                                    
hbase:074:0> put 'eshop:shopping','s005','customer:preference','handbag'
Took 0.0263 seconds                                                                                                                    
hbase:075:0> put 'eshop:shopping','s005','customer:level','VIP'
Took 0.0178 seconds                                                                                                                    
hbase:076:0> put 'eshop:shopping','s005','customer:email','abc@qq.com'
Took 0.0237 seconds                                                                                                                    
hbase:077:0> put 'eshop:shopping','s005','order:number','10'
Took 0.0098 seconds                                                                                                                    
hbase:078:0> put 'eshop:shopping','s005','order:datetime','2020-4-23'
Took 0.0211 seconds                                                                                                                    
hbase:079:0> put 'eshop:shopping','s005','order:pay-state','payed'
Took 0.0245 seconds                                                                                                                    
hbase:080:0> put 'eshop:shopping','s005','order:post-state','delivered'
Took 0.0256 seconds                                                                                                                    
hbase:081:0> put 'eshop:shopping','s005','item:item_name','LV'
Took 0.0258 seconds                                                                                                                    
hbase:082:0> put 'eshop:shopping','s005','item:price','20000.00'
Took 0.0199 seconds

8)对shopping表进行全表扫描(读取所有数据行的所有数据列单元格)。

hbase:084:0> scan 'eshop:shopping'
ROW                                COLUMN+CELL                                                                                         s001                              column=customer:address, timestamp=2024-03-22T01:53:27.728, value=WuHan                             s001                              column=customer:level, timestamp=2024-03-22T01:54:02.171, value=normal                              s001                              column=customer:name, timestamp=2024-03-22T02:01:27.551, value=Jack                                 s001                              column=customer:phone, timestamp=2024-03-22T01:52:48.474, value=00000000001                         s001                              column=item:item_name, timestamp=2024-03-22T01:57:17.558, value=iphone8                             s001                              column=item:price, timestamp=2024-03-22T01:57:36.270, value=8000.00                                 s001                              column=order:datetime, timestamp=2024-03-22T01:56:12.975, value=2020-4-21                           s001                              column=order:number, timestamp=2024-03-22T01:55:44.843, value=1                                     s001                              column=order:pay-state, timestamp=2024-03-22T01:56:41.609, value=not-payed                          s002                              column=customer:address, timestamp=2024-03-22T02:03:43.489, value=BeiJing                           s002                              column=customer:name, timestamp=2024-03-22T02:02:58.983, value=Tom                                  s002                              column=customer:phone, timestamp=2024-03-22T02:03:20.715, value=00000000002                         s002                              column=customer:preference, timestamp=2024-03-22T02:04:05.414, value=e-product                      s002                              column=item:item_name, timestamp=2024-03-22T02:05:43.969, value=HUAWEI MATE X2                      s002                              column=item:price, timestamp=2024-03-22T02:06:41.294, value=6000.00                                 s002                              column=order:datetime, timestamp=2024-03-22T02:05:05.397, value=2020-4-22                           s002                              column=order:number, timestamp=2024-03-22T02:04:44.084, value=2                                     s003                              column=customer:address, timestamp=2024-03-22T02:23:25.999, value=Shanghai                          s003                              column=customer:age, timestamp=2024-03-22T02:23:39.768, value=20                                    s003                              column=customer:name, timestamp=2024-03-22T02:22:45.243, value=Mike                                 s003                              column=customer:phone, timestamp=2024-03-22T02:23:08.255, value=00000000003                         s003                              column=item:item_name, timestamp=2024-03-22T02:24:45.930, value=XIAO MI 11                          s003                              column=item:price, timestamp=2024-03-22T02:25:02.682, value=5000.00                                 s003                              column=order:datetime, timestamp=2024-03-22T02:24:17.560, value=2020-4-23                           s003                              column=order:number, timestamp=2024-03-22T02:24:00.754, value=3                                     s004                              column=customer:address, timestamp=2024-03-22T02:26:34.380, value=HangZhou                          s004                              column=customer:level, timestamp=2024-03-22T02:27:35.830, value=VIP                                 s004                              column=customer:name, timestamp=2024-03-22T02:25:44.580, value=Lucy                                 s004                              column=customer:phone, timestamp=2024-03-22T02:26:07.073, value=00000000004                         s004                              column=customer:preference, timestamp=2024-03-22T02:27:17.408, value=cosmetics                      s004                              column=item:item_name, timestamp=2024-03-22T02:29:59.988, value=Lancome                             s004                              column=item:price, timestamp=2024-03-22T02:30:16.339, value=10000.00                                s004                              column=order:datetime, timestamp=2024-03-22T02:28:40.420, value=202-4-23                            s004                              column=order:number, timestamp=2024-03-22T02:28:20.236, value=4                                     s004                              column=order:pay-state, timestamp=2024-03-22T02:28:59.712, value=payed                              s004                              column=order:post_state, timestamp=2024-03-22T02:29:21.588, value=recieved                          s005                              column=customer:email, timestamp=2024-03-22T02:33:56.564, value=abc@qq.com                          s005                              column=customer:level, timestamp=2024-03-22T02:33:34.457, value=VIP                                 s005                              column=customer:name, timestamp=2024-03-22T02:31:36.776, value=Lily                                 s005                              column=customer:phone, timestamp=2024-03-22T02:32:24.128, value=00000000005                         s005                              column=customer:preference, timestamp=2024-03-22T02:33:09.550, value=handbag                        s005                              column=item:item_name, timestamp=2024-03-22T02:36:24.703, value=LV                                  s005                              column=item:price, timestamp=2024-03-22T02:36:40.468, value=20000.00                                s005                              column=order:datetime, timestamp=2024-03-22T02:34:45.746, value=2020-4-23                           s005                              column=order:number, timestamp=2024-03-22T02:34:23.380, value=10                                    s005                              column=order:pay-state, timestamp=2024-03-22T02:35:07.771, value=payed                              s005                              column=order:post-state, timestamp=2024-03-22T02:35:59.275, value=delivered                         
5 row(s)
Took 0.1527 seconds 

9)读取shopping表的行键为s004的所有数据列的单元格值。

hbase:085:0> get 'eshop:shopping','s004'
COLUMN                             CELL                                                                                                customer:address                  timestamp=2024-03-22T02:26:34.380, value=HangZhou                                                   customer:level                    timestamp=2024-03-22T02:27:35.830, value=VIP                                                        customer:name                     timestamp=2024-03-22T02:25:44.580, value=Lucy                                                       customer:phone                    timestamp=2024-03-22T02:26:07.073, value=00000000004                                                customer:preference               timestamp=2024-03-22T02:27:17.408, value=cosmetics                                                  item:item_name                    timestamp=2024-03-22T02:29:59.988, value=Lancome                                                    item:price                        timestamp=2024-03-22T02:30:16.339, value=10000.00                                                   order:datetime                    timestamp=2024-03-22T02:28:40.420, value=202-4-23                                                   order:number                      timestamp=2024-03-22T02:28:20.236, value=4                                                          order:pay-state                   timestamp=2024-03-22T02:28:59.712, value=payed                                                      order:post_state                  timestamp=2024-03-22T02:29:21.588, value=recieved                                                   
1 row(s)
Took 0.3746 seconds

10)读取shopping表的行键s005,列族customer,列限定符preference 的数据列的单元格值。

hbase:087:0> get 'eshop:shopping','s005','customer:preference'
COLUMN                             CELL                                                                                              customer:preference               timestamp=2024-03-22T02:33:09.550, value=handbag                                                  
1 row(s)
Took 0.0361 seconds 

2.对电商平台数据执行复杂读写操作

1)修改shopping表的列族属性,将列族order的列族属性VERSIONS修改为3。

hbase:090:0> alter 'eshop:shopping',NAME=>'order',VERSIONS=>3
Updating all regions with the new schema...
1/1 regions updated.
Done.
Took 6.8406 seconds

2)修改shopping 表的列族属性,将列族order的列族属性TTL生存时间修改为1周,压缩模式修改为gz。

hbase:093:0> alter 'eshop:shopping',NAME=>'info',TTL=>60*60*24*7,COMPRESSION=>'gz'
Updating all regions with the new schema...
1/1 regions updated.
Done.
Took 3.3336 seconds

3)将shopping表的行键为s001,列族为order,列限定符为number 的数据列的单元格值依次修改为2和3。

hbase:094:0> put 'eshop:shopping','s001','order:number',2
Took 0.0721 seconds                                                                                                                  
hbase:095:0> put 'eshop:shopping','s001','order:number',3
Took 0.0368 seconds

4)读取shopping表客户Jack(行键为s001)的订单中商品数量的最近3次的版本值。

hbase:096:0> get 'eshop:shopping','s001',{COLUMN=>'order:number',VERSIONS=>3}
COLUMN                             CELL                                                                                              order:number                      timestamp=2024-03-22T02:54:22.959, value=3                                                        order:number                      timestamp=2024-03-22T02:54:19.466, value=2                                                        order:number                      timestamp=2024-03-22T01:55:44.843, value=1                                                        
1 row(s)
Took 0.1118 seconds 

5)对shopping表指定行键范围s002到s004的数据行进行扫描,扫描结果包括第s002行,也包括第s004行。

hbase:098:0> scan 'eshop:shopping',{STARTROW=>'s002',STOPROW=>'s005'}
ROW                                COLUMN+CELL                                                                                       s002                              column=customer:address, timestamp=2024-03-22T02:03:43.489, value=BeiJing                         s002                              column=customer:name, timestamp=2024-03-22T02:02:58.983, value=Tom                                s002                              column=customer:phone, timestamp=2024-03-22T02:03:20.715, value=00000000002                       s002                              column=customer:preference, timestamp=2024-03-22T02:04:05.414, value=e-product                    s002                              column=item:item_name, timestamp=2024-03-22T02:05:43.969, value=HUAWEI MATE X2                    s002                              column=item:price, timestamp=2024-03-22T02:06:41.294, value=6000.00                               s002                              column=order:datetime, timestamp=2024-03-22T02:05:05.397, value=2020-4-22                         s002                              column=order:number, timestamp=2024-03-22T02:04:44.084, value=2                                   s003                              column=customer:address, timestamp=2024-03-22T02:23:25.999, value=Shanghai                        s003                              column=customer:age, timestamp=2024-03-22T02:23:39.768, value=20                                  s003                              column=customer:name, timestamp=2024-03-22T02:22:45.243, value=Mike                               s003                              column=customer:phone, timestamp=2024-03-22T02:23:08.255, value=00000000003                       s003                              column=item:item_name, timestamp=2024-03-22T02:24:45.930, value=XIAO MI 11                        s003                              column=item:price, timestamp=2024-03-22T02:25:02.682, value=5000.00                               s003                              column=order:datetime, timestamp=2024-03-22T02:24:17.560, value=2020-4-23                         s003                              column=order:number, timestamp=2024-03-22T02:24:00.754, value=3                                   s004                              column=customer:address, timestamp=2024-03-22T02:26:34.380, value=HangZhou                        s004                              column=customer:level, timestamp=2024-03-22T02:27:35.830, value=VIP                               s004                              column=customer:name, timestamp=2024-03-22T02:25:44.580, value=Lucy                               s004                              column=customer:phone, timestamp=2024-03-22T02:26:07.073, value=00000000004                       s004                              column=customer:preference, timestamp=2024-03-22T02:27:17.408, value=cosmetics                    s004                              column=item:item_name, timestamp=2024-03-22T02:29:59.988, value=Lancome                           s004                              column=item:price, timestamp=2024-03-22T02:30:16.339, value=10000.00                              s004                              column=order:datetime, timestamp=2024-03-22T02:28:40.420, value=202-4-23                          s004                              column=order:number, timestamp=2024-03-22T02:28:20.236, value=4                                   s004                              column=order:pay-state, timestamp=2024-03-22T02:28:59.712, value=payed                            s004                              column=order:post_state, timestamp=2024-03-22T02:29:21.588, value=recieved                        
3 row(s)
Took 0.2564 seconds 

6)对shopping表的列族customer 中的所有数据列进行扫描。

hbase:099:0> scan 'eshop:shopping',{COLUMNS=>'customer'}
ROW                                COLUMN+CELL                                                                                       s001                              column=customer:address, timestamp=2024-03-22T01:53:27.728, value=WuHan                           s001                              column=customer:level, timestamp=2024-03-22T01:54:02.171, value=normal                            s001                              column=customer:name, timestamp=2024-03-22T02:01:27.551, value=Jack                               s001                              column=customer:phone, timestamp=2024-03-22T01:52:48.474, value=00000000001                       s002                              column=customer:address, timestamp=2024-03-22T02:03:43.489, value=BeiJing                         s002                              column=customer:name, timestamp=2024-03-22T02:02:58.983, value=Tom                                s002                              column=customer:phone, timestamp=2024-03-22T02:03:20.715, value=00000000002                       s002                              column=customer:preference, timestamp=2024-03-22T02:04:05.414, value=e-product                    s003                              column=customer:address, timestamp=2024-03-22T02:23:25.999, value=Shanghai                        s003                              column=customer:age, timestamp=2024-03-22T02:23:39.768, value=20                                  s003                              column=customer:name, timestamp=2024-03-22T02:22:45.243, value=Mike                               s003                              column=customer:phone, timestamp=2024-03-22T02:23:08.255, value=00000000003                       s004                              column=customer:address, timestamp=2024-03-22T02:26:34.380, value=HangZhou                        s004                              column=customer:level, timestamp=2024-03-22T02:27:35.830, value=VIP                               s004                              column=customer:name, timestamp=2024-03-22T02:25:44.580, value=Lucy                               s004                              column=customer:phone, timestamp=2024-03-22T02:26:07.073, value=00000000004                       s004                              column=customer:preference, timestamp=2024-03-22T02:27:17.408, value=cosmetics                    s005                              column=customer:email, timestamp=2024-03-22T02:33:56.564, value=abc@qq.com                        s005                              column=customer:level, timestamp=2024-03-22T02:33:34.457, value=VIP                               s005                              column=customer:name, timestamp=2024-03-22T02:31:36.776, value=Lily                               s005                              column=customer:phone, timestamp=2024-03-22T02:32:24.128, value=00000000005                       s005                              column=customer:preference, timestamp=2024-03-22T02:33:09.550, value=handbag                      
5 row(s)
Took 0.0883 seconds 

7)对shopping表的列族customer中列名为phone的所有数据列进行扫描。

hbase:100:0> scan 'eshop:shopping',{COLUMNS=>'customer:phone'}
ROW                                COLUMN+CELL                                                                                       s001                              column=customer:phone, timestamp=2024-03-22T01:52:48.474, value=00000000001                       s002                              column=customer:phone, timestamp=2024-03-22T02:03:20.715, value=00000000002                       s003                              column=customer:phone, timestamp=2024-03-22T02:23:08.255, value=00000000003                       s004                              column=customer:phone, timestamp=2024-03-22T02:26:07.073, value=00000000004                       s005                              column=customer:phone, timestamp=2024-03-22T02:32:24.128, value=00000000005                       
5 row(s)
Took 0.0275 seconds

8)对shopping表的前3行数据进行扫描。

hbase:101:0> scan 'eshop:shopping',{LIMIT=>3}
ROW                                COLUMN+CELL                                                                                       s001                              column=customer:address, timestamp=2024-03-22T01:53:27.728, value=WuHan                           s001                              column=customer:level, timestamp=2024-03-22T01:54:02.171, value=normal                            s001                              column=customer:name, timestamp=2024-03-22T02:01:27.551, value=Jack                               s001                              column=customer:phone, timestamp=2024-03-22T01:52:48.474, value=00000000001                       s001                              column=item:item_name, timestamp=2024-03-22T01:57:17.558, value=iphone8                           s001                              column=item:price, timestamp=2024-03-22T01:57:36.270, value=8000.00                               s001                              column=order:datetime, timestamp=2024-03-22T01:56:12.975, value=2020-4-21                         s001                              column=order:number, timestamp=2024-03-22T02:54:22.959, value=3                                   s001                              column=order:pay-state, timestamp=2024-03-22T01:56:41.609, value=not-payed                        s002                              column=customer:address, timestamp=2024-03-22T02:03:43.489, value=BeiJing                         s002                              column=customer:name, timestamp=2024-03-22T02:02:58.983, value=Tom                                s002                              column=customer:phone, timestamp=2024-03-22T02:03:20.715, value=00000000002                       s002                              column=customer:preference, timestamp=2024-03-22T02:04:05.414, value=e-product                    s002                              column=item:item_name, timestamp=2024-03-22T02:05:43.969, value=HUAWEI MATE X2                    s002                              column=item:price, timestamp=2024-03-22T02:06:41.294, value=6000.00                               s002                              column=order:datetime, timestamp=2024-03-22T02:05:05.397, value=2020-4-22                         s002                              column=order:number, timestamp=2024-03-22T02:04:44.084, value=2                                   s003                              column=customer:address, timestamp=2024-03-22T02:23:25.999, value=Shanghai                        s003                              column=customer:age, timestamp=2024-03-22T02:23:39.768, value=20                                  s003                              column=customer:name, timestamp=2024-03-22T02:22:45.243, value=Mike                               s003                              column=customer:phone, timestamp=2024-03-22T02:23:08.255, value=00000000003                       s003                              column=item:item_name, timestamp=2024-03-22T02:24:45.930, value=XIAO MI 11                        s003                              column=item:price, timestamp=2024-03-22T02:25:02.682, value=5000.00                               s003                              column=order:datetime, timestamp=2024-03-22T02:24:17.560, value=2020-4-23                         s003                              column=order:number, timestamp=2024-03-22T02:24:00.754, value=3                                   
3 row(s)
Took 0.1883 seconds 

9)统计shopping表中的数据行数。

hbase:102:0> count 'eshop:shopping'
5 row(s)
Took 0.1783 seconds                                                                                                                  
=> 5

10)删除shopping表的行键为s005,列族为customer,列限定符为email的数据列。

hbase:103:0> delete 'eshop:shopping','s005','customer:email'
Took 0.1145 seconds 
http://www.wooajung.com/news/28531.html

相关文章:

  • 重庆网站建设外包公司哪家好百度助手免费下载
  • 电子商务网站主要面向百度如何优化排名靠前
  • 深圳网站建设加q5299丶14602推广优化大师是干什么的
  • 网站空间1g多少钱一年宁波seo在线优化
  • 响应式模板网站模板下载十堰seo排名公司
  • 网站打开速度慢优化电商培训心得体会
  • 山东省住房和城乡建设挺网站百度关键词搜索量排名
  • 网站页面确认书国外引擎搜索
  • 靖江做网站友情链接多久有效果
  • 琼海网站制作网站seo优化建议
  • 香港网站建设展览海口网站排名提升
  • 为了 门户网站建设百度识图鉴你所见
  • 网站的收录网络营销推广有效方式
  • 华润集团网站建设商b2b多平台一键发布
  • 广州网站建设平台杭州seo
  • 做海购的网站做百度推广的网络公司
  • 个人网站模板 php网络优化工作内容
  • 河南郑州建设网站网站seo培训
  • 怎么做网站主页对百度竞价排名的看法
  • 北京西路做网站的公司微信公众号营销
  • 专业网站有哪些平台免费推广平台排行
  • 建设门户网站特点锦州网站seo
  • 长春做企业网站正规网站建设公司
  • 成都哪里有做网站建设的家庭优化大师下载
  • 宁波seo外包推广公司西安百度提升优化
  • 牛人网络网站windows优化大师好吗
  • 网站建设 中企高程论坛推广的步骤
  • 企业平台登录seo搜索优化专员招聘
  • 电商网站模版公众号怎么引流推广
  • wordpress cpu 100seo案例分析