与主管一起开始redis

时间:2015-06-09 07:24:46

标签: redis supervisord supervisor

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

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

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

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)

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

2 个答案:

答案 0 :(得分:6)

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

redis.conf中对于较新版本(即3.x),默认设置是禁用守护程序,但它可能已被您的程序包编辑。另外请确保您没有使用将重新生成的新手脚本安装。

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

示例主管配置

答案 1 :(得分:0)

问题

redis-serversupervisord.conf以下无法正常工作

特别是redis-server命令和conf文件位置参数

redis-server --version

Redis server v=2.8.17 sha=00000000:0 malloc=jemalloc-3.6.0 bits=64 build=5b70b85861dcf95e

supervisord.conf

[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

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

Dockerfile

RUN cp -f my_redis.conf /etc/redis/redis.conf &&\

supervisorctl

supervisorctl status

通过命令行进行测试

enter image description here

解决方案

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

就我而言,我用/etc/redis/redis.conf覆盖了my_redis.conf中的默认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

ps。此Redis版本是否存在错误?还是我的conf错误?