Secondarynamenode无法正常备份:ERROR org.apache.hadoop.hdfs.server.namenode.SecondaryNameNode: Exception in...

     

      原先使用hadoop默认设置(hadoop1.2.1),secondarynamenode会正常进行备份,定时从namenode拷贝image文件到SNN。但是具体SNN备份的时间周期和log文件的大小无法定制,后来楼主就修改了SNN的设置,将fs.checkpoint.period修改为3600s,fs.checkpoint.size修改为64兆。在core-site.xml配置文件中添加这两个参数之后,却发现SNN总是无法备份。后来google查找发现还是配置文件没有配置完整造成的,修改配置文件core-site.xml 和hdfs-site.xml文件后问题解决。

贴一下这两个文件内容:

core-site.xml:

1
2 3 4 5 6 7 8 hadoop.tmp.dir 9 /bigdata/hadoop/tmp/ 10 A base for other temporary directories. 11 12 13 14 fs.default.name 15 hdfs://namenode:54310 16 17 18 19 fs.checkpoint.period 20 3600 21 The number of seconds between two periodic checkpoints. 22 23 24 25 fs.checkpoint.size 26 67108864 27 The size of the current edit log (in bytes) that triggers a periodic checkpoint even if the fs.checkpoint.period hasn't 28 expired. 29 30 31 32 33 fs.checkpoint.dir 34 /bigdata/hadoop/namesecondary/ 35 36
hdfs-site.xml

1
2 3 4 5 6 7 8 9 fs.checkpoint.period 10 3600 11 The number of seconds between two periodic checkpoints. 12 13 14 15 16 dfs.secondary.http.address 17 secondnamenode:50090 18 19 20 21 22 dfs.http.address 23 namenode:50070 24 true 25 26 27 28 29 dfs.replication 30 2 31 32 33 34 dfs.name.dir 35 /bigdata/hadoop/secondnamenodelogs/ 36
......

      其中红色部分为关键参数。楼主刚开始以为hdfs-site.xml不需要做修改,后来发现问题主要是出现在这个文件中,真是坑爹@!!!

在hdfs-site.xml文件中需要加上core-site.xml文件中的参数fs.checkpoint.period 或者fs.checkpoint.size;dfs.http.address指定namenode的访问地址,SNN根据这个地址来获取NN保存的image。dfs.secondary.http.address则是SNN自己Web接口,这个参数必须配置,楼主就是因为没有配置这个参数一直报下面这个错误:

 1 2014-06-25 14:17:40,408 ERROR org.apache.hadoop.hdfs.server.namenode.SecondaryNameNode: Exception in doCheckpoint:
 2 2014-06-25 14:17:40,408 ERROR org.apache.hadoop.hdfs.server.namenode.SecondaryNameNode: java.io.FileNotFoundException: http://namenode:50070/
 3 getimage?putimage=1&port=50090&machine=0.0.0.0&token=-41:620270652:0:1403579817000:1403578915285&newChecksum=7fcdd4793ce44f017d290e7db78870e7
 4         at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1434)
 5         at org.apache.hadoop.hdfs.server.namenode.TransferFsImage.getFileClient(TransferFsImage.java:177)
 6         at org.apache.hadoop.hdfs.server.namenode.SecondaryNameNode.putFSImage(SecondaryNameNode.java:462)
 7         at org.apache.hadoop.hdfs.server.namenode.SecondaryNameNode.doCheckpoint(SecondaryNameNode.java:525)
 8         at org.apache.hadoop.hdfs.server.namenode.SecondaryNameNode.doWork(SecondaryNameNode.java:396)
 9         at org.apache.hadoop.hdfs.server.namenode.SecondaryNameNode.run(SecondaryNameNode.java:360)
10         at java.lang.Thread.run(Thread.java:662)


转载于:https://www.cnblogs.com/chao1118/p/3810194.html

你可能感兴趣的:(Secondarynamenode无法正常备份:ERROR org.apache.hadoop.hdfs.server.namenode.SecondaryNameNode: Exception in...)