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 请教:如何用postman调用本地虚拟机区块链接上的合约?
  • ¥15 为什么使用javacv转封装rtsp为rtmp时出现如下问题:[h264 @ 000000004faf7500]no frame?
  • ¥15 乘性高斯噪声在深度学习网络中的应用
  • ¥15 运筹学排序问题中的在线排序
  • ¥15 关于docker部署flink集成hadoop的yarn,请教个问题 flink启动yarn-session.sh连不上hadoop,这个整了好几天一直不行,求帮忙看一下怎么解决
  • ¥15 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集
  • ¥15 C++ 头文件/宏冲突问题解决
  • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
  • ¥50 安卓adb backup备份子用户应用数据失败
  • ¥20 有人能用聚类分析帮我分析一下文本内容嘛