Hadoop cluster configuration completed, the Web monitoring interface 50070 and 50030 ports without user authentication can be accessed, the production environment is not allowed, need to add security mechanisms.
Experimental environment: Os:centos 6.5 x64, Soft:hadoop 1.2.1
1, modify the Core-site.xml, add the following, the configuration is completed after the copy to the other nodes.
<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>/home/huser/hadoop/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>
2, in the above configuration directory/home/huser/hadoop/generated file Hadoop-http-auth-signature-secret, copied to other nodes.
$ echo "Hadoop" > Hadoop-http-auth-signature-secret
3, restart the cluster environment, access to the Web page will be error.
HTTP ERROR 401
Problem accessing/dfshealth.jsp. Reason:
Org.apache.hadoop.security.authentication.client.AuthenticationException:Anonymous Requests is disallowed
After accessing the address bar, add the user.name=xxx, where "xxx" is the content that the Hadoop-http-auth-signature-secret file writes, the page can be accessed normally, thus security mechanism can be achieved.