Running beanstalkd worker on a remote server

我只是一个虾纸丫 提交于 2019-12-07 12:22:44

问题


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
...

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

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

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

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.

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


回答1:


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

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

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



来源:https://stackoverflow.com/questions/26465068/running-beanstalkd-worker-on-a-remote-server

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!