本文介绍了如何在 Amazon Redshift 上执行预定的 SQL 脚本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Redshift 中每小时自动执行一系列 ~10 个查询(可能报告成功/失败).

I have series of ~10 queries to be executed every hour automatically in Redshift (maybe report success/failure).

大多数查询都是对我的表进行聚合.

Most queries are aggregation on my tables.

我尝试将 AWS Lambda 与 CloudWatch Events 结合使用,但 Lambda 函数最多只能存活 5 分钟,而我的查询最多需要 25 分钟.

I have tried using AWS Lambda with CloudWatch Events, but Lambda functions only survive for 5 minutes max and my queries can take up to 25 minutes.

推荐答案

AWS 不提供简单的分布式 cron 样式服务有点奇怪.它对很多事情都有用.有 SWF,但时间/调度方面由用户决定.您可以使用 Lambda/Cloudwatch 来触发 SWF 事件.获得合理的 cron 之类的活动需要大量开销.

It's kind of strange that AWS doesn't provide a simple distributed cron style service. It would be useful for so many things. There is SWF, but the timing/scheduling aspect is left up to the user. You could use Lambda/Cloudwatch to trigger SWF events. That's a lot of overhead to get reasonable cron like activity.

就像评论所说,最简单的方法是运行一个小实例并在那里托管 cron 作业.使用自动缩放组 1 以获得一些可靠性.一种类似但更复杂的方法是使用 elastic beanstalk.

Like the comment says the easiest way would be to run a small instance and host cron jobs there. Use an autoscale group of 1 for some reliability. A similar but more complicated approach is to use elastic beanstalk.

如果您真的想要冗余、可靠性、可见性等,可能值得查看 第三方解决方案,例如Airflow.根据您的偏好语言,还有许多其他语言.

If you really want redundancy, reliability, visibility, etc. it might be worth looking at a third party solution like Airflow. There are many others depending on your language of preference.

这是一个类似问题,提供更多信息.

Here's a similar question with more info.

这篇关于如何在 Amazon Redshift 上执行预定的 SQL 脚本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-13 06:42
查看更多