20,808
社区成员
发帖
与我相关
我的任务
分享
bin/hadoop jar contrib/streaming/hadoop-streaming-1.2.1.jar -input input -output output -mapper /bin/cat -reducer Reduce.py -file Reduce.py
#!/usr/bin/Python
import sys;
def main(argv):
line = sys.stdin.readline();
try:
while line:
line = line[:-1];
fields = line.split("\t");
print fields[0];
line = sys.stdin.readline();
except "end of file":
return None
if __name__=="__main__":
main(sys.argv)
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!-- Put site-specific property overrides in this file. -->
<configuration>
<property>
<name>mapred.job.tracker</name>
<value>127.0.0.1:9001</value>
</property>
</configuration>
core-site.xml的配置
<configuration>
<property>
<name>fs.default.name</name>
<value>hdfs://127.0.0.1:9000</value>
</property>
</configuration>
hdfs-site.xml
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!-- Put site-specific property overrides in this file. -->
<configuration>
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
</configuration>
就这么多配置了。
[/quote]
我执行成功了,并且将python文件就放置在hadoop根目录中。你的/tmp目录下有什么东西,能找到/tmp/hadoop-xxx/mapred/local/taskTracker及其子目录吗[/quote]
你启动hadoop的命令是什么??、[/quote]
你jps一下,看看守护进程都启动了吗,使用start-all.sh启动所有进程,你不会什么也没启动吧[/quote]
5个进程都启动了。
不然程序肯定启动时候就报错,而不是在日志文件中报那么多错误。
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!-- Put site-specific property overrides in this file. -->
<configuration>
<property>
<name>mapred.job.tracker</name>
<value>127.0.0.1:9001</value>
</property>
</configuration>
core-site.xml的配置
<configuration>
<property>
<name>fs.default.name</name>
<value>hdfs://127.0.0.1:9000</value>
</property>
</configuration>
hdfs-site.xml
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!-- Put site-specific property overrides in this file. -->
<configuration>
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
</configuration>
就这么多配置了。
[/quote]
我执行成功了,并且将python文件就放置在hadoop根目录中。你的/tmp目录下有什么东西,能找到/tmp/hadoop-xxx/mapred/local/taskTracker及其子目录吗[/quote]
你启动hadoop的命令是什么??、[/quote]
你jps一下,看看守护进程都启动了吗,使用start-all.sh启动所有进程,你不会什么也没启动吧