1. 启动Hbase

  1. hbase shell

2. 查看表若干行

  1. scan \'表名\',{LIMIT => 10}

3. 查看表的某列的若干行

  1. scan \'表名\',{COLUMN=>\'列族:列名\', LIMIT => 10}

 

4. 指定范围查询表并结合shell处理并导出数据

  1. echo "scan \'hb_test\',{STARTROW => \'79839078\', STOPROW=>\'798390788\', COLUMNS => \'index:updated_at\'}" | ./hbase shell | grep value > myText.txt //指定范围scan并导出数据到文件
  2. cat myText.txt | awk -F_ \'{print $3}\' | awk -F\ \'{print $1}\' | sort -u > retText.txt //选择列,排序并去重
  3. cat retText.txt | tr -s "\n" "," > text.txt //多行合成一行

5. 创建表

  1. # 例如:创建表t1,有两个family name:f1,f2,且版本数均为1
  2. hbase(main)> create \'t1\',{NAME => \'f1\', VERSIONS => 1},{NAME => \'f2\', VERSIONS => 1}

版权声明:本文为lasclocker原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://www.cnblogs.com/lasclocker/p/5687612.html