本文介绍了应该如何亚马逊SQS使用?导入/流程场景的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要统筹告诉服务器B从服务器A启动一个进程,然后当它完成后,运行在服务器A上,我有一个很难的导入脚本工作如何我应正确使用SQS在这种情况下

I want to co-ordinate telling Server B to start a process from Server A, and then when its complete, run an import script on Server A. I'm having a hard time working out how I should be using SQS correctly in this scenario.

服务器A:主要专用服务器服务器B:云流程服务器

Server A: Main Dedicated ServerServer B: Cloud Process Server

  • 在服务器A通过SNS发送消息到SQS说启动进程
  • 在服务器B上不断轮询SQS为启动进程的信息
  • 在服务器B发现启动进程的SQS消息
  • 在服务器B运行process.sh文件
  • 在服务器B上完成运行process.sh文件
  • 在服务器B将删除SQS启动程序
  • 在服务器B通过SNS发送消息到SQS说开始导入
  • 在服务器A民调不断民调SQS的开始导入信息
  • 在服务器A发现开始导入的SQS消息
  • 在服务器A上运行import.sh
  • 在服务器A上完成运行import.sh
  • 在服务器A中删除开始导入从SQS
  • Server A sends message to SQS via SNS to say "Start Process"
  • Server B constantly polls SQS for "Start Process" message
  • Server B finds "Start Process" message on SQS
  • Server B runs "process.sh" file
  • Server B completes running "process.sh" file
  • Server B removes "Start Process" from SQS
  • Server B sends message to SQS via SNS to say "Start Import"
  • Server A polls constantly polls SQS for "Start Import" message
  • Server A finds "Start Import" message on SQS
  • Server A runs import.sh
  • Server A completes running "import.sh"
  • Server A removes "Start Import" from SQS

这是SQS应如何使用还是我错过了点完全?

Is this how SQS should be used or am I missing the point completely?

推荐答案

您制定什么了将工作在理论,但我离开,直接把邮件放入队列,而是把这些消息给SNS的主题,然后订阅的队列的主题,让他们那里 - 为您提供了更大的灵活性,以改变事情的道路,而不每次触及code,或者是在生产服务器

What you laid out will work in theory, but I am moved away from putting messages directly into queues, and instead put those messages in to SNS topics, and then subscribe the queues to the topics to get them there - gives you more flexibility to change things down the road without every touching the code or the servers that are in production.

对于你现在正在做什么,在SNS片是不必要的,但使用将允许您更改功能,无需触摸你现有服务器的道路。

For the what you are doing now, the SNS piece is unnecessary, but using will allow you to change functionality without touching you existing servers down the road.

例如:需求的变化,并要添加一个进程C也每次启动过程上Sever的B.右跑通了AWS SNS控制台,你可以直接消息的第二个副本到另一个队列揭开序幕是previously不存在,并设置一个服务器C,它从队列(一个扇出模式)。民调

For example: needs change and you want to add a process C that also kicks off every time the 'Start Process' runs on Sever B. Right thru the AWS SNS console you could direct a second copy of the message to another Queue that previously did not exist, and setup a server C that polls from that Queue (a fan out pattern).

另外,我经常喜欢初始部署时要做的就是通知添加到SNS,所以我知道怎么回事,即每'开始进程的事件发生时,我订阅我的手机(或电子邮件地址)的话题所以我得到通知 - 我可以实时的是显示器(或没有)发生。一旦一段时间已经过去后,生产部署,我可以进入AWS控制台,简单地取消我的电子邮件/小区的过程 - 每天不触及任何服务器或code

Also, what I often like to do during initial rollout is add notifications to SNS so I know whats going on, i.e. every time the 'start process' event occurs, I subscribe my cell phone (or email address) to the topic so I get notified - I can monitor in real time what is (or isn't) happening. Once a period of time has gone by after a production deployment, I can go into AWS console and simply unsubscribe my email/cell from the process - without every touching any servers or code.

这篇关于应该如何亚马逊SQS使用?导入/流程场景的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-07 05:20