在Reduce设置方法中,我试图关闭一个BufferedReader
对象并获得一个FileSystem
封闭的异常.它不会一直发生.这是我用来创建的代码片段BufferedReader
.
String fileName = <some HDFS file path>
Configuration conf = new Configuration();
FileSystem fs = FileSystem.get(conf);
Path hdfsPath = new Path(filename);
FSDataInputStream in = fs.open(hdfsPath);
InputStreamReader inputStreamReader = new InputStreamReader(fileInputStream);
BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
Run Code Online (Sandbox Code Playgroud)
我从bufferedReader读取内容,一旦完成所有读取,我就关闭它.
这是读取它的代码段
String line;
while ((line = reader.readLine()) != null) {
// Do something
}
Run Code Online (Sandbox Code Playgroud)
这段关闭读者的代码.
if (bufferedReader != null) {
bufferedReader.close();
}
Run Code Online (Sandbox Code Playgroud)
这是我执行时发生的异常的堆栈跟踪bufferedReader.close()
.
我,[2013-11-18T04:56:51.601135#25683]信息 - :attempt_201310111840_142285_r_000009_0:at org.apache.hadoop.hdfs.DFSClient.checkOpen(DFSClient.java:565)
我,[2013-11-18T04:56:51.601168#25683]信息 - :attempt_201310111840_142285_r_000009_0:at org.apache.hadoop.hdfs.DFSInputStream.close(DFSInputStream.java:522)
I,[2013-11-18T04:56:51.601199#25683] INFO - :attempt_201310111840_142285_r_000009_0:at …
我对使用kafka主题的代码进行了一些JUnit测试.我试过的模拟kafka主题不起作用,在网上找到的例子很老,所以它们也不适用于0.8.2.1.如何使用0.8.2.1创建模拟kafka主题?
澄清:我选择使用该主题的实际嵌入实例,以便使用真实实例进行测试,而不是在mockito中模拟手.这样我可以测试我的自定义编码器和解码器实际工作,并且当我使用真正的kafka实例时它不会失败.
Map Reduce是一种似乎最近引起很大关注的模式,我开始看到它在我的一个专注于事件处理管道(iPhone加速度计和GPS数据)的项目中体现出来.我需要为这个项目构建大量的基础设施,实际上它超过了与之交互的逻辑代码2倍.我在EventProcessors(带有in-和outputbuffers,时间等),EventListeners,Aggregators和staged Pipeline中构建的一些组件.
这让我想到了地图缩减所需的"常见"基础设施是什么.由于我正在使用.Net,我可以看到框架和语言结构中内置的map reduce基础结构.功能语言本身支持这种范例.似乎每种语言都可以与map reduce一起使用.甚至围绕该概念建立了语言(例如Go).
Apache Hadoop将Map-Reduce引入Java.谷歌已经为map-reduce框架申请了专利.他们提供什么样的基础设施来减少地图?函数式语言中实现map reduce的结构是什么?map-reduce框架需要/应该提供什么?
我正在尝试使用Apache Nifi实现下面的工作流程:
我有几个问题:
Apache Nifi中的ExecuteProcess处理器是否接收传入的流文件?
我无法为ExecuteProcess处理器提供任何incomming流文件.如果没有,有没有办法支持传入流文件?
使用org.apache.hadoop.fs
scala上的类使用HDFS的典型开始是
val conf = new Configuration()
fs = FileSystem.get(conf)
Run Code Online (Sandbox Code Playgroud)
我们需要调用类似
IOUtils.closeStream(fs)
或fs.close()
最终的内容吗?
我找到了与此主题相关的单一答案 https://groups.google.com/forum/#!topic/nosql-databases/Mn9KLbtmh7M
根据我的经验,您可以让FileSystem实例自行关闭.
我不确定我能依靠它.
我一直在学习mapreduce算法以及它如何可能扩展到数百万台机器,但我不明白在地图阶段之后如何对中间键进行排序,因为它将会:
1,000,000 x 1,000,000
:潜在的机器相互传递中间结果的小键/值对?这不是瓶颈吗?
我正在四节点集群上的巨大数据集上运行一些 map reduce 任务,但退出代码出现异常 - 255
16/08/04 08:07:19 INFO mapreduce.Job: map 0% reduce 0%
16/08/04 08:07:27 INFO mapreduce.Job: Task Id : attempt_1470297644642_0001_m_000000_0, Status : FAILED
Exception from container-launch.
Container id: container_1470297644642_0001_01_000003
Exit code: 255
Stack trace: ExitCodeException exitCode=255:
at org.apache.hadoop.util.Shell.runCommand(Shell.java:543)
at org.apache.hadoop.util.Shell.run(Shell.java:460)
at org.apache.hadoop.util.Shell$ShellCommandExecutor.execute(Shell.java:720)
at org.apache.hadoop.yarn.server.nodemanager.DefaultContainerExecutor.launchContainer(DefaultContainerExecutor.java:210)
at org.apache.hadoop.yarn.server.nodemanager.containermanager.launcher.ContainerLaunch.call(ContainerLaunch.java:302)
at org.apache.hadoop.yarn.server.nodemanager.containermanager.launcher.ContainerLaunch.call(ContainerLaunch.java:82)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Container exited with a non-zero exit code 255
Run Code Online (Sandbox Code Playgroud)
在日志文件中 - SLF4J:
无法加载类“org.slf4j.impl.StaticLoggerBinder”。SLF4J:默认为无操作 (NOP) 记录器实现 SLF4J:参见 http://www.slf4j.org/codes.html#StaticLoggerBinder了解更多详情。??h???9?A@???P VERSIONAPPLICATION_ACL MODIFY_APPVIEW_APP APPLICATION_OWNEcentos(&container_1470297644642_0007_01_000007??stderr0stdout0syslog4142016-108.42016-108.42016-106:30016-108.42016-108.42016-108-3016-108.42016-108-3016-08-3016-08-3016-08-3016-08-2016-1070297644642_0007_01_0000007644642_0007_01_000007 5,main] 抛出错误。现在正在关闭... …
我是Mesos的新手,刚刚在我的测试服务器上设置了mesos和zookeeper.
不幸的是,我一直在我的mesos控制台上收到此错误消息,表明我无法连接到端口5050上的mesos,似乎无法找出原因.
我在下面的屏幕截图中包含了错误
mesos日志文件未指出错误显示的原因.
hadoop ×5
mapreduce ×4
hdfs ×2
java ×2
apache ×1
apache-kafka ×1
apache-nifi ×1
frameworks ×1
hadoop-yarn ×1
junit ×1
mesos ×1
mesosphere ×1
mocking ×1
scala ×1