//删除表
disable 'BOOKFANSSCOREDETAIL'
drop 'BOOKFANSSCOREDETAIL'
disable 'BOOKFANSSCORETOTAL'
drop 'BOOKFANSSCORETOTAL'
disable 'BOOKVICEADMIN'
drop 'BOOKVICEADMIN'
disable 'USERFANSSCOREDETAIL'
drop 'USERFANSSCOREDETAIL'
disable 'USERFANSSCORETOTAL'
drop 'USERFANSSCORETOTAL'
disable 'BOOKFANSRANKING'
drop 'BOOKFANSRANKING'
disable 'USERFANSRANKING'
drop 'USERFANSRANKING'
//建表
create 'BOOKFANSSCOREDETAIL','D';
create 'BOOKFANSSCORETOTAL','D';
create 'BOOKVICEADMIN','D';
create 'USERFANSSCOREDETAIL','D';
create 'USERFANSSCORETOTAL','D';
create 'BOOKFANSRANKING','D';
create 'USERFANSRANKING','D'
//建表,表名称:T_DSP_LOOKUP_TEST,列族:head
create 'T_DSP_LOOKUP_TEST','head'
//添加一条数据,row key(主建)为:0000,,列(字段)分别为:head:spid,head:dsid,head:name,对应的值(value)分别为:Ap001,20,xiaoxiao
put 'T_DSP_LOOKUP_TEST','0000','head:spid','Ap001'
put 'T_DSP_LOOKUP_TEST','0000','head:dsid','20'
put 'T_DSP_LOOKUP_TEST','0000','head:name','xiaoxiao'
put 'T_DSP_LOOKUP_TEST','1111','head:spid','Ap002'
put 'T_DSP_LOOKUP_TEST','1111','head:dsid','50'
put 'T_DSP_LOOKUP_TEST','1111','head:name','xiaohe'
//修改和添加一样
//删除一列,相当于删除一个字段 ,删除T_DSP_LOOKUP_TEST中row key (主键)为1111,列(字段)head:spid
delete 'T_DSP_LOOKUP_TEST','1111','head:spid'
//删除一条数据,
deleteall 'T_DSP_LOOKUP_TEST','1111'
//查询,只有部分
//相当于 select * from T_DSP_LOOKUP_TEST
scan 'T_DSP_LOOKUP_TEST'
//相当于 select dsid,pid from T_DSP_LOOKUP_TEST
scan 'T_DSP_LOOKUP_TEST',{COLUMNS => ['head:dsid','head:pid']}
//相当于 select dsid from T_DSP_LOOKUP_TEST
scan 'T_DSP_LOOKUP_TEST',{COLUMNS => 'head:dsid'}
//get 是按row key(主键)查询
//相当于 select * from T_DSP_LOOKUP_TEST where id = 'PhoneNumberQuery'
get 'T_DSP_LOOKUP_TEST','PhoneNumberQuery'
//相当于 select dsid from T_DSP_LOOKUP_TEST where id = 'PhoneNumberQuery'
get 'T_DSP_LOOKUP_TEST','PhoneNumberQuery',{COLUMNS => 'head:dsid'}
//相当于 select dsidpid, from T_DSP_LOOKUP_TEST where id = 'PhoneNumberQuery'
get 'T_DSP_LOOKUP_TEST','PhoneNumberQuery',{COLUMNS => ['head:dsid','head:pid']}
get 'T_DSP_LOOKUP_TEST','PhoneNumberQuery','head:dsid'
get 'T_DSP_LOOKUP_TEST','PhoneNumberQuery','head:dsid','head:pid'
get 'T_DSP_LOOKUP_TEST','PhoneNumberQuery',['head:dsid','head:pid']
get 'test','row1',{COLUMN=>'f1:grade',VERSIONS=>2} 查看一个CELL中的多条记录(HBase在同一个单元格中可以存放多条记录,默认情况下去最近一次修改的记录)
//清空表T_DSP_LOOKUP_TEST
truncate 'T_DSP_LOOKUP_TEST'
//查看表T_DSP_LOOKUP_TEST
describe 'T_DSP_LOOKUP_TEST'
disable 'BOOKFANSSCOREDETAIL'
drop 'BOOKFANSSCOREDETAIL'
disable 'BOOKFANSSCORETOTAL'
drop 'BOOKFANSSCORETOTAL'
disable 'BOOKVICEADMIN'
drop 'BOOKVICEADMIN'
disable 'USERFANSSCOREDETAIL'
drop 'USERFANSSCOREDETAIL'
disable 'USERFANSSCORETOTAL'
drop 'USERFANSSCORETOTAL'
disable 'BOOKFANSRANKING'
drop 'BOOKFANSRANKING'
disable 'USERFANSRANKING'
drop 'USERFANSRANKING'
//建表
create 'BOOKFANSSCOREDETAIL','D';
create 'BOOKFANSSCORETOTAL','D';
create 'BOOKVICEADMIN','D';
create 'USERFANSSCOREDETAIL','D';
create 'USERFANSSCORETOTAL','D';
create 'BOOKFANSRANKING','D';
create 'USERFANSRANKING','D'
//建表,表名称:T_DSP_LOOKUP_TEST,列族:head
create 'T_DSP_LOOKUP_TEST','head'
//添加一条数据,row key(主建)为:0000,,列(字段)分别为:head:spid,head:dsid,head:name,对应的值(value)分别为:Ap001,20,xiaoxiao
put 'T_DSP_LOOKUP_TEST','0000','head:spid','Ap001'
put 'T_DSP_LOOKUP_TEST','0000','head:dsid','20'
put 'T_DSP_LOOKUP_TEST','0000','head:name','xiaoxiao'
put 'T_DSP_LOOKUP_TEST','1111','head:spid','Ap002'
put 'T_DSP_LOOKUP_TEST','1111','head:dsid','50'
put 'T_DSP_LOOKUP_TEST','1111','head:name','xiaohe'
//修改和添加一样
//删除一列,相当于删除一个字段 ,删除T_DSP_LOOKUP_TEST中row key (主键)为1111,列(字段)head:spid
delete 'T_DSP_LOOKUP_TEST','1111','head:spid'
//删除一条数据,
deleteall 'T_DSP_LOOKUP_TEST','1111'
//查询,只有部分
//相当于 select * from T_DSP_LOOKUP_TEST
scan 'T_DSP_LOOKUP_TEST'
//相当于 select dsid,pid from T_DSP_LOOKUP_TEST
scan 'T_DSP_LOOKUP_TEST',{COLUMNS => ['head:dsid','head:pid']}
//相当于 select dsid from T_DSP_LOOKUP_TEST
scan 'T_DSP_LOOKUP_TEST',{COLUMNS => 'head:dsid'}
//get 是按row key(主键)查询
//相当于 select * from T_DSP_LOOKUP_TEST where id = 'PhoneNumberQuery'
get 'T_DSP_LOOKUP_TEST','PhoneNumberQuery'
//相当于 select dsid from T_DSP_LOOKUP_TEST where id = 'PhoneNumberQuery'
get 'T_DSP_LOOKUP_TEST','PhoneNumberQuery',{COLUMNS => 'head:dsid'}
//相当于 select dsidpid, from T_DSP_LOOKUP_TEST where id = 'PhoneNumberQuery'
get 'T_DSP_LOOKUP_TEST','PhoneNumberQuery',{COLUMNS => ['head:dsid','head:pid']}
get 'T_DSP_LOOKUP_TEST','PhoneNumberQuery','head:dsid'
get 'T_DSP_LOOKUP_TEST','PhoneNumberQuery','head:dsid','head:pid'
get 'T_DSP_LOOKUP_TEST','PhoneNumberQuery',['head:dsid','head:pid']
get 'test','row1',{COLUMN=>'f1:grade',VERSIONS=>2} 查看一个CELL中的多条记录(HBase在同一个单元格中可以存放多条记录,默认情况下去最近一次修改的记录)
//清空表T_DSP_LOOKUP_TEST
truncate 'T_DSP_LOOKUP_TEST'
//查看表T_DSP_LOOKUP_TEST
describe 'T_DSP_LOOKUP_TEST'