1、创建表 create '表名', '列族名1','列族名2'......'列族名N'
create 'www.qq.com20170630','movie','music','games'
create 'www.baidu.com20170630','search','games'
?2、描述表 describe ‘表名’
describe 'www.baidu.com20170630'
?3、判断表存在 exists '表名'
exists 'www.baidu.com20170630'
4、判断是否禁用启用表??? is_enabled '表名',is_disabled ‘表名’
is_disabled 'www.baidu.com20170630'
is_enabled 'www.baidu.com20170630'
5、添加数据?put ‘表名’, ‘rowKey’, ‘列族 : 列’, '值'
put 'www.baidu.com20170630','rowkey123','games:usercount','12'
put 'www.baidu.com20170630','rowkey123','search:bagua','huang xiao ming'
put 'www.baidu.com20170630','rowkey1236','games:usercount','200'
put 'www.baidu.com20170630','rowkey1234','search:bagua','hxm'
put 'www.baidu.com20170630','rowkey1234','games:usercount','12'
put 'www.baidu.com20170630','rowkey1234','search:bagua','210'
put 'www.baidu.com20170630','rowkey1234','games:usercount','200'
put 'www.baidu.com20170630','rowkey1234','search:bagua','hxm'
put 'www.qq.com20170630','rowkey123','movie:dhxy','zxc'
put 'www.qq.com20170630','rowkey123','music:singer','xiaolei'
put 'www.qq.com20170630','rowkey123', 'movie:dhxy','zxc'
put 'www.qq.com20170630','rowkey1231','games:usercount','100'
put 'www.qq.com20170630','rowkey1231','music:singer','chenyixun'
?
?6、查看数据 scan'表名'
scan 'www.baidu.com20170630'
?7、查看记录rowkey下的所有数据 get '表名' , 'rowKey'
get 'www.baidu.com20170630','rowkey123'
get 'www.qq.com20170630','rowkey1232'
get 'www.baidu.com20170630','rowkey1234'
?8、查看表中的记录总数 count '表名'
count 'www.qq.com20170630'
count 'www.baidu.com20170630'
9、获取某个列族 get '表名','rowkey',‘列族’
get 'www.baidu.com20170630','rowkey123','games'
?
10、获取某个列族的某个列 get '表名','rowkey','列族:列’
get 'www.baidu.com20170630','rowkey123','games:usercount'
?11、获取某个列族的某几个列
get 'www.baidu.com20170630','rowkey123',{COLUMN=>['games:usercount','search:bagua']}
|