Hadoop2.x通过Zookeeper实现Namenode的HA方案及ResourceM(2)

<property>
          <name>dfs.ha.fencing.ssh.private-key-files</name>
          <value>/home/grid/.ssh/id_rsa_nn</value>
        </property>
-->
        <property>
          <name>ha.zookeeper.session-timeout.ms</name>
          <value>60000</value>
        </property>
        <property>
          <name>ha.failover-controller.cli-check.rpc-timeout.ms</name>
          <value>60000</value>
        </property>
        <property>
          <name>ipc.client.connect.timeout</name>
          <value>20000</value>
        </property>

</configuration>
  
(2)修改hdfs-site.xml文件

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="https://www.linuxidc.com/configuration.xsl"?>
<!--
  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License. See accompanying LICENSE file.
-->

<!-- Put site-specific property overrides in this file. -->

<configuration>
    <property>
      <name>dfs.nameservices</name>
      <value>mycluster</value>
    </property>
    <property>
      <name>dfs.ha.namenodes.mycluster</name>
      <value>nn1,nn2</value>
    </property>
    <property>
      <name>dfs.namenode.rpc-address.mycluster.nn1</name>
    <value>hadoop1:9000</value>
    </property>
    <property>
      <name>dfs.namenode.rpc-address.mycluster.nn2</name>
      <value>hadoop5:9000</value>
    </property>
    <property>
      <name>dfs.namenode.http-address.mycluster.nn1</name>
      <value>hadoop1:50070</value>
    </property>
    <property>
      <name>dfs.namenode.http-address.mycluster.nn2</name>
      <value>hadoop5:50070</value>
    </property>
    <property>
      <name>dfs.namenode.servicerpc-address.mycluster.nn1</name>
      <value>hadoop1:53310</value>
    </property>
    <property>
      <name>dfs.namenode.servicerpc-address.mycluster.nn2</name>
      <value>hadoop5:53310</value>
    </property>
    <property> 
      <name>dfs.ha.automatic-failover.enabled</name> 
      <value>true</value> 
    </property>
    <property>
      <name>dfs.namenode.shared.edits.dir</name>
      <value>qjournal://hadoop1:8485;hadoop2:8485;hadoop3:8485;hadoop4:8485;hadoop5:8485/mycluster</value>
    </property>
    <property>
    <name>dfs.journalnode.edits.dir</name>
    <value>/home/grid/hadoop-2.6.0/journal/data</value>
    </property>
    <property>
      <name>dfs.client.failover.proxy.provider.mycluster</name>
      <value>org.apache.hadoop.hdfs.server.namenode.ha.ConfiguredFailoverProxyProvider</value>
    </property>
    <property>
        <name>dfs.replication</name>
        <value>3</value>
    </property>
    <property>
        <name>dfs.namenode.name.dir</name>     
        <value>file:///home/grid/hadoop-2.6.0/dfs/name</value>
    </property>
    <property>
        <name>dfs.datanode.data.dir</name>
        <value>file:///home/grid/hadoop-2.6.0/dfs/data</value>
    </property>
    <property>
        <name>dfs.webhdfs.enabled</name>
        <value>true</value>
    </property>
    <property>
    <name>dfs.permissions.enable</name>
    <value>false</value>
    </property>
    <property>
      <name>dfs.permissions</name>
      <value>false</value>
    </property>
    <property>
      <name>dfs.image.transfer.bandwidthPerSec</name>
      <value>1048576</value>
    </property>
    <property>
      <name>dfs.ha.fencing.methods</name>
      <value>shell(/bin/true)</value>
    </property>
<!--
    <property>
      <name>dfs.ha.fencing.ssh.private-key-files</name>
      <value>/home/grid/.ssh/id_rsa_nn</value>
    </property>
-->
</configuration>
  
在这个文件中需要说明的有两点:

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/c61d1d5292f93e78a0051e42ed027dbd.html