[英]Submit Hadoop Jar through Java program
I am new to Hadoop. 我是Hadoop的新手。 Our team is writing a hadoop job scheduler.
我们的团队正在编写一个hadoop作业调度程序。 Currently I have hadoop well installed.
目前我已经安装了hadoop。 I can submit Hadoop job in the command line using
我可以使用命令行提交Hadoop作业
hadoop jar wordcount.jar input output
Now I want to run this command in a java program. 现在我想在java程序中运行此命令。 In other words, using java to do the same thing as
hadoop jar wordcount.jar input output
. 换句话说,使用java来做与
hadoop jar wordcount.jar input output
相同的事情。 Is there any API I can call to submit jobs from Java? 我可以调用任何API来从Java提交作业吗?
Yes, you can use ProcessBuilder or Runtime.exec to execute arbitrary system commands 是的,您可以使用ProcessBuilder或Runtime.exec来执行任意系统命令
EDIT: The solution I proposed is to just launch the hadoop command as you have specified. 编辑:我提出的解决方案是按照您的指定启动hadoop命令。 Hadoop does have an API for launching jobs, discussed in Calling a mapreduce job from a simple java program .
Hadoop确实有一个用于启动作业的API,在一个简单的java程序中调用mapreduce作业时讨论过。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.