码迷,mamicode.com
首页 > 其他好文 > 详细

hdfs

时间:2019-01-23 14:34:19      阅读:200      评论:0      收藏:0      [点我收藏+]

标签:post   efault   addition   limit   body   actor   100%   processor   decorator   

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

hdfs

标签:post   efault   addition   limit   body   actor   100%   processor   decorator   

原文地址:https://www.cnblogs.com/yangxiaochu/p/10308637.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!