dongpo9071 2019-03-23 18:38
浏览 88

无法从PHP执行Hadoop Jar

I can't execute my Hadoop jar in pseudo distributed (in case you need to see my configuration I follow this tutorial my pseudo distributed settings) from PHP using any PHP function like shell_exec, exec, system. When I tried to execute jar, my browser show loading icon in the tab but when I checked Hadoop app history nothing is running. What make it even worse is there is no error message appear. I have already check my /var/log/apache2/error.log and nothings there.

So this is my experiment for running the code.

//1.Run in the command prompt works perfectly fine.
/usr/local/hadoop-2.9.1/bin/hadoop jar path_to_my_jar_file.jar main_class_name args

number 2,3,4 is all the php code that I type.

//2. Run using shell_exec nothing happens
var_dump(shell_exec("/usr/local/hadoop-2.9.1/bin/hadoop jar path_to_my_jar_file.jar main_class_name args"));

//3. Run using exec I got array(0) { }
$retval = array();
exec("/usr/local/hadoop-2.9.1/bin/hadoop jar path_to_my_jar_file.jar main_class_name args",$retval);
var_dump( $retval);

//4. Run using system I got 1
system("/usr/local/hadoop-2.9.1/bin/hadoop jar path_to_my_jar_file.jar main_class_name args",$retval);
var_dump( $retval);

Additional Note:

I found this Running MapReduce job written in Java through my PHP web page question but I don't think I have a permission problem since I can execute this.

shell_exec("/usr/local/hadoop-2.9.1/bin/hadoop fs -mkdir /test");

I even tried to change apache user but still not working. Am I missing something? Thanks in advanced :)

UPDATE 1

Deleting this property in mapred-site.xml make php exec working but I can't see the mapreduce progress in resource manager (localhost:8088) and I also need it.

<property>
    <name>mapreduce.framework.name</name>
    <value>yarn</value>
    <description>MapReduce framework name</description>
</property>
  • 写回答

1条回答

  • douzhou7656 2019-03-24 09:03
    关注

    In case somebody get the same issue it's because Hadoop configuration. I change my configuration with this tutorial link. After that you will get HDFS permision problem which can be solved by this one how to add user in supergroup of hdfs in linux? [closed].

    评论

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器