HDFS 拷贝本地文件至HDFS时的异常[INFO fs.FSInputChecker: Found checksum error]处理方法
2013-03-26 20:54
447 查看
boolean deleteSource = false; boolean overwrite = true; boolean returnValue = false; Configuration hdfsconf = new Configuration(); hdfsconf.addResource(new Path("/usr/local/hadoop/conf/core-site.xml")); FileSystem hdfs = FileSystem.get(hdfsconf); Configuration localconf = new Configuration(); //Copy the index files to HDFS FileSystem.getLocal(localconf).setVerifyChecksum(true); returnValue = FileUtil.copy(FileSystem.getLocal(localconf), solrDataDir, hdfs, hdfsDataDir, deleteSource, overwrite, hdfsconf); System.out.println("Upload all index files in local Solr dir to " + hdfsconf.get("fs.default.name"));
在执行以上代码时报错,在上传的文件中有一文件(segment.gen)的校验码出错,无法完成上传。
打开要上传的本地目录,使用ls -all查看隐藏文件,发现有隐藏的crc文件,无法上传的segment.gen也有对应的crc文件。
这时有两种解决方案:
1
FileSystem.getLocal(localconf).setVerifyChecksum(false);这样让本地文件无法校验,但是上传至HDFS的文件也会有错
2
在本地目录中删除这一.crc文件,代码在下次执行copy时会重新生成新的.crc文件,这样上传文件会根据新的校验文件校验从而不会出错。
相关文章推荐
- Hadoop put file 错误:fs.FSInputChecker: Found checksum error
- fs.FSInputChecker: Found checksum error
- fs.FSInputChecker: Found checksum error
- 拷贝本地文件至HDFS异常:No FileSystem for scheme: file
- HDFS Append时packet的格式以及DataNode对block/checksum文件的处理
- Apache下error.log文件太大的处理方法
- Node.js本地文件操作之文件拷贝与目录遍历的方法
- IO流一:概述、IO异常处理、文件续写、文件读取、文件拷贝及练习
- Errore HTTP 404.2 - Not Found" IIS 7.5 请求的内容似乎是脚本,因而将无法由静态文件处理程序来处理
- 异常Java.net.SocketException: Unrecognized Windows Sockets error: 0: JVM_Bind处理方法
- Node.js本地文件操作之文件拷贝与目录遍历的方法
- WSDL文件编译java代码报:Error generating JAXB model.错的处理方法
- Errore HTTP 404.2 - Not Found" IIS 7.5 请求的内容似乎是脚本,因而将无法由静态文件处理程序来处理
- Errore HTTP 404.2 - Not Found" IIS 7.5 请求的内容似乎是脚本,因而将无法由静态文件处理程序来处理
- Java基础之IO流,创建文件并写入内容与IO异常的标准处理方法
- 异常Java.net.SocketException: Unrecognized Windows Sockets error: 0: JVM_Bind处理方法
- HDFS处理大量小文件时的解决方法
- PHP7的异常处理机制,set_error_handler和set_exception_handler方法介绍
- cubes框架导入slicer.ini文件报错,处理方法。cubes.errors.ConfigurationError: config should be a ConfigParser instan
- 一个在SSAS中的"The attribute key cannot be found" Error处理方法