HA Gearman作业服务器的最佳实践是什么 [英] What's best practice for HA gearman job servers

查看:109
本文介绍了HA Gearman作业服务器的最佳实践是什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在gearman的主页上,他们提到要与多个作业服务器一起运行,因此,如果一个作业服务器死了,客户端可以选择一个新的作业服务器.根据下面的语句和图表,作业服务器似乎无法相互通信.

From gearman's main page, they mention running with multiple job servers so if a job server dies, the clients can pick up a new job server. Given the statement and diagram below, it seems that the job servers do not communicate with each other.

我们的问题是,在死亡的作业服务器中排队的那些作业将如何处理?这些服务器具有高可用性以确保作业不会因故障而中断的最佳实践是什么?

Our question is what happens to those jobs that are queued in the job server that died? What is the best practice to have high-availability for these servers to make sure jobs aren't interrupted in a failure?

您可以运行多个作业服务器,并使客户端和工作程序连接到为其配置的第一个可用的作业服务器. 这样,如果一个作业服务器死亡,则客户端和工作人员会自动故障转移到另一台作业服务器.您可能不想运行太多的作业服务器,但是拥有两个或三个冗余服务器是一个好主意

You are able to run multiple job servers and have the clients and workers connect to the first available job server they are configured with. This way if one job server dies, clients and workers automatically fail over to another job server. You probably don't want to run too many job servers, but having two or three is a good idea for redundancy.

来源

推荐答案

据我所知,目前尚没有适当的方法来处理此问题,但是只要您同时使用永久队列运行两个作业服务器(使用MySQL或另一个数据存储区-只是不对两个服务器使用相同的实际队列),您只需重启作业服务器即可从数据库中加载其队列.即使服务器已死,这也将允许所有排队的任务提交给可用的工作程序.

As far as I know there is no proper way to handle this at the moment, but as long as you run both job servers with permanent queues (using MySQL or another datastore - just don't use the same actual queue for both servers), you can simply restart the job server and it'll load its queue from the database. This will allow all the queued tasks to be submitted to available workers, even after the server has died.

但是,当作业服务器关闭时,没有自动的方法来执行此操作,因此,如果作业服务器和数据存储都关闭(本地运行的服务器都关闭),任务将一直处于闲置状态,直到重新联机

There is however no automagical way of doing this when a job server goes down, so if both the job server and the datastore goes down (a server running both locally goes down) will leave the tasks in limbo until it gets back online.

仅在启动时读取永久队列(并在提交和完成任务时将其插入/删除).

The permanent queue is only read on startup (and inserted / deleted from as tasks are submitted and completed).

我不确定将这种功能添加到Gearmand所需的复杂性以及是否确实需要它,但是服务器之间的简单添加任务,分发任务,完成任务"通知不应该太复杂以至于无法处理.

I'm not sure about the complexity required to add such functionality to gearmand and whether it's actually wanted, but simple "task added, task handed out, task completed"-notifications between servers shouldn't been too complicated to handle.

这篇关于HA Gearman作业服务器的最佳实践是什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