我正在测试 EMR 中的工作,每次测试都需要很长时间才能启动。有没有办法让 Amazon EMR 中的服务器/主节点保持活动状态?我知道这可以通过 API 完成。但是,我想知道这是否可以在 aws 控制台中完成?
问问题
1382 次
3 回答
2
您无法从 AWS 控制台执行此操作。引用开发者指南
AWS 管理控制台中的 Amazon Elastic MapReduce 选项卡不支持向作业流添加步骤。
您只能通过 CLI 和 API 执行此操作,方法是创建作业流程,然后向其中添加步骤。
$ ./elastic-mapreduce --create --active --stream
于 2011-02-25T05:28:05.117 回答
1
您无法使用 Web 控制台执行此操作 - 但通过 API 和编程工具,您将能够向长期运行的作业添加多个步骤,这就是我所做的。这样,您可以在同一个长期运行的集群上一个接一个地启动作业,而不必每次都重新创建一个新的。
如果你熟悉 Python,我强烈推荐Boto库。其他 AWS API 工具也允许您执行此操作。
如果您遵循Boto EMR 教程,您会发现一些示例:
只是给你一个想法,这就是我所做的(使用流媒体作业):
# Connect to EMR
conn = boto.connect_emr()
# Start long-running job, don't forget keep_alive setting
jobid = conn.run_jobflow(name='My jobflow',
log_uri='s3://<my log uri>/jobflow_logs',
keep_alive=True)
# Create your streaming job
step = StreamingStep(...)
# Add the step to the job
conn.add_jobflow_steps(jobid, [step])
# Wait till its complete
while True:
state = conn.describe_jobflow(jobid).steps[-1].state
if (state == "COMPLETED"):
break
if (state == "FAILED") or (state == "TERMINATED") or (state == "CANCELLED"):
print >> sys.stderr, ("EMR job failed! Message = %s!") % (state)
sys.exit(1)
time.sleep (60)
# Create your next job here and add it to the EMR cluster
step = StreamingStep(...)
conn.add_jobflow_steps(jobid, [step])
# Repeat :)
于 2012-07-26T22:28:15.937 回答
0
to keep the machine alive start an interactive pig session. Then the machine won't shut down. You can then execute your map/reduce logic from the command line using:
cat infile.txt | yourMapper | sort | yourReducer > outfile.txt
于 2010-06-21T20:16:46.873 回答