HBase基本命令

创建表
   create ‘TableName’, ‘ColumnFamily’
   e.g: create ‘testTable’, ‘message’
查询表结构:
   desc ‘TableName’
   eg: desc ‘testTable’
查看当先HBase中具有哪些表
   list
插入数据
   格式:put ‘TableName’, ‘RowKey’, ‘columnFamily’
   eg:
   put ‘testTable’, ‘1’, ‘message:info’ , ‘hello Hbase’
   put ‘testTable’, ‘1’, ‘message:msg’ , ‘Hello Hadoop’
   put ‘testTable’, ‘2’, ‘message:info’, ‘a’
   put ‘testTable’, ‘2’, ‘message:msg’, ‘b’
   put ‘testTable’, ‘2’, ‘message:info’, ‘c’
   put ‘testTable’, ‘2’, ‘message:info1’, ‘info’

删除表:
首先禁止表, 再删除
   disable ‘tableName’
   drop ‘tableName’
查询表中数据
   scan ‘TableName’
通过rowKey 获取指定行
   get ‘tableName’, ‘rowKey’

scan 'chb_20181016', { LIMIT => 10}

scan 'chb_20181016', { LIMIT => 30, STARTROW=>'1010A2.B1.B2-20100001_2108_117.131.19.173_' , STOPROW=>'1010A2.B1.B2-20100001_2108_117.131.19.173_a'}

filter, substring子串匹配
scan 'chb_20181016', { LIMIT => 30, STARTROW=>'1010A2.B1.B2-20100001_2108_117.131.19.173_' , STOPROW=>'1010A2.B1.B2-20100001_2108_117.131.19.173_a', 
FILTER => " (SingleColumnValueFilter ('cf1', 'data', =, 'substring:,b183.240.203.66')) and (SingleColumnValueFilter ('cf1', 'data', =, 'substring:,e1'))"}
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值