在hadoop多集群环境中运行nutch时出错(error while running nutch on hadoop multi cluster environment)
我在hadoop多集群环境中运行nutch。
使用以下命令执行nutch时,Hadoop会抛出错误
$ bin / hadoop jar /home/nutch/nutch/runtime/deploy/nutch-1.5.1.job org.apache.nutch.crawl.Crawl urls -dir urls -depth 1 -topN 5
错误:线程“main”中的异常java.io.IOException:不是文件:hdfs:// master:54310 / user / nutch / urls / crawldb at org.apache.hadoop.mapred.FileInputFormat.getSplits(FileInputFormat.java: 170)atg.apache.hadoop.mapred.JobClient.submitJob(JobClient.java:515)atg.apache.hadoop.mapred.JobClient.runJob(JobClient.java:753)at com.bdc.dod.dashboard.BDCQueryStatsViewer .run(BDCQueryStatsViewer.java:829)位于sun的com.bdc.dod.dashboard.BDCQueryStatsViewer.main(BDCQueryStatsViewer.java:796)的org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:65)。在sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)的sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)的java.lang.reflect.Method.invoke上的reflect.NativeMethodAccessorImpl.invoke0(Native Method)方法.java:585)org.apache.hadoop.util.RunJar.main(RunJar.java:155)
我尝试了解决这个问题的可能方法并解决了所有问题,例如在/ local / conf路径等中设置http.agent.name。我之前安装过,它很顺利。
任何人都可以提出解决方案吗?
顺便说一下,我按照链接进行安装和运行。
I am running nutch on hadoop multi cluster environment.
Hadoop is throwing an error when nutch is being executed using the following command
$ bin/hadoop jar /home/nutch/nutch/runtime/deploy/nutch-1.5.1.job org.apache.nutch.crawl.Crawl urls -dir urls -depth 1 -topN 5
Error: Exception in thread "main" java.io.IOException: Not a file: hdfs://master:54310/user/nutch/urls/crawldb at org.apache.hadoop.mapred.FileInputFormat.getSplits(FileInputFormat.java:170) at org.apache.hadoop.mapred.JobClient.submitJob(JobClient.java:515) at org.apache.hadoop.mapred.JobClient.runJob(JobClient.java:753) at com.bdc.dod.dashboard.BDCQueryStatsViewer.run(BDCQueryStatsViewer.java:829) at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:65) at com.bdc.dod.dashboard.BDCQueryStatsViewer.main(BDCQueryStatsViewer.java:796) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.apache.hadoop.util.RunJar.main(RunJar.java:155)
I tried with possible ways of solving this and fixed all the issues like setting http.agent.name in /local/conf path etc. And I installed earlier and it was smooth.
Can anybody suggest a solution?
By the way, I followed link for installing and running.
原文:https://stackoverflow.com/questions/13514429
最满意答案
我真的不明白需要检查我是否在UI或后台线程中。 如果我跳过检查怎么办?
使用
Dispatcher
并检查您是否在UI或后台线程上的原因是因为WPF要求只能在创建它们的线程上访问控件。 原因是因为控件不是线程安全的。 如果你没有做多线程(即你的所有代码都在主线程上),那么你不必担心这一点。 WinForms也有同样的限制。如果您尝试从不同于创建它的线程访问控件,您将得到一个
InvalidOperationException
。此外,下面的代码......并没有真正做任何事情,例如。 设定值。 所以如果我不调试它会做什么?
编译发布版本时,
Debug.Assert
(和您的VerifyCalledOnUIThread
方法)甚至不会出现在代码中,所以不会发生任何事情。I don't really understand the need to check if I am in the UI or Background thread. what if i skip the checks.
The reason for using the
Dispatcher
and checking if you're on the UI or background thread is because of WPF's requirement that controls only be accessed on the thread they were created on. The reason for this is because the controls are not thread-safe. If you're not doing multithreading (i.e. all of your code is on the main thread), then you don't have to worry about this. WinForms has this same limitation.If you try to access a control from a different thread than the one it was created on, you'll get an
InvalidOperationException
.Also, the code below...does not really do anything, eg. set values. So if I am not debugging will it do anything at all?
When compiling a release build,
Debug.Assert
(and yourVerifyCalledOnUIThread
method) will not even appear in the code, so no, nothing will happen.
相关问答
更多-
逐个回答你的每个问题: 不完全的; 您应该只在必要时调用UI线程。 见#2。 是的,这很重要。 你不应该自动Invoke一切。 关键是只在必要时调用UI线程。 为此,您可以使用Dispatcher.CheckAccess方法。 那是对的。 也是正确的,是的,你确实会面临程序响应性较差的风险。 大多数情况下,您不会看到严重的性能下降(我们正在谈论上下文切换的毫秒数),但您应该只在必要时进行Invoke 。 这就是说,在某些方面它是不可避免的,所以不,我不会说这是不好的做法。 这只是解决您偶尔会遇到的问题的一种 ...
-
下列中不属于面向对象的编程语言的是?[2022-05-30]
a -
WPF / WinForm创建和使用窗口,它对单线程具有亲和力。 控制台不使用窗口,它只是输出/回复字符串。 它是“通过窗口开发的设计”。 WPF/WinForm create and use window, which has affinity on single threading. console don't use window, it just output/reply string. it's "by design of window development".
-
我真的不明白需要检查我是否在UI或后台线程中。 如果我跳过检查怎么办? 使用Dispatcher并检查您是否在UI或后台线程上的原因是因为WPF要求只能在创建它们的线程上访问控件。 原因是因为控件不是线程安全的。 如果你没有做多线程(即你的所有代码都在主线程上),那么你不必担心这一点。 WinForms也有同样的限制。 如果您尝试从不同于创建它的线程访问控件,您将得到一个InvalidOperationException 。 此外,下面的代码......并没有真正做任何事情,例如。 设定值。 所以如果我不调 ...
-
比如说一台4核机器上的10个线程太多了。 如果它们像预编译查询那样受计算限制,则它们都将争夺cpu时间并使整个机器无响应。 我建议你使用Environment.ProcessorCount来找出有多少核心可用,并且一次只启动(该数字-1)线程。 您可以优先考虑哪些工作首先运行,并将其他工作排列为延续。 这将使一个核心免费为您的UI线程服务,并使应用程序再次响应。 10 threads is too many on say a 4-core machine. If they are compute-bound ...
-
谷歌是你的朋友:) http://www.codeproject.com/KB/user-controls/AlternateMultithreadedGUI.aspx http://srtsolutions.com/blogs/charliesears/archive/2008/07/23/multithreading-in-c.aspx 这里有很多例子: http : //www.c-sharpcorner.com/Articles/ArticleListing.aspx?SectionID = 1&S ...
-
在复杂/单窗口WPF应用程序中使用Thread的最佳方法(Best way to use Thread in a complex/single window WPF application)[2023-09-04]
所以我对此进行了一些搜索。 一个应用程序可以在不同的线程中创建不同的窗口或页面:从这里获取的代码片段 private void OnCreateNewWindow( object sender, RoutedEventArgs e) { Thread thread = new Thread(() => { Window1 w = new Window1(); w.Show(); w.Closed += (sender2, e2) => ... -
任务是计划以某种方式运行的工作的抽象。 它不一定是CPU密集型的。 通常,当你创建一个Task ,它使用默认的调度器,它在线程池中调度它(这意味着它不会在UI线程上)。 您可以使用TaskScheduler.FromCurrentSynchronizationContext创建一个将工作发布到UI线程的调度器。 要通过任务实现类似于BackgroundWorker的行为,可以使用: var syncScheduler = TaskScheduler.FromCurrentSynchronizationCon ...
-
在WPF应用程序中使用UWP UI(Use UWP UI in WPF Application)[2022-03-09]
今天不支持此功能。 Windows.UI.XAML。*目前只能在UWP应用程序进程中使用。 但是,在今年早些时候的BUILD2017上,宣布计划在未来的Windows 10更新中对此进行支持: https://channel9.msdn.com/Events/Build/2017/B8100 UPDATE 1/31/2019 Coming back to this to update my answer. As of Windows 10 update 1809 (build 17763+) this is ... -
我们找到了一篇有趣的文章,帮助我们解决了这个问题。 主机视觉 We have found an interesting Article that helped us to solve the problem. Host Visual