与主管一起开始redis

zim*_*mer 7 redis supervisord

当使用supervisor启动redis时,redis进程正在运行,但是在supervisor中它显示退避.

vagrant@jinming:~$ sudo supervisorctl -c /etc/conf/supervisor/supervisord.conf
redis                            BACKOFF   Exited too quickly (process log may have details)
Run Code Online (Sandbox Code Playgroud)

在主管日志中,它显示如下:

2015-06-09 07:09:28,407 CRIT Supervisor running as root (no user in config file)
2015-06-09 07:09:28,407 WARN Included extra file "/etc/conf/supervisor/conf.d/redis_local.conf" during parsing
2015-06-09 07:09:28,407 INFO RPC interface 'supervisor' initialized
2015-06-09 07:09:28,407 CRIT Server 'unix_http_server' running without any HTTP authentication checking
2015-06-09 07:09:28,407 INFO supervisord started with pid 23191
2015-06-09 07:09:29,410 INFO spawned: 'redis' with pid 23332
2015-06-09 07:09:29,416 INFO exited: redis (exit status 0; not expected)
2015-06-09 07:09:30,418 INFO spawned: 'redis' with pid 23334
2015-06-09 07:09:30,425 INFO exited: redis (exit status 0; not expected)
2015-06-09 07:09:32,429 INFO spawned: 'redis' with pid 23336  
2015-06-09 07:09:32,434 INFO exited: redis (exit status 0; not expected)
2015-06-09 07:09:36,067 INFO spawned: 'redis' with pid 23342
2015-06-09 07:09:36,072 INFO exited: redis (exit status 0; not expected)
2015-06-09 07:09:37,073 INFO gave up: redis entered FATAL state, too many start retries too quickly
2015-06-09 07:11:04,079 CRIT Supervisor running as root (no user in config file)
2015-06-09 07:11:04,079 WARN Included extra file "/etc/conf/supervisor/conf.d/redis_local.conf" during parsing
2015-06-09 07:11:04,080 INFO RPC interface 'supervisor' initialized
2015-06-09 07:11:04,080 CRIT Server 'unix_http_server' running without any HTTP authentication checking
2015-06-09 07:11:04,080 INFO supervisord started with pid 23191
2015-06-09 07:11:05,083 INFO spawned: 'redis' with pid 23486
2015-06-09 07:11:05,089 INFO exited: redis (exit status 0; not expected)
Run Code Online (Sandbox Code Playgroud)

任何人都可以帮助我,谢谢.

Mik*_* S. 6

使用Supervisord管理服务器程序(如经常生成或守护的数据库)时,请在启动命令或配置文件中查找标志.像MySQL这样的数据库有一个例外,建议的做法是使用代理启动mysqld_safe并让它管理子进程.

redis.conf较新的版本(即3.X)默认是禁用程序,但是它可能已经被你的包进行编辑.还要确保没有使用将重新生成的upstart脚本进行安装.

Redis配置文件部分

# By default Redis does not run as a daemon. Use 'yes' if you need it.
# Note that Redis will write a pid file in /var/run/redis.pid when daemonized.
daemonize no
Run Code Online (Sandbox Code Playgroud)

示例主管配置


Jay*_*Lim 6

问题

redis-server不适用于以下supervisord.conf

特别是redis-server带有conf文件位置参数的命令

redis-服务器--版本

Redis server v=2.8.17 sha=00000000:0 malloc=jemalloc-3.6.0 bits=64 build=5b70b85861dcf95e
Run Code Online (Sandbox Code Playgroud)

主管配置文件

[program:redis-server]
command=redis-server /etc/redis/redis.conf # PLEASE NOTE THIS LINE
autostart=true
autorestart=true
user=root
stdout_logfile=/var/log/redis/stdout.log
stderr_logfile=/var/log/redis/stderr.log
Run Code Online (Sandbox Code Playgroud)

my_redis.conf

# By default Redis does not run as a daemon. Use 'yes' if you need it.
# Note that Redis will write a pid file in /var/run/redis.pid when daemonized.
daemonize no
Run Code Online (Sandbox Code Playgroud)

Dockerfile

RUN cp -f my_redis.conf /etc/redis/redis.conf &&\
Run Code Online (Sandbox Code Playgroud)

主管控制

主管状态

通过命令行测试

在此输入图像描述

解决方案

没有自定义conf文件位置,一切正常。

就我而言,我/etc/redis/redis.conf用以下内容覆盖了默认confmy_redis.conf

[program:redis-server]
command=redis-server # JUST REMOVE EXTRA CONF FILE LOCATION, EVERYTHING WORKS WELL
autostart=true
autorestart=true
user=root
stdout_logfile=/var/log/redis/stdout.log
stderr_logfile=/var/log/redis/stderr.log
Run Code Online (Sandbox Code Playgroud)

附:这个redis版本有bug吗?或者我的conf错了?