您当前的位置: 首页 >  宝哥大数据 hbase

HBase基本命令

宝哥大数据 发布时间:2016-11-21 15:14:49 ,浏览量:5

创建表
   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'))"}
关注
打赏
查看更多评论

宝哥大数据

暂无认证

  • 5浏览

    0关注

    985博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文
立即登录/注册

微信扫码登录