- r - 以节省内存的方式增长 data.frame
- ruby-on-rails - ruby/ruby on rails 内存泄漏检测
- android - 无法解析导入android.support.v7.app
- UNIX 域套接字与共享内存(映射文件)
我已经使用数据库设置了 Laravel 队列,并且配置了 Supervisor 使其保持运行,但是它会在一段时间后停止处理队列。
我正在使用 Mail::queue
发送电子邮件。如果我通过 SSH 进入服务器并运行 php/home/my/path/to/artisan --env=production --timeout=240 queue:listen --tries=5
然后它工作正常并且电子邮件发送。但显然我不想通过 SSH 来处理电子邮件,我希望队列全天候 24/7 运行,所以我安装了 supervisor 来管理它。我编辑了我的 supervisord.conf 文件以包含以下程序:
[program:laravel_queue]
command=php /home/my/path/to/artisan --env=production --timeout=240 queue:listen --tries=5
autostart=true
autorestart=true
logfile=/var/log/laraqueue.log
当我启动该程序时,它可以正常发送我的电子邮件。但是一段时间后(通常是第二天),电子邮件将无法发送。我检查了数据库,作业表正在填满。当我通过 SSH 连接到服务器并运行 supervisorctl status
时,我得到:
laravel_queue RUNNING pid 21081, uptime 2 days, 23:18:51
它说 2 天,因为它一直在周末运行,今天(星期一)不工作。显然它没有运行,那么如何让 supervisord 识别它没有运行并重新启动它呢?
如果我使用 supervisorctl restart laravel_queue
手动重启它,因为它没有运行 supervisor 无法停止它并且似乎挂起直到我按下 CTRL + C。此时我得到一个回溯我不明白:
Traceback (most recent call last):
File "/usr/bin/supervisorctl", line 6, in <module>
main()
File "/usr/lib/python2.6/site-packages/supervisor/supervisorctl.py", line 598, in main
c.onecmd(" ".join(options.args))
File "/usr/lib/python2.6/site-packages/supervisor/supervisorctl.py", line 86, in onecmd
return func(arg)
File "/usr/lib/python2.6/site-packages/supervisor/supervisorctl.py", line 467, in do_restart
self.do_stop(arg)
File "/usr/lib/python2.6/site-packages/supervisor/supervisorctl.py", line 433, in do_stop
result = supervisor.stopProcess(processname)
File "/usr/lib64/python2.6/xmlrpclib.py", line 1199, in __call__
return self.__send(self.__name, args)
File "/usr/lib64/python2.6/xmlrpclib.py", line 1489, in __request
verbose=self.__verbose
File "/usr/lib/python2.6/site-packages/supervisor/options.py", line 1309, in request
errcode, errmsg, headers = h.getreply()
File "/usr/lib64/python2.6/httplib.py", line 1064, in getreply
response = self._conn.getresponse()
File "/usr/lib64/python2.6/httplib.py", line 990, in getresponse
response.begin()
File "/usr/lib64/python2.6/httplib.py", line 391, in begin
version, status, reason = self._read_status()
File "/usr/lib64/python2.6/httplib.py", line 349, in _read_status
line = self.fp.readline()
File "/usr/lib64/python2.6/socket.py", line 433, in readline
data = recv(1)
KeyboardInterrupt
再次检查状态报告队列已停止,所以我运行 supervisorctl start laravel_queue
并且我遇到了与运行重启时相同的挂起,但它已经开始处理作业和电子邮件发送。如果我再次按 CTRL + C,我会得到与上面相同的回溯。
我检查了 laraqueue 的日志,把它放了一夜。今天早上我试着发了一封电子邮件,但工作表只是坐在那里等待处理。日志中全是这样的:
X-Powered-By: PHP/5.6.10^M
Content-type: text/html; charset=UTF-8^M
^M
就是这样。只是重复了很多内容。
我查看了 supervisor 日志,它只是报告了 laravel_queue 的成功启动。完成日志是:
2015-10-21 14:25:24,997 INFO /var/tmp/supervisor.sock:Medusa (V1.1.1.1) started at Wed Oct 21 14:25:24 2015
Hostname: <unix domain socket>
Port:/var/tmp/supervisor.sock
2015-10-21 14:25:25,099 CRIT Running without any HTTP authentication checking
2015-10-21 14:25:25,107 INFO daemonizing the process
2015-10-21 14:25:25,108 INFO supervisord started with pid 3407
2015-10-21 14:25:25,115 INFO spawned: 'laravel_queue' with pid 3409
2015-10-21 14:25:26,729 INFO success: laravel_queue entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
将 supervisor 更新到最新版本后,我仍然遇到同样的问题。 laraqueue.log 的内容和之前一样,没什么用。然而,这次主管日志中包含了更多内容:
2015-10-22 10:19:59,454 CRIT received SIGTERM indicating exit request
2015-10-22 10:19:59,454 INFO waiting for laravel_queue to die
2015-10-22 10:19:59,460 INFO stopped: laravel_queue (terminated by SIGTERM)
2015-10-22 10:19:59,460 INFO received SIGCLD indicating a child quit
2015-10-22 10:26:02,019 CRIT Supervisor running as root (no user in config file)
2015-10-22 10:26:02,085 CRIT Server 'inet_http_server' running without any HTTP authentication checking
2015-10-22 10:26:02,092 INFO daemonizing the supervisord process
2015-10-22 10:26:02,093 INFO supervisord started with pid 17268
2015-10-22 10:26:03,105 INFO spawned: 'laravel_queue' with pid 17269
2015-10-22 10:26:04,107 INFO success: laravel_queue entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2015-10-22 10:37:22,157 WARN received SIGTERM indicating exit request
2015-10-22 10:37:22,157 INFO waiting for laravel_queue to die
2015-10-22 10:37:22,163 INFO stopped: laravel_queue (terminated by SIGTERM)
有几个主管收到退出请求并重新启动它的实例,然后日志的末尾位于它停止队列的位置之上,但由于某种原因没有再次启动它。我已经检查了 laravel 日志(在存储/日志中)但是那段时间那里什么都没有。
最佳答案
我在 Laravel 8 和 supervisor 3 上遇到了同样的问题。
我通过重新运行这些命令解决了我的问题:
sudo supervisorctl stop all
sudo supervisorctl reread
sudo supervisorctl update
sudo supervisorctl start all
希望对你有帮助
关于php - Laravel Queue with Supervisor,运行但不处理作业,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33217269/
我已经使用 Gunicorn + Nginx + Supervisor 部署了一个 Flask 应用程序。它不起作用。在线搜索发现了几个类似问题的报告,但没有一个有适合我们情况的解释或解决问题的修复程
一、简介 Supervisor 是一款 Python 开发的进程管理系统,允许用户监视和控制 Linux 上的进程,能将一个普通命令行进程变为后台守护进程,异常退出时能自动重启 详细介绍查阅:Supe
一, 简介 Dockerfile 运行只支持一条命令,当在Docker里要运行多条命令,用supervisor来管理就比较合适了。 Supervisor是一个 Python 开发的 client
我正在使用 Gunicorn 和 Nginx 与主管一起运行 django 项目。一切正常,但是当我对代码进行一些更改时,主管无法识别它,但它仍然读取旧代码。你能帮我么。我试图重新启动 supervi
已关闭。此问题不符合Stack Overflow guidelines 。目前不接受答案。 这个问题似乎不是关于 a specific programming problem, a software
我使用 erlang 作为服务之间的桥梁,我想知道人们对处理断开的连接有什么建议? 我正在从本地文件获取输入并将它们通过管道传输到 AMQP,可以想象 AMQP 代理可能会崩溃。对于这种情况,我想继续
我在哪里可以找到有关如何将动态子进程添加到现有主管的示例( simple_one_for_one 重启策略)? 最佳答案 我做了一些研究,以下是我所拥有的。 首先,这是一个主管的示例回调模块: -mo
我可以为不同的 django-celery 项目使用不同的 supervisor.conf 文件吗? 我在项目本身中为他们两个创建了单独的主管,但主管只与一个一起工作。有什么办法可以分别为它们保存配置
我已经看到了将SupervisorJob传递给CoroutineScope的教程,以避免在子例程之一失败时所有协程作业被取消。 在run3中,我认为将SupervisorJob传递给launch可以获
如何为使用系统上下文创建的两个参与者设置两个不同的主管策略: val exporter = system.actorOf(Props[DataExporter], name = "dataExport
以下是每 2 秒运行 supervisorctl status 的状态预览: [root@docker] ~ # supervisorctl status nginx
编辑:显然脚本确实运行了,但它只是没有启动我的浏览器。仍然不知道为什么。 我正在尝试使用 supervisor 来运行命令/脚本,但我似乎无法让它工作。 我得到了 Pi_Video_looper 的想
我必须运行 laravel 命令 php artisan queue:work --daemon 来运行存储在 Beanstalkd 队列中的作业。 我遇到了两种可能的解决方案: 使用 Supervi
如果我从 apt-get 安装 supervisor 我得到版本 3.0b2-1 如果我运行 sudo service supervisor status 我得到 is running(旧的测试版工作
我正在尝试在主管 (http://supervisord.org/) 的监督下运行流程。 我有两个运行几乎相同环境的环境(Ubuntu 12.04 LTS)。 目前的问题是我尝试在Supervisor
我正在尝试进行自动部署,包括 supervisord 和默认设置路径混淆。 我发现的每个部署方案都使用 /etc/supervisor/supervisor.conf 和 /etc/superviso
Supervisor执行的命令中如何导出环境变量?我第一次尝试: command="export SITE=domain1; python manage.py command" 但主管报告“找不到命令
Docker容器在启动的时候开启单个进程,比如,一个 ssh 或者 apache 的 daemon 服务。 但我们经常需要在一个机器上开启多个服务,这可以有很多方法,最简单的就是把多个启动命令放到
我已经安装并配置了 supervisor。 ps -ax 显示 10 个进程,例如:php/home/vagrant/Sites/mysite/artisan queue:work --tries=1
有人可以解释 Elixir 中的 Supervisor 和 DynamicSupervisor 之间的区别吗? 最佳答案 A DynamicSupervisor is a supervisor des
我是一名优秀的程序员,十分优秀!