0

我想访问与 Hbase 表同步的 phoenix 表。我编写了一些 jdbc 代码来访问 Phoenix 表中的数据,但是由于启用了游侠策略,我得到了拒绝访问异常。

Class.forName("org.apache.phoenix.jdbc.PhoenixDriver");
Connection conn = DriverManager.getConnection(
                "jdbc:phoenix:abc1,abc2,abc3:2181:/hbase-unsecure","landing", "password");
System.out.println("Got connection !!!");
ResultSet rst = conn.createStatement().executeQuery("select * from EMP");

我收到错误消息:

org.apache.hadoop.hbase.security.AccessDeniedException: org.apache.hadoop.hbase.security.AccessDeniedException: Insufficient permissions for user ‘saurav_bilung',action: scannerOpen, tableName:SYSTEM.STATS, family:0, column: GUIDE_POSTS_ROW_COUNT
    at org.apache.ranger.authorization.hbase.RangerAuthorizationCoprocessor.authorizeAccess(RangerAuthorizationCoprocessor.java:521)
    at org.apache.ranger.authorization.hbase.RangerAuthorizationCoprocessor.preScannerOpen(RangerAuthorizationCoprocessor.java:911)
    at org.apache.ranger.authorization.hbase.RangerAuthorizationCoprocessor.preScannerOpen(RangerAuthorizationCoprocessor.java:855)
    at org.apache.hadoop.hbase.regionserver.RegionCoprocessorHost$50.call(RegionCoprocessorHost.java:1267)
    at org.apache.hadoop.hbase.regionserver.RegionCoprocessorHost$RegionOperation.call(RegionCoprocessorHost.java:1660)
    at org.apache.hadoop.hbase.regionserver.RegionCoprocessorHost.execOperation(RegionCoprocessorHost.java:1734)
    at org.apache.hadoop.hbase.regionserver.RegionCoprocessorHost.execOperationWithResult(RegionCoprocessorHost.java:1709)
    at org.apache.hadoop.hbase.regionserver.RegionCoprocessorHost.preScannerOpen(RegionCoprocessorHost.java:1262)
    at org.apache.hadoop.hbase.regionserver.RSRpcServices.scan(RSRpcServices.java:2352)
    at org.apache.hadoop.hbase.protobuf.generated.ClientProtos$ClientService$2.callBlockingMethod(ClientProtos.java:32385)
    at org.apache.hadoop.hbase.ipc.RpcServer.call(RpcServer.java:2141)
    at org.apache.hadoop.hbase.ipc.CallRunner.run(CallRunner.java:112)
    at org.apache.hadoop.hbase.ipc.RpcExecutor$Handler.run(RpcExecutor.java:187)
    at org.apache.hadoop.hbase.ipc.RpcExecutor$Handler.run(RpcExecutor.java:167)

“登陆”用户已被授予通过游侠执行所有任务的权限,但我仍然收到“权限不足”的错误消息。我想以“登陆”用户的身份创建连接。在这里需要帮助

4

1 回答 1

0

根据您的错误消息,它似乎正在尝试为您的用户“saurav_bilung”而不是“登陆”用户进行身份验证。当您提交或运行您的代码时,您是作为“登陆”用户使用 sudo 吗?此外,请确保您的用户和“登陆”有权访问 SYSTEM.STATS 表。让我知道情况如何

于 2019-11-25T04:02:18.570 回答