赞
踩
默认情况下,Hadoop HTTP Web控制台(ResourceManager,NameNode,NodeManagers和DataNodes)允许访问而无需任何形式的身份验证。
官网连接:https://hadoop.apache.org/docs/stable/hadoop-project-dist/hadoop-common/HttpAuthentication.html
1、配置core-site.xml
- <configuration>
- <!-- Authentication for Hadoop HTTP web-consoles -->
- <property>
- <name>hadoop.http.filter.initializers</name>
- <value>org.apache.hadoop.security.AuthenticationFilterInitializer</value>
- </property>
- <property>
- <name>hadoop.http.authentication.type</name>
- <value>simple</value>
- </property>
- <property>
- <name>hadoop.http.authentication.token.validity</name>
- <value>3600</value>
- </property>
- <property>
- <name>hadoop.http.authentication.signature.secret.file</name>
- <value>/opt/apache/hadoop/secret/hadoop-http-auth-signature-secret</value>
- </property>
- <property>
- <name>hadoop.http.authentication.cookie.domain</name>
- <value></value>
- </property>
- <property>
- <name>hadoop.http.authentication.simple.anonymous.allowed</name>
- <value>false</value>
- </property>
- </configuration>
2、创建密钥文件
mkdir -p /opt/apache/hadoop/secret/
cd /opt/apache/hadoop/secret/
echo \"hadoop\" > hadoop-http-auth-signature-secret
3、同步core-site.xml、hadoop-http-auth-signature-secret到集群其他节点
4、重启ResourceManager,NameNode,NodeManagers和DataNodes
5、访问例子
http://ip:50070 出现错误
http://ip:50070?user.name=hadoop 访问正确
6、注意事项
(1)http://ip:50070?user.name=hadoop 访问正确后,再次访问可以不用密码或者密码不正确;如http://ip:50070或者http://ip:50070?user.name=xxx 都可以访问
(2)修改密码时,即echo \"xxx\" > hadoop-http-auth-signature-secret ;修改的密码要和之前的密码相差太,不然会出现修改完密码重启NameNode这些进程,不能正常访问,即使密码正确
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。