Hadoop version: Hadoop 2.2.0.2.0.6.0-0009

Well, We can do this by building Secondary Namenode, Checkpoint node or Backup node.

Example:

Assuming you have a Secondary Namenode.

1. Check secondary namenode checkpoint status:

dfs.namenode.secondary.http-address in  %HADOOP_CONF_DIR%/hdfs-site.xml

fs.namenode.checkpoint.dir in  %HADOOP_CONF_DIR%/hdfs-site.xml

dfs.namenode.checkpoint.edits.dir in  %HADOOP_CONF_DIR%/hdfs-site.xml

dfs.namenode.checkpoint.period in  %HADOOP_CONF_DIR%/hdfs-site.xml

2. Backup your real time checkpoint by hand:

On Secondary namenode, Stop Hadoop secondary namenode service.

Run cmd.exe by user hadoop ( or some users have full permission )

[plain] view
plain
copy

  1. Runas /user:hadoop cmd.exe

You must have user hadoop password.

Backup real time checkpoint:

[plain] view
plain
copy

  1. cmd>%hadoop_home%/bin/hadoop secondarynamenode -checkpoint force

Start Hadoop secondary namenode service. and check secondary namenode checkpoint status ( see step 1)

3. Stop Namenode services or reboot Namenode ( if hadoop service set to booting manual ,the services would all stop after reboot )

As for test, I backup my dfs.namenode.name.dir (i.e C:\hdpdata\hdfs\nn)  first for my next test ( restore from my namenode dir backup ) .

Delete all files in C:\hdpdata\hdfs\nn ,

Open  dfs.namenode.checkpoint.dir (see %HADOOP_CONF_DIR%/hdfs-site.xml ) in secondary namenode (i.e. c:\hdpdata\hdfs\snn )

Copy all secondary checkpoint files( except the lock file) from this folder to your namenode's checkpoint dir (dfs.namenode.checkpoint.dir the same as secondary namenode)

Make sure namenode's checkpoint dir is empty already !

4.  Restore from checkpoint dir

Run cmd.exe by user hadoop ( or some users have full permission )

[plain] view
plain
copy

  1. Runas /user:hadoop cmd.exe

You must have user hadoop password.

Use this command to start hadoop service and import checkpoint from checkpoint dir

[plain] view
plain
copy

  1. cmd>%hadoop_home%/bin/hdfs namenode -importcheckpoint

Use ctrl+C to stop service which is completed. and Delete your namenode's checkpoint dir (dfs.namenode.checkpoint.dir the same as secondary namenode)

Start service by this command:

[plain] view
plain
copy

  1. cmd>start_local_hdp_services.cmd

Levae safemode

[plain] view
plain
copy

  1. cmd>%hadoop_home%/bin/hdfs dfsadmin -safemode leave

Balance you HDFS:

[plain] view
plain
copy

  1. cmd>%hadoop_home%/bin/hdfs balancer -threshold 5

5. Confirm your Hadoop service is restored successfully.

Open URL  http://namenode:50070/ to check if there are some missing block. If yes. Please kindly check where they are and what they are.

Because restore from secondary namenode isn't a real time restore solution. It may lost the last time what you do in the jobtracker. It doesn't matter. Just delete them.

Tips: If you want to restore a real time backup, please use multiplicate namenode dir mode. see next post... ...

