hiveserver2-执行所有带有“hive”用户bug的查询?

mctunoxg  于 2021-06-02  发布在  Hadoop
关注(0)|答案(1)|浏览(297)

我在hdfs中创建了一个目录:

/user/root/data/gs_landing/cdctest_gs

具有drwxr-xr-x权限
我正试图通过java使用以下查询创建具有上述位置的外部表:

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”用户身份连接到hive,尽管我已经使用“root”显式连接。这是hiveserver2的biug,还是我没有配置某些属性?
请随时要求任何进一步的投入。任何帮助都将不胜感激。
致以最诚挚的问候。

8yoxcaq7

8yoxcaq71#

通过将hive-site.xml中的这两个属性添加为true,问题得以解决:

hive.metastore.execute.setugi
hive.server2.enable.doAs

更多信息请参见:
http://doc.mapr.com/display/mapr40x/using+hiveserver2#usinghiveserver2-为HiveServer 2启用SSLF

相关问题