我有以下脚本:
<?php
$a =isset($_POST['text'])?$_POST['text']:'not yet';
$comm='/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 '.$a.'" -reducer "/usr/bin/python /var/www/DataMining/AnalysisByYear/AnalysisByYear_reducer.py" -input /user/hduser/dataset/final_eval.txt -output /user/hduser/dataset-outputyear';
$mys=exec($comm);
$comm1='/usr/local/hadoop/bin/hadoop dfs -copyToLocal /user/hduser/dataset-outputyear/part-00000 /var/www/year.txt';
$mys1=exec($comm1);
$file = '/var/www/year.txt';
$contents = file($file);
$string = implode($contents);
echo $string;
?>
我试图通过php通过shell执行$ comm和$ comm1命令。但是我没有得到任何结果。请帮助
答案 0 :(得分:0)
首先检查您的apache日志是否存在错误(如果有)并使用hadoop用户运行脚本。