方案:尝试在 Azure HDInsight 中创建 Apache Hive 表时出现“权限被拒绝”错误Scenario: Permission denied error when trying to create an Apache Hive table in Azure HDInsight

本文介绍在 Azure HDInsight 群集中使用交互式查询组件时出现的问题的故障排除步骤和可能的解决方案。This article describes troubleshooting steps and possible resolutions for issues when using Interactive Query components in Azure HDInsight clusters.

问题Issue

尝试创建表时,将看到以下错误:You will see the following error when attempting to create a table:

java.sql.SQLException: Error while compiling statement: FAILED: HiveAccessControlException Permission denied: user [hdiuser] does not have [ALL] privilege on [wasbs://data@xxxxx.blob.core.chinacloudapi.cn/path/table]

如果运行以下 HDFS 存储命令,将看到类似的错误消息:You will see a similar error message if you run the following HDFS storage command:

hdfs dfs -mkdir wasbs://data@xxxxx.blob.core.chinacloudapi.cn/path/table

原因Cause

是否能够在 Apache Hive 中创建表由应用于群集的存储帐户的权限决定。The ability to create a table in Apache Hive is decided by the permissions applied to the cluster’s storage account. 如果群集存储帐户权限不正确,则将无法创建表。If the cluster storage account permissions are incorrect, you will not be able to create tables. 这意味着你可能为表创建设置了正确的 Ranger 策略,但仍会看到“权限被拒绝”错误。This means that you could have the correct Ranger policies for table creation, and still see "Permission Denied" errors.

解决方法Resolution

这是由于对所使用的存储容器缺乏足够的权限造成的。This is caused by a lack of sufficient permissions on the storage container being used. 创建 Hive 表的用户需要对容器具有“读取”、“写入”和“执行”权限。The user creating the Hive table needs read, write, and execute permissions against the container. 有关详细信息,请参阅在 HDP 2.2 中使用 Apache Ranger 进行 Hive 授权的最佳做法For more information, please see Best Practices for Hive Authorization Using Apache Ranger in HDP 2.2.

后续步骤Next steps

如果你的问题未在本文中列出,或者无法解决问题,请访问以下渠道获取更多支持:If you didn't see your problem or are unable to solve your issue, visit the following channel for more support:

  • 如果需要更多帮助,可以从 Azure 门户提交支持请求。If you need more help, you can submit a support request from the Azure portal. 从菜单栏中选择“支持” ,或打开“帮助 + 支持” 中心。Select Support from the menu bar or open the Help + support hub.