使用 webhdfs 的 GETFACL 中未显示掩码值

Mask value not shown in GETFACL using webhdfs

在 Hadoop 中,我启用了授权。我为一个目录设置了几个acl。

当我在 hadoop bin 中执行 getfacl 命令时,我可以看到其中的掩码值。

hadoop fs -getfacl /Kumar

# file: /Kumar
# owner: Kumar
# group: Hadoop
user::rwx
user:Babu:rwx
group::r-x
mask::rwx
other::r-x

如果我 运行 使用 webhdfs 的相同命令,掩码值不会显示。

http://localhost:50070/webhdfs/v1/Kumar?op=GETACLSTATUS

{
  "AclStatus": {
    "entries": [
      "user:Babu:rwx",
      "group::r-x"
    ],
    "group": "Hadoop",
    "owner": "Kumar",
    "permission": "775",
    "stickyBit": false
  }
}

webhdfs 中 GETFACL 命令不显示掩码值的原因是什么。

帮我想想办法。

HDFS 实现了 POSIX ACL 模型。链接文档解释说,掩码条目保留在经典 POSIX 权限模型的组权限位中。这样做是为了支持 POSIX ACL 的要求,并且还支持与 chmod 等现有工具的向后兼容性,这些工具不知道扩展的 ACL 条目。引用该文件:

In minimal ACLs, the group class permissions are identical to the owning group permissions. In extended ACLs, the group class may contain entries for additional users or groups. This results in a problem: some of these additional entries may contain permissions that are not contained in the owning group entry, so the owning group entry permissions may differ from the group class permissions.

This problem is solved by the virtue of the mask entry. With minimal ACLs, the group class permissions map to the owning group entry permissions. With extended ACLs, the group class permissions map to the mask entry permissions, whereas the owning group entry still defines the owning group permissions.

...

When an application changes any of the owner, group, or other class permissions (e.g., via the chmod command), the corresponding ACL entry changes as well. Likewise, when an application changes the permissions of an ACL entry that maps to one of the user classes, the permissions of the class change.

这与您的问题相关,因为这意味着掩码实际上并未作为扩展 ACL 条目保留。相反,它位于权限位中。查询 WebHDFS 时,您进行了 "raw" API 调用以检索有关 ACL 的信息。当 运行 宁 getfacl 时,您 运行 一个应用程序在 API 调用之上添加了额外的显示逻辑。 getfacl 知道对于具有 ACL 的文件,组权限位被解释为掩码,因此它会相应地显示。

这不是 WebHDFS 特有的。如果应用程序要通过 NameNode 的 RPC 协议调用 getAclStatus,那么它会看到与 WebHDFS 响应等效的内容。此外,如果您要在 webhdfs:// URI 上使用 getfacl 命令,则该命令仍会显示掩码,因为应用程序知道应用该逻辑,而不管文件系统实现如何。