问题描述
目前我有,我把我所有的cronjobs在亚马逊的单台服务器。我想消除这种单点故障,并公开所有我的任务为Web服务。我想后面的VPC ELB服务暴露在调用时将运行任务的几台服务器。
Currently I have a single server in amazon where I put all my cronjobs. I want to eliminate this single point of failure, and expose all my tasks as web services. I'd like to expose the services behind a VPC ELB to a few servers that will run the tasks when called.
有一些服务,亚马逊(AWS)提供了可在预定的时间间隔运行中反复出现的作业(真的叫一个web服务)?我真的希望能够保持的时间/日期规范方面的cron功能,但农场驾驶者的HA(即在合适的时间调用端点的东西),以AWS。
Is there some service that Amazon (AWS) offers that can run a reoccurring job (really call a webservice) at scheduled intervals? I'd really like to be able to keep the cron functionality in terms of time/day specification, but farm out the HA of the driver (thing that calls endpoints at the right time) to AWS.
我喜欢SQS提供网络端点(S),但我可以告诉你不能安排他们。 SWF似乎并没有成为一个不错的选择无论是。
I like how SQS offers web endpoint(s), but from what I can tell you cant schedule them. SWF doesn't seem to be a good fit either.
推荐答案
更新2015年10月 - AWS announced发明发布会:在LAMBDA在其2015年重新排定功能的支持。有了这个功能,用户可以使用一个cron的语法按计划执行lambda函数。该 LAMBDA文档展示使用Python来执行计划的一个例子事件。
Update October 2015 - AWS announced support for scheduled functions in Lambda at its 2015 re:Invent conference. With this feature users can execute Lambda functions on a scheduled basis using a cron-like syntax. The Lambda docs show an example of using Python to perform scheduled events.
lambda函数目前无法访问VPC资源,但AWS宣布,该功能将在2015年年底。
Lambda functions cannot currently access VPC resources, though AWS has announced that the feature will be available by the end of 2015.
目前,该计划的lambda可以运行在5分钟的最小分辨率。
Currently, the minimum resolution that a scheduled lambda can run at is 5 minutes.
原来的答复,保存为后人。的
由于埃里克·哈蒙德和其他人说,对于计划任务的原生AWS服务。只有中提到的其他答案变通方法,并半的解决方案。
As Eric Hammond and others have stated, there is no native AWS service for scheduled tasks. There are only workarounds and half solutions as mentioned in other answers.
要回顾一下当前的选项:
To recap the current options:
- 启动和停止的时间表,如由埃里克·哈蒙德。 单实例自动定标组
- 使用简单的工作流服务计时器,这是不是在所有直观。这案例研究提到,JPL使用SWF建立分布式的cron,但目前还没有实施细则。还有一个引用 code例如的埋在SWF code样本。
- 在使用类似 cronlock 运行它自己。
- 使用类似的不可靠的镇时钟(UTC)运行在lambda函数时间表。请记住,LAMBDA目前还不能一个VPC 中访问资源
- The single-instance autoscale group that starts and stops on a schedule, as described by Eric Hammond.
- Using a Simple Workflow Service timer, which is not at all intuitive. This case study mentions that JPL used SWF to build a distributed cron, but there are no implementation details. There is also a reference to a code example buried in the SWF code samples.
- Run it yourself using something like cronlock.
- Use something like the Unreliable Town Clock (UTC) to run Lambda functions on a schedule. Remember that Lambda cannot currently access resources within a VPC
希望一个更好的解决方案即将发布。
Hopefully a better solution will come along soon.
这篇关于在AWS没有cron运行计划任务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!