目录
创建表,表中有两个列族 baseinfo, schoolinfo
删除表 注意,首先要将删除的表设置为禁用状态才可以删除,否则会报错
按内容查找,value值包含有(字符串用substring,数字用binary)
web网址:http://192.168.91.180:16010
创建表,表中有两个列族 baseinfo, schoolinfo
create 'bigdata:student','baseinfo','schoolinfo'
查看指定表全名空间中的表
list_namespace_tables 'bigdata'
查看表描述
desc/describe 'bigdata:student'
禁用/启用
disable 'bigdata:student'
enable 'bigdata:student'
查看是否启用/禁用
is_disabled 'bigdata:student'
true
is_enabled 'bigdata:student'
false
删除表 注意,首先要将删除的表设置为禁用状态才可以删除,否则会报错
drop 'bigdata:student'
新增列族
alter 'bigdata:student','teacherinfo'
删除列族
alter 'bigdata:student',{NAME=>'teacherinfo',METHOD=>'delete'}
更改列族存储版本的限制
alter 'bigdata:student',{NAME=>'baseinfo',VERSIONS=>3}
增加数据
put 'bigdata:student','rowkey1','baseinfo:name','tom'
put 'bigdata:student','rowkey1','baseinfo:birthday','1999-01-01'
put 'bigdata:student','rowkey1','baseinfo:age','24'
put 'bigdata:student','rowkey1','schoolinfo:name','bdqn'
put 'bigdata:student','rowkey1','schoolinfo:address','jsxueyuan'
根据条件查询
get 'bigdata:student','rowkey1'
get 'bigdata:student','rowkey2','baseinfo'
get 'bigdata:student','rowkey2','schoolinfo'
get 'bigdata:student','rowkey2','baseinfo:name'
get 'bigdata:student','rowkey3',{COLUMN=>'baseinfo:name'}
查看指定列中不同版本的数据
get 'bigdata:student','rowkey2',{COLUMN=>'baseinfo:name','VERSIONS'=>3}
删除指定列族下的指定列
delete 'bigdata:student','rowkey3','baseinfo:age'
删除指定行
deleteall 'bigdata:student','rowkey3'
全表扫描
scan 'bigdata:student'
全表扫描指定列族
scan 'bigdata:student', COLUMN=>'baseinfo'、
全表扫描指定列族指定列
scan 'bigdata:student', COLUMN=>'baseinfo:birthday'
扫描指定起始行至结束行(左闭右开)
- scan 'bigdata:student',{COLUMNS=>'baseinfo:name', STARTROW=>'rowkey1', STOPROW=>'rowkey4'}
- scan 'bigdata:student',{COLUMNS=>'baseinfo:name', STARTROW=>'rowkey1', STOPROW=>'rowkey4', LIMIT=>3}
- scan 'bigdata:student',{COLUMNS=>'baseinfo:name', STARTROW=>'rowkey1', STOPROW=>'rowkey4', LIMIT=>3,VERSIONS=>3}
按内容查找,value值包含有(字符串用substring,数字用binary)
scan 'bigdata:student',FILTER=>"ValueFilter(=,'substring:bdqn')"
scan 'bigdata:student',FILTER=>"ValueFilter(=,'binary:24')"
按内容查找,列以什么开头的
scan 'bigdata:student',FILTER=>"ColumnPrefixFilter('birth')"
按内容查找,列以什么开头的 且 value值含有
scan 'bigdata:student', FILTER=>"ColumnPrefixFilter('birth') AND ValueFilter(=,'substring:2022')"