在远程服务器上运行beantalkd worker [英] Running beanstalkd worker on a remote server

查看:142
本文介绍了在远程服务器上运行beantalkd worker的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的堆栈设置包括以下内容

Machine1 -主服务器(正在运行的laravel)
Machine2 -laravel代码库的MySql Server
Machine3 -缠豆工人

我在 Machine1 上设置了Supervisord,并添加了以下队列侦听器

My stack set-up consists of the following

Machine1 - Main Server (Running laravel)
Machine2 - MySql Server for the laravel codebase
Machine3 - Beanstalkd worker

I have setup Supervisord on Machine1 and added the following queue listener

[program:queue1]
command=php artisan queue:listen --queue=queue1 --tries=2
...

我的laravel队列配置文件(app/config/queue.php)读取以下内容

My laravel queue config file(app/config/queue.php) reads the following

'beanstalkd' => array(
    'driver' => 'beanstalkd',
    'host'   => '--- Machine3 IP ---',
    'queue'  => 'queue1',
    'ttr'    => 60,
),

我已经在 Machine3 上安装了beantalkd以及Beanstalk控制台,可以看到我的任务被推送到队列并成功执行.但是我不确定 Machine3 是否确实在执行它们,我怀疑的原因是主服务器上的CPU使用率很高,而 Machine3

And I have installed beanstalkd on Machine3 along with Beanstalk console and can see my tasks being pushed to the queue and executing successfully. However I am not sure if Machine3 is actually executing them, and the reason for my suspicion is the High CPU usage on the main server as compared to no spikes in CPU usage on Machine3

我完全关闭了beantalkd服务器,以检查队列是否仍在处理,结果是laravel报告错误,表明它无法连接到beantalkd服务器.

I completely shutdown my beanstalkd Server to check if the queue still processes and the outcome was an error reported by laravel indicating it could not connect to the beanstalkd server.

我读过某个地方,您也需要在Beanstalkd服务器( Machine3 )上安装laravel代码库,这真的是要走的路吗?

I read somewhere that you need to have your laravel codebase on the beanstalkd server(Machine3) too, was that really the way to go?

推荐答案

在运行queue:listen的计算机上进行队列实际处理的计算机.

Whichever machine you run queue:listen on is the machine that does the actual processing of the queue.

目前,您要做的只是将队列存储在 machine3 上,而在 machine1 上进行处理.

At the moment all you are doing is storing the queues on machine3, but processing them on machine1.

因此,如果您想让 machine3 运行queue:listen命令来处理队列,则需要运行该命令.

So you need to have machine3 run the queue:listen command if you want it to process the queue.

这篇关于在远程服务器上运行beantalkd worker的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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