zoukankan      html  css  js  c++  java
  • hdfs

    ref

    https://www.cnblogs.com/bigdatasafe/p/10784523.html

    配置文件

      1 <?xml version="1.0" encoding="UTF-8"?>
      2 <?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
      3 <!--
      4   Licensed under the Apache License, Version 2.0 (the "License");
      5   you may not use this file except in compliance with the License.
      6   You may obtain a copy of the License at
      7 
      8     http://www.apache.org/licenses/LICENSE-2.0
      9 
     10   Unless required by applicable law or agreed to in writing, software
     11   distributed under the License is distributed on an "AS IS" BASIS,
     12   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13   See the License for the specific language governing permissions and
     14   limitations under the License. See accompanying LICENSE file.
     15 -->
     16 
     17 <!-- Put site-specific property overrides in this file. -->
     18 
     19 <configuration>
     20 
     21   <property>
     22     <name>dfs.nameservices</name>
     23     <value>mycluster</value>
     24   </property>
     25 
     26   <!-- mycluster下面有两个NameNode,分别是nn1,nn2 -->
     27   <property>
     28     <name>dfs.ha.namenodes.mycluster</name>
     29     <value>nn1,nn2</value>
     30   </property>
     31 
     32   <!-- nn1的RPC通信地址 -->
     33   <property>
     34     <name>dfs.namenode.rpc-address.mycluster.nn1</name>
     35     <value>hadoop1:9000</value>
     36   </property>
     37   <!-- nn1的http通信地址 -->
     38   <property>
     39     <name>dfs.namenode.http-address.mycluster.nn1</name>
     40     <value>hadoop1:50070</value>
     41   </property>
     42 
     43   <!-- nn2的RPC通信地址 -->
     44   <property>
     45     <name>dfs.namenode.rpc-address.mycluster.nn2</name>
     46     <value>hadoop2:9000</value>
     47   </property>
     48   <!-- nn2的http通信地址 -->
     49   <property>
     50     <name>dfs.namenode.http-address.mycluster.nn2</name>
     51     <value>hadoop2:50070</value>
     52   </property>
     53 
     54   <!-- 指定NameNode的edits元数据在JournalNode上的存放位置 -->
     55   <property>
     56     <name>dfs.namenode.shared.edits.dir</name>
     57     <value>qjournal://hadoop1:8485;hadoop2:8485;hadoop3:8485/mycluster</value>
     58   </property>
     59 
     60   <!-- 指定JournalNode在本地磁盘存放数据的位置 -->
     61   <property>
     62     <name>dfs.journalnode.edits.dir</name>
     63     <value>/data/journaldata</value>
     64   </property>
     65 
     66   <!-- 开启NameNode失败自动切换 -->
     67   <property>
     68     <name>dfs.ha.automatic-failover.enabled</name>
     69     <value>true</value>
     70   </property>
     71 
     72   <!-- 配置失败自动切换实现方式 -->
     73   <property>
     74     <name>dfs.client.failover.proxy.provider.mycluster</name>
     75     <value>org.apache.hadoop.hdfs.server.namenode.ha.ConfiguredFailoverProxyProvider</value>
     76   </property>
     77 
     78   <!-- 配置隔离机制方法,多个机制用换行分割,即每个机制暂用一行-->
     79   <!-- 其中shell(/myclustern/true) 表示可执行一个脚本  比如 shell(/app/yunwei/hadoop_fence.sh) -->
     80   <property>
     81     <name>dfs.ha.fencing.methods</name>
     82     <value>
     83       sshfence
     84       shell(/myclustern/true)
     85     </value>
     86   </property>
     87 
     88   <!-- 使用sshfence隔离机制时需要ssh免登陆 -->
     89   <property>
     90     <name>dfs.ha.fencing.ssh.private-key-files</name>
     91     <value>/home/hadoop/.ssh/id_rsa</value>
     92   </property>
     93 
     94   <!-- 配置sshfence隔离机制超时时间 单位:毫秒 -->
     95   <property>
     96     <name>dfs.ha.fencing.ssh.connect-timeout</name>
     97     <value>30000</value>
     98   </property>
     99 
    100 
    101 
    102 </configuration>

    core-site.xml

     1 <?xml version="1.0" encoding="UTF-8"?>
     2 <?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
     3 <!--
     4   Licensed under the Apache License, Version 2.0 (the "License");
     5   you may not use this file except in compliance with the License.
     6   You may obtain a copy of the License at
     7 
     8     http://www.apache.org/licenses/LICENSE-2.0
     9 
    10   Unless required by applicable law or agreed to in writing, software
    11   distributed under the License is distributed on an "AS IS" BASIS,
    12   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13   See the License for the specific language governing permissions and
    14   limitations under the License. See accompanying LICENSE file.
    15 -->
    16 
    17 <!-- Put site-specific property overrides in this file. -->
    18 
    19 <configuration>
    20 <property>
    21 <name>fs.defaultFS</name>
    22 <value>hdfs://mycluster</value>
    23 <final>true</final>
    24 </property>
    25 
    26   <property>
    27     <name>hadoop.tmp.dir</name>
    28     <value>/data/hadoop/tmp</value>
    29   </property>
    30 
    31 
    32 
    33  <property>
    34    <name>ha.zookeeper.quorum</name>
    35    <value>hadoop1:2181,hadoop2:2181,hadoop3:2181</value>
    36  </property>
    37 
    38 
    39 </configuration>

    1,start all zk

    2,start journalnode on each vm

    hadoop start journalnode

    3, hadoop format

    hdfs namenode -format

    4, copy all hadoop tmp/dir  to slaves

     scp -r tmp/ yun@mini02:/app/hadoop 

    5, format ZK

    hdfs zkfc -formatZK 

    6, start-dfs.sh

  • 相关阅读:
    MySql存储引擎MyISAM和InnoDB的区别
    Nginx下载安装
    科目三考试训练大纲
    解决The current branch is not configured for pull No value for key branch.master.merge found in config
    java实现截取6个汉字字母数字
    如何将git上的代码迁移到Coding上
    Python抓取博客园首页文章列表(带分页)
    Python实现抓取CSDN博客首页文章列表
    Python实现抓取CSDN热门文章列表
    linux目录的操作
  • 原文地址:https://www.cnblogs.com/eiguleo/p/11919705.html
Copyright © 2011-2022 走看看