grant

Definition

Grants a user or a group of users the specific rights.

IMPORTANT

Notice, that this command can be executed only by users with ADMIN rights. So, run it under superuser hbase or grant the appropriate rights to your user:

sudo -u hbase hbase shell
grant '<user_name>', 'A'

Usage

grant '<user_name>' | '@<group_name>',
      '<permissions>' [,
      '@<namespace_name>'] | [, '[<namespace_name>:]<table_name>' [, '<column_family>' [, '<column_qualifier>']]]
Arguments
Parameter Description

user_name

A user name

group_name

A users group name

permissions

Either zero or more letters from the set RWXCA, where R means READ, W — WRITE, X — EXEC, C — CREATE, A — ADMIN. Examples: RW, RWX, RWXCA, etc.

namespace_name

A namespace name

table_name

A table name

column_family

A column family name

column_qualifier

A column qualifier

NOTE
A namespace and a group name should be preceded with @ character.

Examples

Granting without using namespaces and table names

hbase(main):003:0> grant 'dasha', 'RWXCA'
Took 0.2991 seconds

Granting rights on the specified namespace

hbase(main):004:0> grant 'dasha', 'RWXCA', '@ns1'
Took 0.0422 seconds
hbase(main):010:0> user_permission '@ns1'
User                     Namespace,Table,Family,Qualifier:Permission
 dasha                   ns1,,,: [Permission: actions=READ,WRITE,EXEC,CREATE,ADMIN]
1 row(s)
Took 0.0419 seconds

Granting rights on the specified table column

hbase(main):009:0> grant 'dasha', 'RW', 'ns1:temp2', 'cf1', 'c1'
Took 0.0795 seconds
hbase(main):011:0> user_permission 'ns1:temp2'
User                     Namespace,Table,Family,Qualifier:Permission
 dasha                   ns1,ns1:temp2,,: [Permission: actions=READ,WRITE,EXEC,CREATE,ADMIN]
 dasha                   ns1,ns1:temp2,cf1,c1: [Permission: actions=READ,WRITE]
2 row(s)
Took 0.0315 seconds
Found a mistake? Seleсt text and press Ctrl+Enter to report it