Experience on Namenode backup and restore --- checkpoint的更多相关文章

  1. hadoop 2.5 hdfs namenode –format 出错Usage: java NameNode [-backup] |

    在 cd  /home/hadoop/hadoop-2.5.2/bin 下 执行的./hdfs namenode -format 报错[hadoop@node1 bin]$ ./hdfs nameno ...

  2. 【Hadoop】namenode与secondarynamenode的checkpoint合并元数据

    Checkpoint Node(检查点节点) NameNode persists its namespace using two files: fsimage, which is the latest ...

  3. TFS Express backup and restore

    When we setup source control server, we should always make a backup and restore plan for it. This ar ...

  4. 转:db2 backup 及 restore

    db2 backup 及 restore 2011-06-21 18:12:20|  分类: AIX |举报 |字号 订阅     两个问题: db2=>list applications db ...

  5. 第一章、关于SQL Server数据库的备份和还原(sp_addumpdevice、backup、Restore)

    在sql server数据库中,备份和还原都只能在服务器上进行,备份的数据文件在服务器上,还原的数据文件也只能在服务器上,当在非服务器的机器上启动sql server客户端的时候,也可以通过该客户端来 ...

  6. [转]Configure Network Drive Visible for SQL Server During Backup and Restore Using SSMS

    本文转自:https://mytechmantra.com/LearnSQLServer/Configure-Network-Drive-Visible-for-SQL-Server-During-B ...

  7. Backup and restore of FAST Search for SharePoint 2010

    一个同事问我一个问题: 如果FAST Search for SharePoint 2010被full restore到了一个之前的时间点, 那么当FAST Search重新开始一个增量爬网的时候, 会 ...

  8. SQL Server Database Backup and Restore in C#

    SQL Server Database Backup and Restore in C# Syed Noman Ali Shah,                          7 Feb 201 ...

  9. Backup and Restore MySQL Database using mysqlhotcopy

    mysqlhotcopy is a perl script that comes with MySQL installation. This locks the table, flush the ta ...

随机推荐

  1. 第十二章 Openwrt无法识别2.0 USB 盘

    今天新的U盘不能识别,还以为是U盘本身的问题,原来是缺少 kmod-usb-storage kmod-usb-storage-extras 这两个软件包. 软件包安装后重启便可识别.

  2. python的__slots__节约内存的魔法;检查python每一行代码内存占用情况的工具

    在Python中,每个类都有实例属性.默认情况下Python用一个字典来保存一个对象的实例属性.这非常有用,因为它允许我们在运行时去设置任意的新属性. 然而,对于有着已知属性的小类来说,它可能是个瓶颈 ...

  3. 使用Vue.js制作仿Metronic高级表格(一)静态设计

    Metronic高级表格是Metonic框架中自行实现的表格,其底层是Datatables.本教程将主要使用Vue实现交互部分,使用Bootstrap做样式库.jQuery做部分用户交互(弹窗). 使 ...

  4. 安装Office2007时出现1706错误的解决方案

    前几天,重做了系统.周末因为接到一笔单子,很兴奋啊.第一次接到私活.然后就装Office2007,打算看需求的.居然安装的时候出现错误,提示1706错误,后面一串错误信息,也懒得看,以为是文件坏了. ...

  5. 【SSH三大框架】Hibernate基础第十一篇:对继承映射的操作

    在java中.类之间能够有继承关系.可是在数据库中是没有继承关系的.只是Hibernate是为了把面向对象的关系反映到数据库中.Hibernate为我们提供了3种方案: 第一.一个继承体系放在一张表中 ...

  6. TextView子类的常用属性

    TextView常见的子类包括EditText,Button,CheckBox, RadioButton等. 1.EditText EditText继承自TextView,因此TextView所有属性 ...

  7. Linux网络编程之聊天程序(TCP协议之select)

    服务器端:server.c #include <stdio.h> #include <stdlib.h> #include <errno.h> #include & ...

  8. linux下tar.gz、tar、bz2、zip、 xz、rar等解压缩、压缩命令小结

    http://www.jb51.net/LINUXjishu/43356.html unrar x aa.rarunrar e aa.rarx参数 是解压到一个文件夹里 e参数是把所有文件解压到当前目 ...

  9. iOS 检查app版本更新操作

    iOS 检查app版本更新操作 1:获取本地安装的版本信息: [NSString stringWithFormat:@"Version %@ (%@)", [[[NSBundle ...

  10. Hadoop HelloWord Examples -对Hadoop FileSystem进行操作 - 基于Java

    我之前对hadoop的各种文件操作都是基于命令行的,但是进阶后,经常需要直接从java的代码中对HDFS进行修改.今天来练习下. 一个简单的demo,将hdfs的一个文件的内容拷贝到另外hdfs一个文 ...