Formatting HDFS
Working on hadoop, especially on test clusters, I have managed to break my HDFS layer and sometimes with no possible redemption, or at least none that I wanted to invest time in. For whatever other reason sometimes you just want to scratch your HDFS and start anew.
Without going on too much details, which is outside the point of this blog post. HDFS is mainly composed of 2 types of elements:
- Namenode: At high level the namenode stores the HDFS namespace, think of it as your file system tree.
- Datanode: this is where your data is actually stored
The Namenode: /hadoop/hdfs/namenode/current
All new edits are written to the the edit log and regularly merged out to an FSImage file, for more concise management. An fsimage file represents the file system state after all modifications up to a specific transaction ID. The seen_txid file, has the last seen transaction. VERSION: contains cluster and hdfs IDs.
For a more detailled explanation: Hdfs metadata
The Datanode: /hadoop/hdfs/data/current
In our example we will only focus on VERSIOn very close to the namenode VERSION.
Hdfs non HA formatting
In non HA everything is simple enough.
- Stop the HDFS Service
- run hadoop namenode -format (as user hdfs)
- clear the data directory on all datanodes
- restart hdfs
At this point your HDFS layer is empty and if you check the VERSION of namenodes and datanodes they should coincide
Hdfs HA formatting
In HA things get a little more complicated. In HA Standby and Active namenodes have a shared storage managed by the journal node service. HA relies on a failover scenario to swap from StandBy to Active Namenode and as any other system in hadoop this uses zookeeper. As you can see a couple more pieces need to made aware of a formatting action.
The initial steps are very close
- Stop the Hdfs service
- Start only the journal nodes (as they will need to be made aware of the formatting)
- On the first namenode (as user hdfs)
- hadoop namenode -format
- hdfs namenode -initializeSharedEdits -force (for the journal nodes)
- hdfs zkfc -formatZK -force (to force zookeeper to reinitialise)
- restart that first namenode
- On the second namenode
- hdfs namenode -bootstrapStandby -force (force synch with first namenode)
- On every datanode clear the data directory
- Restart the HDFS service
This was a very simple step by step guide to formatting. In a later article we will cover actually repairing common errors in HDFS
Formatting HDFS的更多相关文章
- HDFS中namenode启动失败
1.环境配置: -1.core-site.xml文件 <configuration> <property> <name>fs.defaultFS</name& ...
- Hadoop 2.7.4 HDFS+YRAN HA部署
实验环境 主机名称 IP地址 角色 统一安装目录 统一安装用户 sht-sgmhadoopnn-01 172.16.101.55 namenode,resourcemanager /usr/local ...
- Hadoop集群-HDFS集群中大数据运维常用的命令总结
Hadoop集群-HDFS集群中大数据运维常用的命令总结 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 本篇博客会简单涉及到滚动编辑,融合镜像文件,目录的空间配额等运维操作简介.话 ...
- Hadoop集群(二) HDFS搭建
HDFS只是Hadoop最基本的一个服务,很多其他服务,都是基于HDFS展开的.所以部署一个HDFS集群,是很核心的一个动作,也是大数据平台的开始. 安装Hadoop集群,首先需要有Zookeeper ...
- Apache hadoop namenode ha和yarn ha ---HDFS高可用性
HDFS高可用性Hadoop HDFS 的两大问题:NameNode单点:虽然有StandbyNameNode,但是冷备方案,达不到高可用--阶段性的合并edits和fsimage,以缩短集群启动的时 ...
- HDFS ha 格式化报错:a shared edits dir must not be specified if HA is not enabled.
错误内容: Formatting using clusterid: CID-19921335-620f-4e72-a056-899702613a6b2019-01-12 07:28:46,986 IN ...
- hadoop 2.7.3本地环境运行官方wordcount-基于HDFS
接上篇<hadoop 2.7.3本地环境运行官方wordcount>.继续在本地模式下测试,本次使用hdfs. 2 本地模式使用fs计数wodcount 上面是直接使用的是linux的文件 ...
- Hadoop学习之旅二:HDFS
本文基于Hadoop1.X 概述 分布式文件系统主要用来解决如下几个问题: 读写大文件 加速运算 对于某些体积巨大的文件,比如其大小超过了计算机文件系统所能存放的最大限制或者是其大小甚至超过了计算机整 ...
- python基础操作以及hdfs操作
目录 前言 基础操作 hdfs操作 总结 一.前言 作为一个全栈工程师,必须要熟练掌握各种语言...HelloWorld.最近就被"逼着"走向了python开发之路, ...
随机推荐
- os.path等os模块函数
os.path.abspath(path) #返回绝对路径 os.path.basename(path) #返回文件名 os.path.commonprefix(list) #返回list(多个路径) ...
- Summary #ToBeContinue......
一.请回望暑假时的第一次作业,你对于软件工程课程的想象1)对比开篇博客你对课程目标和期待,“希望通过实践锻炼,增强计算机专业的能力和就业竞争力”,对比目前的所学所练所得,在哪些方面达到了你的期待和目标 ...
- Spring 之 IOC
IoC的全称是Inversion of Control,中文称为控制反转, Martin Flower由根据它创造了一个新词:Dependency Injection,中文称为依赖注入.这两个词讲的是 ...
- Javascript的事件模型和Promise实现
1. Javascript的运行时模型——事件循环 JS的运行时是个单线程的运行时,它不像其他编程语言,比如C++,Java,C#这些可以进行多线程操作的语言.当它执行一个函数时,它只会一条路走到黑, ...
- 解决同一程序在并行同时调用时,出现资源等待错误-使用DBMS_LOCK.sleep
解决同一程序被并行同时调用时,出现资源等待错误问题. 使用DBMS_LOCK.sleep (10); PROCEDURE prc_lock_test(v_engine_id in varchar, v ...
- CentOS 系统状况查看
1 磁盘 iostat 安装 yum install sysstat iostat -x Linux -.el7.x86_64 (sdw2) 2017年03月07日 _x86_64_ ( CPU ...
- HTML5使用总结(一)
自己在“上海某985大学”待了五年,有蛮多的不舍.但是终究还是要离开.下面对这几年HTML5的使用做一个总结.总结是一种技术的沉淀.HTML5大家现在很火,它的标准已经出来.在标准还没有成型的时候,相 ...
- OpenSSH服务及其相关应用
远程登录工具: telnet,TCP/23:认证明文,数据传输明文,不够安全,所以出现了ssh ssh:Secure SHell,TCP/22,刚开始免费,后来商业化了,所以出现了Openssh,这个 ...
- RoadFlowCore工作流引擎快速入门
RoadFlow新建一个流程分为以下几步: 1.建表 在数据库建一张自己的业务表(根据你自己的业务需要确定表字段,如请假流程就有,请假人.请假时间.请假天数等字段),数据表必须要有一个主键,主键类型是 ...
- ES6——Class的继承
class 的继承和使用. 子类继承父类,使用extends关键字. 为父类知道那个静态方法,使用 static方法名字super: 在构造函数中,可以当一个函数来使用,相当于调用父类的构造函数. 在 ...