【发布时间】:2015-03-29 21:57:48
【问题描述】:
我正在我的集群上编写 Python mapreduce 程序。我的映射器解析数据并将它们存储在 HBase 中。没有减速器,没有输出。
如果需要,下面是代码供参考。
class Mapper:
...
def __init__(...)
...
def start(self, file):
generator = self.read_input(file)
connection = happybase.Connection(Mapper.IP)
self.table = connection.table(Mapper.table_name)
for line in generator:
self.parse(line)
self.write()
self.buffers = []
self.table = None
connection.close()
def read_input(self, file):
...
def parse(self, line):
...
def write(self):
# write buffers into HBase
for cell in self.buffers:
self.table.put(cell[0], cell[1]) <- Into HBase yay
我的问题是:如果我在集群中使用这个命令:
bin/hadoop jar contrib/streaming/hadoop-*streaming*.jar \
-D mapred.reduce.tasks=1 \
-file /home/hduser/mapper.py -mapper /home/hduser/mapper.py \
-input /user/hduser/streamingTest/testFile.csv
它会说:oops, ERROR streaming.StreamJob: Missing required option: output
我可以将输出重定向到标准输出,或者完全停用它吗?
PS:我是一个糟糕的python程序员,任何让你不舒服的代码请指出。
【问题讨论】:
标签: python mapreduce hbase hadoop-streaming