HiveServer2 - 使用 "hive" 用户执行所有查询 - 错误?
HiveServer2 - Executes all queries with "hive" user - Bug?
我在 hdfs 中创建了一个目录:
/user/root/data/gs_landing/cdctest_gs
具有权限 drwxr-xr-x
我正在尝试通过 java:
使用以下查询创建具有上述位置的外部 table
stmt.execute("create external table cdctest_gs(\n" +
" data string\n" +
" )\n" +
"location '/user/root/data/gs_landing/cdctest_gs'");
在执行上述查询之前,我已经在以下代码中创建了连接和语句:
Connection con = DriverManager.getConnection("jdbc:hive2://localhost:10000", "root", "");
Statement stmt = con.createStatement();
现在虽然我是以root用户创建连接,但执行后出现以下错误:
Exception in thread "main" java.sql.SQLException: Error while processing statement: FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. MetaException(message:java.security.AccessControlException: Permission denied: user=hive, access=WRITE, inode="/user/root/data/gs_landing/cdctest_gs":root:hdfs:drwxr-xr-x
我很困惑,为什么 HiveServer2 试图以 'hive' 用户身份连接到配置单元,即使我已使用 'root' 明确连接。这是 hiveserver2 的错误还是有一些 属性 我错过了配置?
请随时询问任何进一步的意见。任何帮助将不胜感激。
此致。
通过将 hive-site.xml 中的这两个属性添加为 true 解决了这个问题:
hive.metastore.execute.setugi
hive.server2.enable.doAs
更多信息在这里:
http://doc.mapr.com/display/MapR40x/Using+HiveServer2#UsingHiveServer2-EnablingSSLforHiveServer2
我在 hdfs 中创建了一个目录:
/user/root/data/gs_landing/cdctest_gs
具有权限 drwxr-xr-x
我正在尝试通过 java:
使用以下查询创建具有上述位置的外部 tablestmt.execute("create external table cdctest_gs(\n" +
" data string\n" +
" )\n" +
"location '/user/root/data/gs_landing/cdctest_gs'");
在执行上述查询之前,我已经在以下代码中创建了连接和语句:
Connection con = DriverManager.getConnection("jdbc:hive2://localhost:10000", "root", "");
Statement stmt = con.createStatement();
现在虽然我是以root用户创建连接,但执行后出现以下错误:
Exception in thread "main" java.sql.SQLException: Error while processing statement: FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. MetaException(message:java.security.AccessControlException: Permission denied: user=hive, access=WRITE, inode="/user/root/data/gs_landing/cdctest_gs":root:hdfs:drwxr-xr-x
我很困惑,为什么 HiveServer2 试图以 'hive' 用户身份连接到配置单元,即使我已使用 'root' 明确连接。这是 hiveserver2 的错误还是有一些 属性 我错过了配置?
请随时询问任何进一步的意见。任何帮助将不胜感激。
此致。
通过将 hive-site.xml 中的这两个属性添加为 true 解决了这个问题:
hive.metastore.execute.setugi
hive.server2.enable.doAs
更多信息在这里:
http://doc.mapr.com/display/MapR40x/Using+HiveServer2#UsingHiveServer2-EnablingSSLforHiveServer2