【问题标题】:Run Laravel queue on production在生产环境中运行 Laravel 队列
【发布时间】:2019-04-30 13:16:55
【问题描述】:


您能否分享您在生产服务器上运行 Laravel queue 的最佳解决方案?

现在我看到了下一个解决方案:

  1. 第一个启动队列:
php artisan queue:work >> /var/log/queue.log &
  1. 添加到 crontab:
10 2 * * * php artisan queue:restart
11 2 * * * php artisan queue:work >> /var/log/queue.log &
  1. 如果服务器上的项目更新:
php artisan down
php artisan queue:restart
#do update
php artisan queue:work >> /var/log/queue.log &
php artisan up

但我担心高负载情况。如果某些工作会卡住怎么办?
也许你有更好的解决方案?

【问题讨论】:

  • 您能否澄清以下内容:您是否在 docker 上运行?还是在独立服务器上?

标签: php laravel-5 queue devops production


【解决方案1】:

您可以设置 laravel 主管自动运行队列,而不是使用 cronjobs

请在文章下方找到更多详细信息,以便在没有 cronjob 的情况下在服务器上自动运行队列

Integration of Laravel Supervisor to process Queues

【讨论】:

  • 在高负载的情况下,您可以将您的作业分成块并为每个块创建单独的作业,也可以增加超时。
猜你喜欢
  • 2020-06-23
  • 1970-01-01
  • 2012-12-26
  • 2011-03-20
  • 2016-10-22
  • 1970-01-01
  • 2018-07-02
  • 2013-08-24
  • 2019-10-07
相关资源
最近更新 更多