Hbase-10-权限管理

授权范围:

名称 描述
Superuser 超级账号可以进行任何操作,运行HBase服务的账号默认是 Superuser。也可以通过在hbase-site.xml中配置hbase.superuser的值可以添加超级账号。
Global Global Scope拥有集群所有table的Admin权限。
Namespace 在Namespace Scope进行相关权限控制。
Table 在Table Scope进行相关权限控制。
ColumnFamily 在ColumnFamily Scope进行相关权限控制。
Cell 在Cell Scope进行相关权限控制。

Grant 授权

Grant users specific rights.
Syntax: grant <user or @group>, <permissions> [, <table> [, <column family> [, <column qualifier>]]]
Syntax: grant <user or @group>, <permissions>, <@namespace>

permissions is either zero or more letters from the set "RWXCA".
READ('R'), WRITE('W'), EXEC('X'), CREATE('C'), ADMIN('A')

Note: Groups and users are granted access in the same way, but groups are prefixed with an '@'
      character. Tables and namespaces are specified the same way, but namespaces are
      prefixed with an '@' character.

For example:

    hbase> grant 'bobsmith', 'RWXCA'
    hbase> grant '@admins', 'RWXCA'
    hbase> grant 'bobsmith', 'RWXCA', '@ns1'
    hbase> grant 'bobsmith', 'RW', 't1', 'f1', 'col1'
    hbase> grant 'bobsmith', 'RW', 'ns1:t1', 'f1', 'col1'

我们可以从RWXCA组,其中给予零个或多个特权给用户

  • R - 代表读取权限
  • W - 代表写权限
  • X - 代表执行权限
  • C - 代表创建权限
  • A - 代表管理权限

revoke 删除权限

revoke命令用于撤销用户访问表的权限。它的语法如下:

hbase:002:0> help "revoke"
Revoke a user's access rights.
Syntax: revoke <user or @group> [, <table> [, <column family> [, <column qualifier>]]]
Syntax: revoke <user or @group>, <@namespace>

Note: Groups and users access are revoked in the same way, but groups are prefixed with an '@'
      character. Tables and namespaces are specified the same way, but namespaces are
      prefixed with an '@' character.

For example:

    hbase> revoke 'bobsmith'
    hbase> revoke '@admins'
    hbase> revoke 'bobsmith', '@ns1'
    hbase> revoke 'bobsmith', 't1', 'f1', 'col1'
    hbase> revoke 'bobsmith', 'ns1:t1', 'f1', 'col1'

user_permission 查询权限

hbase:001:0> help "user_permission"
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 '@.*'
    hbase> user_permission '@^[a-c].*'
    hbase> user_permission 'table1'
    hbase> user_permission 'namespace1:table1'
    hbase> user_permission '.*'
    hbase> user_permission '^[A-C].*'
不要小瞧女程序员
原文地址:https://www.cnblogs.com/shix0909/p/15049616.html