Hadoop 默認開放了很多端口來提供 WebUI 服務,通過訪問 NameNode WebUI 管理界面的 50070 端口,可以下載任意文件,所以需要對頁面增加訪問限制。
修改core-site.xml配置文件,追加以下信息<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>
<!-- 可動態配置,主從同樣配置,並 生成hadoop-http-auth-signature-secret 文件,放到對應位置,內部為允許訪問的用戶,用user.name=“”訪問 -->
</property>
<property>
<name>hadoop.http.authentication.cookie.domain</name>
<value></value>
</property>
ok問題解決了
<property>
<name>hadoop.http.authentication.simple.anonymous.allowed</name>
<value>false</value>
</property>:
再次訪問hadoop頁面時需要