[英]How to deactivate output in Hadoop streaming?
我在集群上編寫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
它將說: 哎呀,錯誤streaming.StreamJob:缺少必需的選項:輸出
我可以將輸出重定向到stdout還是完全將其停用?
PS:我是一個糟糕的python程序員,請指出任何使您不舒服的代碼。
您將需要生成一些輸出。 出於不輸出任何內容的願望,請使用
NullOutputFormat
如下:
---outputformat org.apache.mapreduce.lib.NullOutputFormat
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.