部署程序,就差最后一步 supervisor 出现问题

2018-06-07 17:10:13 +08:00
 hansonhex
忙活了半天, 就到最后部署了, 结果卡了, 大家帮忙看看, 谢谢了:
配置文件
[unix_http_server]
file=/var/run/supervisor.sock ; (the path to the socket file)
;chmod=0700 ; socket file mode (default 0700)
;chown=nobody:nogroup ; socket file uid:gid owner
;username=user ; (default is no username (open server))
;password=123 ; (default is no password (open server))

;[inet_http_server] ; inet (TCP) server disabled by default
;port=127.0.0.1:9001 ; (ip_address:port specifier, *:port for all iface)
;username=user ; (default is no username (open server))
;password=123 ; (default is no password (open server))

[supervisord]
logfile=/var/run/supervisord.log ; (main log file;default $CWD/supervisord.log)
logfile_maxbytes=50MB ; (max main logfile bytes b4 rotation;default 50MB)
logfile_backups=10 ; (num of main logfile rotation backups;default 10)
loglevel=info ; (log level;default info; others: debug,warn,trace)
pidfile=/var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
nodaemon=false ; (start in foreground if true;default false)
minfds=1024 ; (min. avail startup file descriptors;default 1024)
minprocs=200 ; (min. avail process descriptors;default 200)
;umask=022 ; (process file creation umask;default 022)
;user=chrism ; (default is current user, required if root)
;identifier=supervisor ; (supervisord identifier, default is 'supervisor')
;directory=/tmp ; (default is not to cd during start)
;nocleanup=true ; (don't clean up tempfiles at start;default false)
;childlogdir=/tmp ; ('AUTO' child log dir, default $TEMP)
;environment=KEY="value" ; (key value pairs to add to environment)
;strip_ansi=false ; (strip ansi escape codes in logs; def. false)
[supervisorctl]
serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL for a unix socket
;serverurl=http://127.0.0.1:9001 ; use an http:// url to specify an inet socket
;username=chris ; should be same as http_username if set
;password=123 ; should be same as http_password if set
;prompt=mysupervisor ; cmd line prompt (default "supervisor"
;history_file=~/.sc_history ; use readline history if available

; The below sample program section shows all possible program subsection values,
; create one or more 'real' program: sections to be able to control them under
; supervisor.

;[include]
files = /etc/supervisor/conf.d/*.conf

应用的配置文件
[root@iz8vb6wnpf70v6mckovd7tz etc]# cat supervisor/conf.d/game.conf
[program:game]
command=/usr/local/bin/gunicorn wsgi -c gunicorn.config.py
directory=/var/www/game
autostart=true


再执行
supervisord -c /etc/supervisord.conf
supervisorctl -c /etc/supervisord.conf


重启 supervisor 报错
[root@iz8vb6wnpf70v6mckovd7tz etc]# service supervisor restart
Redirecting to /bin/systemctl restart supervisor.service
Failed to restart supervisor.service: Unit not found.

没有这个进程
supervisorctl restart game
game: ERROR (no such process)

大家看一下应该怎么办呢
8182 次点击
所在节点    Python
11 条回复
zuston
2018-06-07 17:18:29 +08:00
查看一下 game 的运行输出日志啊
FiveDDD
2018-06-07 17:21:35 +08:00
supervisorctl -c /etc/supervisord.conf restart game 试一试
zdt3476
2018-06-07 20:53:46 +08:00
supervisorctl update
bin456789
2018-06-07 20:57:41 +08:00
supervisorctl reread
MartinWu
2018-06-07 21:00:03 +08:00
重启 supervisor 报错
[root@iz8vb6wnpf70v6mckovd7tz etc]# service supervisor restart
Redirecting to /bin/systemctl restart supervisor.service
Failed to restart supervisor.service: Unit not found.

你这里就有问题了。你要是用 supervisord -c /etc/supervisord.conf 来启动进程,就不要用 services 来重启。 建议你 kill 掉 supervisord,再直接用 services 来启动 supervisord。
mcfog
2018-06-07 21:05:13 +08:00
syatemctl 是 systemd 的控制命令,去找 systemd 的手册看看吧,简单说就是要写个 aupervusor 的描述文件扔 /etc
当然你也可以选择野路子手动开进程然后祈祷不需要重启 servers/不 crash
defunct9
2018-06-07 21:22:42 +08:00
开 ssh,让我上去试试
zjp
2018-06-07 21:47:43 +08:00
歪个楼 为什么 python 程序喜欢用 supervisor,除了它本身就是 python 写的原因

正题 似乎楼主没有配置 systemd 去管理 supervisor,先查看下进程先
lzxin1
2018-06-08 00:50:13 +08:00
服务名是 supervisird 而不是 supervisor, 少了个 d

service supervisord restart 试一下
wenzhoou
2018-06-08 07:46:55 +08:00
不是说二本青年都用 tmux 干这事嘛
hello8080
2018-06-08 10:29:09 +08:00
;[include]
你这里都注释了,还怎么加载。当然找不到了

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/461260

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX