分享

浏览器端访问hdfs文件系统提示输入用户问题

pengsuyun 发表于 2014-10-24 11:11:17 [显示全部楼层] 只看大图 回帖奖励 阅读模式 关闭右栏 16 64246
本帖最后由 pengsuyun 于 2014-10-24 11:18 编辑

在我的hadoop环境中,配置了Kerberos,hdfs-site.xml中的配置如下
  1. <property>
  2.        <name>dfs.webhdfs.enabled</name>
  3.        <value>true</value>
  4.            </property>
  5.         <property>
  6.         <name>dfs.web.authentication.kerberos.principal</name>
  7.         <value>http/admin@psy.com</value>
  8.            </property>
  9.         <property>
  10.         <name>dfs.web.authentication.kerberos.keytab</name>
  11.         <value>/hadoop-data/etc/hadoop/http.service.keytab</value>
  12.            </property>
复制代码

然后在浏览器端访问hdfs文件系统提示输入用户信息。我尝试了http/admin@psy.com以及操作系统用户hadoop都不能访问hdfs的目录
其中输入http/admin@psy.com登录后没有错,但是访问目录的时候就提示没权下了“Permission denied when trying to open /webhdfs/v1/?op=LISTSTATUS: GSSException: Defective token detected (Mechanism level: GSSHeader did not find the right tag)”

大神们,求解释其中的原理。

提示登录页面

提示登录页面


这里附上namenode的日志信息
  1. 2014-10-23 20:16:00,303 WARN org.apache.hadoop.security.authentication.server.AuthenticationFilter: Authentication exception: GSSException: Defective token detected (Mechanism level: GSSHeader did not find the right tag)
  2. org.apache.hadoop.security.authentication.client.AuthenticationException: GSSException: Defective token detected (Mechanism level: GSSHeader did not find the right tag)
  3.         at org.apache.hadoop.security.authentication.server.KerberosAuthenticationHandler.authenticate(KerberosAuthenticationHandler.java:360)
  4.         at org.apache.hadoop.security.authentication.server.AuthenticationFilter.doFilter(AuthenticationFilter.java:357)
  5.         at org.apache.hadoop.hdfs.web.AuthFilter.doFilter(AuthFilter.java:87)
  6.         at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212)
  7.         at org.apache.hadoop.http.HttpServer2$QuotingInputFilter.doFilter(HttpServer2.java:1192)
  8.         at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212)
  9.         at org.apache.hadoop.http.NoCacheFilter.doFilter(NoCacheFilter.java:45)
  10.         at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212)
  11.         at org.apache.hadoop.http.NoCacheFilter.doFilter(NoCacheFilter.java:45)
  12.         at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212)
  13.         at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:399)
  14.         at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
  15.         at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
  16.         at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
  17.         at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:450)
  18.         at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230)
  19.         at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
  20.         at org.mortbay.jetty.Server.handle(Server.java:326)
  21.         at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
  22.         at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:928)
  23.         at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:549)
  24.         at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
  25.         at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
  26.         at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410)
  27.         at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
  28. Caused by: GSSException: Defective token detected (Mechanism level: GSSHeader did not find the right tag)
  29.         at sun.security.jgss.GSSHeader.<init>(GSSHeader.java:97)
  30.         at sun.security.jgss.GSSContextImpl.acceptSecContext(GSSContextImpl.java:306)
  31.         at sun.security.jgss.GSSContextImpl.acceptSecContext(GSSContextImpl.java:285)
  32.         at org.apache.hadoop.security.authentication.server.KerberosAuthenticationHandler$2.run(KerberosAuthenticationHandler.java:327)
  33.         at org.apache.hadoop.security.authentication.server.KerberosAuthenticationHandler$2.run(KerberosAuthenticationHandler.java:309)
  34.         at java.security.AccessController.doPrivileged(Native Method)
  35.         at javax.security.auth.Subject.doAs(Subject.java:415)
  36.         at org.apache.hadoop.security.authentication.server.KerberosAuthenticationHandler.authenticate(KerberosAuthenticationHandler.java:309)
  37.         ... 24 more
复制代码




已有(16)人评论

跳转到指定楼层
bioger_hit 发表于 2014-10-24 11:48:44

回帖奖励 +2 云币

是否使用了强加密

JCE policy 版本与集群jdk版本是否匹配

