Start redis with a supervisor

When redis starts with supervisor, the redis process runs, but in supervisor it shows a rollback.

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

in the admin log this is shown below:

 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) 

anyone can help me, thanks.

+5
source share
2 answers

When using Supervisord to manage server-side programs, such as databases that frequently appear or become daemonized, find the flag in the startup command or in the configuration file. There is an exception to databases such as MySQL, where it is recommended that you use a proxy server to run mysqld_safe and allow it to control auxiliary processes.

In redis.conf for newer versions (i.e. 3.x), the default value is to disable the daemon, but it can be edited by your package. Also, make sure that you do not install a script with an upstart script that will be updated.

Redis configuration file section

 # 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 

Supervisor configs example

+6
source

problem

redis-server does not work with supervisord.conf below

In particular, redis-server with the argument of the location of the conf file

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

Test via command line

enter image description here

Decision

Without the user-defined location of the conf file, everything is going well.

In my case, I /etc/redis/redis.conf default configuration in /etc/redis/redis.conf using my_redis.conf

 [program:redis-server] command=redis-server # JUST REMOVE EXTRA CONF FILE LOCATION, EVERYTHINGS WORK WELL autostart=true autorestart=true user=root stdout_logfile=/var/log/redis/stdout.log stderr_logfile=/var/log/redis/stderr.log 

ps. Is there a bug in this version of Redis? or is my conf wrong?

0
source

All Articles