在浏览器中执行hadoop命令

46qrfjad  于 2021-06-04  发布在  Hadoop
关注(0)|答案(1)|浏览(481)

我遵循了著名的迈克尔诺尔教程http://www.michael-noll.com/tutorials/running-hadoop-on-ubuntu-linux-single-node-cluster/ 安装 hadoop 在单个节点中。
现在我想通过php通过浏览器执行以下命令

usr/local/hadoop/bin/hadoop jar /usr/local/hadoop/contrib/streaming/hadoop-*streaming*.jar -mapper "/usr/bin/python /var/www/DataMining/AnalysisByYear/AnalysisByYear_mapper.py 2011" -reducer "/usr/bin/python /var/www/DataMining/AnalysisByYear/AnalysisByYear_reducer.py" -input /user/hduser/dataset/final_eval.txt -output /user/hduser/dataset-outputyear

我用的是 exec() 指挥 php 执行它,但它没有显示任何结果。
在本教程中,hduser获得了hadoop的所有权。但是,浏览器以用户身份登录www数据。因此它无法执行。我想这就是错误所在。是否可以以任何方式执行脚本?
namenode日志如下所示:

2013-11-18 14:54:45,712 ERROR org.apache.hadoop.security.UserGroupInformation: PriviledgedActionException as:www-data cause:org.apache.hadoop.security.AccessControlException: Permission denied: user=www-data, access=WRITE, inode="staging":hduser:supergroup:rwxr-xr-x
2013-11-18 14:54:45,712 INFO org.apache.hadoop.ipc.Server: IPC Server handler 1 on 54310, call mkdirs(/app/hadoop/tmp/mapred/staging/www-data/.staging, rwx------) from 127.0.0.1:40876: error: org.apache.hadoop.security.AccessControlException: Permission denied: user=www-data, access=WRITE, inode="staging":hduser:supergroup:rwxr-xr-x
org.apache.hadoop.security.AccessControlException: Permission denied: user=www-data, access=WRITE, inode="staging":hduser:supergroup:rwxr-xr-x
    at org.apache.hadoop.hdfs.server.namenode.FSPermissionChecker.check(FSPermissionChecker.java:199)
    at org.apache.hadoop.hdfs.server.namenode.FSPermissionChecker.check(FSPermissionChecker.java:180)
    at org.apache.hadoop.hdfs.server.namenode.FSPermissionChecker.checkPermission(FSPermissionChecker.java:128)
    at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.checkPermission(FSNamesystem.java:5468)
    at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.checkAncestorAccess(FSNamesystem.java:5442)
    at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.mkdirsInternal(FSNamesystem.java:2209)
    at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.mkdirs(FSNamesystem.java:2178)
    at org.apache.hadoop.hdfs.server.namenode.NameNode.mkdirs(NameNode.java:857)
    at sun.reflect.GeneratedMethodAccessor13.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.hadoop.ipc.RPC$Server.call(RPC.java:578)
    at org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:1393)
    at org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:1389)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.Subject.doAs(Subject.java:396)
    at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1149)
    at org.apache.hadoop.ipc.Server$Handler.run(Server.java:1387)
iyr7buue

iyr7buue1#

我使用的解决方案是以hduser身份启动apache服务器。

相关问题