Hadoop web監控介面設定安全機制

來源:互聯網
上載者:User

標籤:http   檔案   type   name   user   os   

Hadoop叢集配置完成,web監控介面的50070和50030連接埠不需使用者驗證即可訪問,對生產環境是不容許的,需要加上安全機制。

實驗環境:OS:Centos 6.5 x64, Soft:Hadoop 1.2.1

1、修改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>
</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、在上述配置的目錄/home/huser/hadoop/下組建檔案hadoop-http-auth-signature-secret,拷貝到其他節點上。

$ echo "hadoop" > hadoop-http-auth-signature-secret

3、重啟叢集環境,訪問web頁面會報錯。

HTTP ERROR 401

Problem accessing /dfshealth.jsp. Reason:

org.apache.hadoop.security.authentication.client.AuthenticationException: Anonymous requests are disallowed

在訪問地址欄後面加上?user.name=xxx,其中“xxx“為hadoop-http-auth-signature-secret檔案寫入的內容,頁面可以正常訪問,由此可以做到安全機制。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.