zoukankan      html  css  js  c++  java
  • Experience on Namenode backup and restore --- checkpoint

    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 plaincopy在CODE上查看代码片派生到我的代码片
    1. Runas /user:hadoop cmd.exe  
    You must have user hadoop password.

    Backup real time checkpoint:

    [plain] view plaincopy在CODE上查看代码片派生到我的代码片
    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:hdpdatahdfs n)  first for my next test ( restore from my namenode dir backup ) .

    Delete all files in C:hdpdatahdfs n ,

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

    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 plaincopy在CODE上查看代码片派生到我的代码片
    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 plaincopy在CODE上查看代码片派生到我的代码片
    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 plaincopy在CODE上查看代码片派生到我的代码片
    1. cmd>start_local_hdp_services.cmd  

    Levae safemode

    [plain] view plaincopy在CODE上查看代码片派生到我的代码片
    1. cmd>%hadoop_home%/bin/hdfs dfsadmin -safemode leave  


    Balance you HDFS:

    [plain] view plaincopy在CODE上查看代码片派生到我的代码片
    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... ...



      

  • 相关阅读:
    InSAR 大气校正数据 GACOS
    java通用的方法整理
    Jquery实现select左右栏的添加移除
    kendo ui之grid列表
    kendo-ui学习笔记(一)
    kendo-ui学习笔记——题记
    chrome driver驱动地址
    适合引入缓存的业务及影响
    个人测试方法论202108
    Redis缓存
  • 原文地址:https://www.cnblogs.com/yangykaifa/p/7304916.html
Copyright © 2011-2022 走看看