zoukankan      html  css  js  c++  java
  • hdfs.html

    hdfs.html

    HDFS

    HDFS:分布式文件存储系统

    hdfs的工作机制:
    1、客户把一个文件存入hdfs,其实hdfs会把这个文件切块后,分散存储在N台linux机器系统中(负责存储文件块的角色:data node)<准确来说:切块的行为是由客户端决定的>

    2、一旦文件被切块存储,那么,hdfs中就必须有一个机制,来记录用户的每一个文件的切块信息,及每一块的具体存储机器(负责记录块信息的角色是:name node)

    3、为了保证数据的安全性,hdfs可以将每一个文件块在集群中存放多个副本(到底存几个副本,是由当时存入该文件的客户端指定的)

    综述:一个hdfs系统,由一台运行了namenode的服务器,和N台运行了datanode的服务器组成!

    安装

    1.配置jdk
    2.配置域名解析
    3.做ssh免密登陆
    4.下载hadoop安装包
    5.解压,并配置
    6.详细内容:
    core-site.xml

    <?xml version="1.0" encoding="UTF-8"?>
    <?xml-stylesheet type="text/xsl" href="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
        http://www.apache.org/licenses/LICENSE-2.0
      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>fs.defaultFS</name>
    <value>hdfs://hd01:9000</value>
    </property>
    </configuration>
    

    cat hdfs-site.xml

    <?xml version="1.0" encoding="UTF-8"?>
    <?xml-stylesheet type="text/xsl" href="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
        http://www.apache.org/licenses/LICENSE-2.0
      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.namenode.name.dir</name>
    <value>/root/hdpdata/name/</value>
    </property>
    <property>
    <name>dfs.datanode.data.dir</name>
    <value>/root/hdpdata/data</value>
    </property>
    <property>
    <name>dfs.namenode.secondary.http-address</name>
    <value>hd02:50090</value>
    </property>
    </configuration>
    

    启动namemode

    配置hadoop的启动命令
    vim /etc/profile
    export PATH=$PATH:/home/hadoop/hadoop-2.8.5/bin/:/home/hadoop/hadoop-2.8.5/sbin
    source /etc/profile
    
    第一次启动,先格式化namenode

    hadoop namenode -format

    启动namenode和datanode

    hadoop-daemon.sh start namenode
    hadoop-daemon.sh start datanode

    全部启停使用(做好免密登陆)

    start-dfs.sh
    stop-dfs.sh

  • 相关阅读:
    Spring Boot 2.4 手工和 SDKMAN! 安装 Spring Boot 命令行
    Spring Boot 2.4 安装
    Java Web 开发中的中文乱码与解决方式
    项目文件与 SVN 资源库同步提示错误 Attempted to lock an already-locked dir
    JavaScript中的日期时间函数
    jmeter测试 常用数据库的性能
    jmeter 运行多个sql
    Linux 进程管理
    Linux vi 文件编辑
    Linux 常用文件管理命令
  • 原文地址:https://www.cnblogs.com/yangxiaochu/p/10308637.html
Copyright © 2011-2022 走看看