hbase 的操作

举报
tscswcn 发表于 2018/12/25 22:14:24 2018/12/25
【摘要】 create 'User111','info' put 'User111', 'row1', 'info:name', 'xiaoming' put 'User111', 'row5', 'info:name3', 'xiaoming233' get 'User111', 'row3' get 'User111', 'row2' scan 'User111', {LIMIT => 2} c...

create 'User111','info'

 

 

put 'User111', 'row1', 'info:name', 'xiaoming'

 

put 'User111', 'row5', 'info:name3', 'xiaoming233'

 

get 'User111', 'row3'

 

get 'User111', 'row2'

 

scan 'User111', {LIMIT => 2}

 

count 'User111'

 

deleteall 'User111', 'row2'

 

 

base(main):001:0> user_permission

User                                         Namespace,Table,Family,Qualifier:Permission                                                                                      

 

ERROR: DISABLED: Security features are not available

 

Here is some help for this command:

Show all permissions for the particular user.

Syntax : user_permission <table>

 

Note: A namespace must always precede with '@' character.

 

For example:

 

    hbase> user_permission

    hbase> user_permission '@ns1'

    hbase> user_permission 'table1'

    hbase> user_permission 'namespace1:table1'

    hbase> user_permission '.*'

    hbase> user_permission '^[A-C].*'

 

 

hbase(main):002:0> user_permission '.*'

User                                         Namespace,Table,Family,Qualifier:Permission                                                                                      

 

ERROR: DISABLED: Security features are not available

 

Here is some help for this command:

Show all permissions for the particular user.

Syntax : user_permission <table>

 

Note: A namespace must always precede with '@' character.

 

For example:

 

    hbase> user_permission

    hbase> user_permission '@ns1'

    hbase> user_permission 'table1'

    hbase> user_permission 'namespace1:table1'

    hbase> user_permission '.*'

    hbase> user_permission '^[A-C].*'

 

 

hbase(main):003:0> get 'User111', 'row2'

COLUMN                                       CELL                                                                                                                             

 info:name2                                  timestamp=1530185309654, value=xiaoming23                                                                                        

1 row(s) in 0.0500 seconds

 

hbase(main):004:0> get 'User111', 'row3'

COLUMN                                       CELL                                                                                                                             

0 row(s) in 0.0080 seconds

 

hbase(main):005:0> put 'User111', 'row5', 'info:name3', 'xiaoming233'

0 row(s) in 0.0700 seconds

 

hbase(main):006:0> get 'User111', 'row3'

COLUMN                                       CELL                                                                                                                             

0 row(s) in 0.0080 seconds

 

hbase(main):007:0> get 'User111', 'row2'

COLUMN                                       CELL                                                                                                                             

 info:name2                                  timestamp=1530185309654, value=xiaoming23                                                                                        

1 row(s) in 0.0090 seconds

 

hbase(main):008:0> scan 'User111', {LIMIT => 2}

ROW                                          COLUMN+CELL                                                                                                                      

 row1                                        column=info:name, timestamp=1530185082846, value=xiaoming                                                                        

 row2                                        column=info:name2, timestamp=1530185309654, value=xiaoming23                                                                     

2 row(s) in 0.0190 seconds

 

hbase(main):009:0> count 'User111'

3 row(s) in 0.0430 seconds

 

=> 3

hbase(main):010:0> deleteall 'User111', 'row2'

0 row(s) in 0.0670 seconds

 

hbase(main):011:0> scan 'User111', {LIMIT => 2}

ROW                                          COLUMN+CELL                                                                                                                      

 row1                                        column=info:name, timestamp=1530185082846, value=xiaoming                                                                        

 row5                                        column=info:name3, timestamp=1530185833273, value=xiaoming233                                                                    

2 row(s) in 0.0130 seconds

 

hbase(main):012:0> disbale

NameError: undefined local variable or method `d' for #<Object:0x5db948c9>

 

hbase(main):013:0> disbale

NameError: undefined local variable or method `disbale' for #<Object:0x5db948c9>

 

hbase(main):014:0> disable 'User111'

0 row(s) in 2.5060 seconds

 

hbase(main):015:0> count 'User111'

 

ERROR: User111 is disabled.

 

Here is some help for this command:

Count the number of rows in a table.  Return value is the number of rows.

This operation may take a LONG time (Run '$HADOOP_HOME/bin/hadoop jar

hbase.jar rowcount' to run a counting mapreduce job). Current count is shown

every 1000 rows by default. Count interval may be optionally specified. Scan

caching is enabled on count scans by default. Default cache size is 10 rows.

If your rows are small in size, you may want to increase this

parameter. Examples:

 

 hbase> count 'ns1:t1'

 hbase> count 't1'

 hbase> count 't1', INTERVAL => 100000

 hbase> count 't1', CACHE => 1000

 hbase> count 't1', INTERVAL => 10, CACHE => 1000

 

The same commands also can be run on a table reference. Suppose you had a reference

t to table 't1', the corresponding commands would be:

 

 hbase> t.count

 hbase> t.count INTERVAL => 100000

 hbase> t.count CACHE => 1000

 hbase> t.count INTERVAL => 10, CACHE => 1000

 

 

hbase(main):016:0> enable 'User111'

0 row(s) in 2.3520 seconds

 

hbase(main):017:0> count 'User111'

2 row(s) in 0.0120 seconds

 

=> 2

hbase(main):018:0>


【版权声明】本文为华为云社区用户原创内容,转载时必须标注文章的来源(华为云社区)、文章链接、文章作者等基本信息, 否则作者和本社区有权追究责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@huaweicloud.com
  • 点赞
  • 收藏
  • 关注作者

评论(0

0/1000
抱歉,系统识别当前为高风险访问,暂不支持该操作

全部回复

上滑加载中

设置昵称

在此一键设置昵称,即可参与社区互动!

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。