可以获得适当的JDK版本的JCE政策文件:
JDK 1.6 http://www.oracle.com/technetwor ... ownload-429243.html
JDK 1.7 http://www.oracle.com/technetwor ... ownload-432124.html

回复

使用道具 举报

pengsuyun 发表于 2014-10-24 12:09:43
这个是一致了,昨天从网上下的
回复

使用道具 举报

bioger_hit 发表于 2014-10-24 18:11:43


大概是配置的问题

  1. <!-- General HDFS security config -->
  2. <property>
  3.   <name>dfs.block.access.token.enable</name>
  4.   <value>true</value>
  5. </property>
  6. <!-- NameNode security config -->
  7. <property>
  8.   <name>dfs.https.address</name>
  9.   <value><fully qualified domain name of NN>:50470</value>
  10. </property>
  11. <property>
  12.   <name>dfs.https.port</name>
  13.   <value>50470</value>
  14. </property>
  15. <property>
  16.   <name>dfs.namenode.keytab.file</name>
  17.   <value>/usr/local/hadoop/conf/hdfs.keytab</value> <!-- path to the HDFS keytab -->
  18. </property>
  19. <property>
  20.   <name>dfs.namenode.kerberos.principal</name>
  21.   <value>hdfs/_HOST@YOUR-REALM.COM</value>
  22. </property>
  23. <property>
  24.   <name>dfs.namenode.kerberos.https.principal</name>
  25.   <value>host/_HOST@YOUR-REALM.COM</value>
  26. </property>
  27. <!-- Secondary NameNode security config -->
  28. <property>
  29.   <name>dfs.secondary.https.address</name>
  30.   <value><fully qualified domain name of 2NN>:50495</value>
  31. </property>
  32. <property>
  33.   <name>dfs.secondary.https.port</name>
  34.   <value>50495</value>
  35. </property>
  36. <property>
  37.   <name>dfs.secondary.namenode.keytab.file</name>
  38.   <value>/usr/local/hadoop/conf/hdfs.keytab</value> <!-- path to the HDFS keytab -->
  39. </property>
  40. <property>
  41.   <name>dfs.secondary.namenode.kerberos.principal</name>
  42.   <value>hdfs/_HOST@YOUR-REALM.COM</value>
  43. </property>
  44. <property>
  45.   <name>dfs.secondary.namenode.kerberos.https.principal</name>
  46.   <value>host/_HOST@YOUR-REALM.COM</value>
  47. </property>
  48. <!-- DataNode security config -->
  49. <property>
  50.   <name>dfs.datanode.data.dir.perm</name>
  51.   <value>700</value>
  52. </property>
  53. <property>
  54.   <name>dfs.datanode.address</name>
  55.   <value>0.0.0.0:1004</value>
  56. </property>
  57. <property>
  58.   <name>dfs.datanode.http.address</name>
  59.   <value>0.0.0.0:1006</value>
  60. </property>
  61. <property>
  62.   <name>dfs.datanode.keytab.file</name>
  63.   <value>/usr/local/hadoop/conf/hdfs.keytab</value> <!-- path to the HDFS keytab -->
  64. </property>
  65. <property>
  66.   <name>dfs.datanode.kerberos.principal</name>
  67.   <value>hdfs/_HOST@YOUR-REALM.COM</value>
  68. </property>
  69. <property>
  70.   <name>dfs.datanode.kerberos.https.principal</name>
  71.   <value>host/_HOST@YOUR-REALM.COM</value>
  72. </property>
复制代码



回复

使用道具 举报

hiqj 发表于 2014-11-11 20:27:18
请问楼主用的这个Hadoop是什么版本的?!盼复!!!
回复

使用道具 举报

hiqj 发表于 2014-11-11 20:48:12
这个问题最后你们是怎么解决的?!
回复

使用道具 举报

pengsuyun 发表于 2014-11-12 08:23:32
hiqj 发表于 2014-11-11 20:27
请问楼主用的这个Hadoop是什么版本的?!盼复!!!

hadoop版本:2.4.1
回复

使用道具 举报

pengsuyun 发表于 2014-11-12 08:24:24
hiqj 发表于 2014-11-11 20:48
这个问题最后你们是怎么解决的?!

先放到一般去了,没解决.
回复

使用道具 举报

xyxdu 发表于 2015-5-13 11:27:04
楼主问题解决没,哪位大侠路过解决下啊。
回复

使用道具 举报

12下一页
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

推荐上一条 /2 下一条