官网参考地址:Hadoop HDFS over HTTP - Server Setup。
除了官网配置步骤外,还需要注意在httpfs-site.xml中添加以下配置:
1 2 3 4 5 6 7 8
| <property> <name>httpfs.proxyuser.{proxyuser}.groups</name> <value>*</value> </property> <property> <name>httpfs.proxyuser.{proxyuser}.hosts</name> <value>*</value> </property>
|
注意,该配置项跟core-site.xml中的很像,但是开头部分不一样。
这个问题我是通过跟踪Hadoop源代码解决的:
1 2 3 4 5 6 7 8 9 10 11
| /hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/fs/http/server/HttpFSAuthenticationFilter.java
protected Configuration getProxyuserConfiguration(FilterConfig filterConfig) { Map<String, String> proxyuserConf = HttpFSServerWebApp.get().getConfig(). getValByRegex("httpfs\\.proxyuser\\."); Configuration conf = new Configuration(false); for (Map.Entry<String, String> entry : proxyuserConf.entrySet()) { conf.set(entry.getKey().substring("httpfs.".length()), entry.getValue()); } return conf; }
|