HDFS 中 Hive 代理用户的最佳解决方案是什么?
What's the best solution for Hive proxy user in HDFS?
我对 HDFS 和 Hive 中的代理用户设置感到非常困惑。我在 hive-site.xml
中启用了 doAs 选项
<property>
<name>hive.server2.enable.doAs</name>
<value>true</value>
</property>
和核心中的代理用户-site.xml
<property>
<name>hadoop.proxyuser.hdfs.hosts</name>
<value>*</value>
</property>
<property>
<name>hadoop.proxyuser.hdfs.groups</name>
<value>*</value>
</property>
但这会导致:
2017-03-29 16:24:59,022 INFO org.apache.hadoop.ipc.Server: Connection from 172.16.0.239:60920 for protocol org.apache.hadoop.hdfs.protocol.ClientProtocol is unauthorized for user hive (auth:PROXY) via hive (auth:SIMPLE)
2017-03-29 16:24:59,023 INFO org.apache.hadoop.ipc.Server: Socket Reader #1 for port 9000: readAndProcess from client 172.16.0.239 threw exception [org.apache.hadoop.security.authorize.AuthorizationException: User: hive is not allowed to impersonate hive]
我没有像大多数示例那样将 proxyuser 设置为 "hive" 是因为 core-site.xml 被其他服务共享,我不喜欢每个服务访问 HDFS 作为配置单元,但我仍然试一试,现在 core-site.xml 看起来像:
<property>
<name>hadoop.proxyuser.hive.hosts</name>
<value>*</value>
</property>
<property>
<name>hadoop.proxyuser.hive.groups</name>
<value>*</value>
</property>
我又吃了一次beeline,不过,这次登录没问题,但是当一个命令是运行,纱线抛出异常:
Error: Error while processing statement: FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.mr.MapRedTask. Permission denied: user=hive, access=WRITE, inode="/user/yarn/hive/.staging":hdfs:supergroup:drwxr-xr-x
proxyuser "hive" 已被 "hdfs" 拥有的暂存文件夹拒绝。我不认为将 777 提供给暂存文件夹是一个好主意,因为给予 HDFS 保护但向所有人打开该文件夹是没有意义的。所以我的问题是在 Hive、Hdfs 和 Yarn 之间设置权限的最佳解决方案是什么?
Hadoop权限对我来说简直是一场噩梦,请帮忙。
在 core-site.xml
中添加代理用户条目将允许名为 hive
的超级用户从任何主机连接(值为 *
)以模拟属于任何组的用户(值为是 *
)。
<property>
<name>hadoop.proxyuser.hive.hosts</name>
<value>*</value>
</property>
<property>
<name>hadoop.proxyuser.hive.groups</name>
<value>*</value>
</property>
这可以通过传递实际的主机名和组名来增加限制(参考 Superusers)。超级用户 hive
对 FS 的访问权限将适用于模拟用户。
对于多用户 Hadoop 环境,最佳做法是为每个超级用户创建专用目录,并配置相关服务以在其中存储文件。并为所有这些超级用户创建一个组 supergroup
,以便在需要时为文件提供组级访问权限。
在hdfs-site.xml
中添加这个属性来配置超级组
<property>
<name>dfs.permissions.superusergroup</name>
<value>supergroup</value>
<description>The name of the group of super-users.</description>
</property>
我对 HDFS 和 Hive 中的代理用户设置感到非常困惑。我在 hive-site.xml
中启用了 doAs 选项<property>
<name>hive.server2.enable.doAs</name>
<value>true</value>
</property>
和核心中的代理用户-site.xml
<property>
<name>hadoop.proxyuser.hdfs.hosts</name>
<value>*</value>
</property>
<property>
<name>hadoop.proxyuser.hdfs.groups</name>
<value>*</value>
</property>
但这会导致:
2017-03-29 16:24:59,022 INFO org.apache.hadoop.ipc.Server: Connection from 172.16.0.239:60920 for protocol org.apache.hadoop.hdfs.protocol.ClientProtocol is unauthorized for user hive (auth:PROXY) via hive (auth:SIMPLE)
2017-03-29 16:24:59,023 INFO org.apache.hadoop.ipc.Server: Socket Reader #1 for port 9000: readAndProcess from client 172.16.0.239 threw exception [org.apache.hadoop.security.authorize.AuthorizationException: User: hive is not allowed to impersonate hive]
我没有像大多数示例那样将 proxyuser 设置为 "hive" 是因为 core-site.xml 被其他服务共享,我不喜欢每个服务访问 HDFS 作为配置单元,但我仍然试一试,现在 core-site.xml 看起来像:
<property>
<name>hadoop.proxyuser.hive.hosts</name>
<value>*</value>
</property>
<property>
<name>hadoop.proxyuser.hive.groups</name>
<value>*</value>
</property>
我又吃了一次beeline,不过,这次登录没问题,但是当一个命令是运行,纱线抛出异常:
Error: Error while processing statement: FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.mr.MapRedTask. Permission denied: user=hive, access=WRITE, inode="/user/yarn/hive/.staging":hdfs:supergroup:drwxr-xr-x
proxyuser "hive" 已被 "hdfs" 拥有的暂存文件夹拒绝。我不认为将 777 提供给暂存文件夹是一个好主意,因为给予 HDFS 保护但向所有人打开该文件夹是没有意义的。所以我的问题是在 Hive、Hdfs 和 Yarn 之间设置权限的最佳解决方案是什么?
Hadoop权限对我来说简直是一场噩梦,请帮忙。
在 core-site.xml
中添加代理用户条目将允许名为 hive
的超级用户从任何主机连接(值为 *
)以模拟属于任何组的用户(值为是 *
)。
<property>
<name>hadoop.proxyuser.hive.hosts</name>
<value>*</value>
</property>
<property>
<name>hadoop.proxyuser.hive.groups</name>
<value>*</value>
</property>
这可以通过传递实际的主机名和组名来增加限制(参考 Superusers)。超级用户 hive
对 FS 的访问权限将适用于模拟用户。
对于多用户 Hadoop 环境,最佳做法是为每个超级用户创建专用目录,并配置相关服务以在其中存储文件。并为所有这些超级用户创建一个组 supergroup
,以便在需要时为文件提供组级访问权限。
在hdfs-site.xml
中添加这个属性来配置超级组
<property>
<name>dfs.permissions.superusergroup</name>
<value>supergroup</value>
<description>The name of the group of super-users.</description>
</property>