我只是用简单的程序配置来测试我的主管:
[program:test]
command=python -c "print 'hello'"
autostart=true
autorestart=true
exitcodes=1
user=ratdon
stdout_logfile=/opt/log/test.log
stderr_logfile=/opt/log/test.log
Run Code Online (Sandbox Code Playgroud)
启动我的 Supervisord 作为sudo supervisord -n -c /opt/supervisord.conf &. 但产卵几次后,它又停止产卵了。
2016-02-01 11:17:58,973 CRIT Supervisor running as root (no user in config file)
2016-02-01 11:17:58,973 WARN Included extra file "/opt/test.ini" during parsing
2016-02-01 11:17:58,994 INFO RPC interface 'supervisor' initialized
2016-02-01 11:17:58,994 CRIT Server 'inet_http_server' running without any HTTP authentication checking
2016-02-01 11:17:58,995 INFO supervisord started with pid 19644
2016-02-01 11:17:59,998 INFO spawned: 'test' with pid 19648
2016-02-01 11:18:00,026 INFO exited: test (exit status 0; not expected)
2016-02-01 11:18:01,030 INFO spawned: 'test' with pid 19650
2016-02-01 11:18:01,064 INFO exited: test (exit status 0; not expected)
2016-02-01 11:18:03,072 INFO spawned: 'test' with pid 19653
2016-02-01 11:18:03,104 INFO exited: test (exit status 0; not expected)
2016-02-01 11:18:06,108 INFO spawned: 'test' with pid 19657
2016-02-01 11:18:06,138 INFO exited: test (exit status 0; not expected)
2016-02-01 11:18:07,139 INFO gave up: test entered FATAL state, too many start retries too quickly
Run Code Online (Sandbox Code Playgroud)
我希望主管继续重新启动程序,直到我停止主管。
是否可以?如果是的话怎么办?
是否有任何选项可以让主管使用stdout时间戳记录日志,或者我们需要将时间戳本身放入其中stdout?
小智 2
我在 Docker 微服务环境中工作时遇到了相同的用例。就我而言,Nginx 有可能在其动态生成的配置就位之前启动。
目前没有办法让 Supervisord 无限地重新启动服务,直到进程成功启动。
但是,使用该startretries选项有一个可行的解决方法。使用该startretries选项,Supervisord 将重新启动给定的次数或直到进程成功启动。
在我的特定用例中,竞争条件的时间范围不到一秒,因此设置startretries=2就足够了。但是,如果需要,您可以将其设置为更高的值。
[program:test]
startretries=10
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
70973 次 |
| 最近记录: |