Experience on Namenode backup and restore --- checkpoint
2014-06-13 16:07
435 查看
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
Runas /user:hadoop cmd.exe
You must have user hadoop password.
Backup real time checkpoint:
[plain] view
plaincopy
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
plaincopy
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
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
cmd>start_local_hdp_services.cmd
Levae safemode
[plain] view
plaincopy
cmd>%hadoop_home%/bin/hdfs dfsadmin -safemode leave
Balance you HDFS:
[plain] view
plaincopy
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... ...
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
Runas /user:hadoop cmd.exe
You must have user hadoop password.
Backup real time checkpoint:
[plain] view
plaincopy
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
plaincopy
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
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
cmd>start_local_hdp_services.cmd
Levae safemode
[plain] view
plaincopy
cmd>%hadoop_home%/bin/hdfs dfsadmin -safemode leave
Balance you HDFS:
[plain] view
plaincopy
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
- Experience on Namenode backup and restore --- checkpoint......
- Author name disambiguation using a graph model with node splitting and merging based on bibliographic information
- Backup and restore the disk table on linux
- backup and restore database on Microsoft SQL Server 2005
- MySQL Backup and Restore Commands for Database Administration
- Backup and Restore Search Service Application
- HDFS使用Backup Node、Checkpoint Node以及Standby Namenode进行checkpoint的机制详解
- How to Install and Run a node.js App on Centos 6.4 64bit
- HDFS学习– Namenode and Datanode
- Backup SQL Server 2008 R2 Restore on SQL 2008
- 启动rabbitmq,提示ERROR: node with name "rabbit" already running on "localhost"
- org.apache.hadoop.hdfs.server.namenode.LeaseExpiredException: No leas e on
- HDFS Namenode Audit Design and Implemention
- restore hadoop primary namenode from secondary namenode checkpoint step by step
- Secondary NameNode,Checkpoint Node,Backup Node,HDFS HA
- DB2 Backup and Restore
- win 7 backup and restore
- Bypass pattern lock on Sony Xperia Z2 and backup all data
- HowTo Restore RMAN Disk backups of RAC Database to Single Instance On Another Node [ID 415579.1]