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].

    评论

报告相同问题?

悬赏问题

  • ¥50 易语言把MYSQL数据库中的数据添加至组合框
  • ¥20 求数据集和代码#有偿答复
  • ¥15 关于下拉菜单选项关联的问题
  • ¥20 java-OJ-健康体检
  • ¥15 rs485的上拉下拉,不会对a-b<-200mv有影响吗,就是接受时,对判断逻辑0有影响吗
  • ¥15 使用phpstudy在云服务器上搭建个人网站
  • ¥15 应该如何判断含间隙的曲柄摇杆机构,轴与轴承是否发生了碰撞?
  • ¥15 vue3+express部署到nginx
  • ¥20 搭建pt1000三线制高精度测温电路
  • ¥15 使用Jdk8自带的算法,和Jdk11自带的加密结果会一样吗,不一样的话有什么解决方案,Jdk不能升级的情况