Search code examples
redismonit

Redis - Monit does not start properly


Monit can not start redis-server properly.

Running Redis through init.d works correctly:

$ sudo su

$ /etc/init.d/redis_6379 start

$ #=> Starting Redis server...

$ ps aux | grep redis

$ #=> root      8980  0.0  0.0  42128  1964 ?        Ssl  04:56   0:00 /etc/redis/src/redis-server *:6379

$ /etc/init.d/redis_6379 stop

$ #=> Stopping ...

$ #=> Redis stopped

$ #=> (ps aux| grep redis) There's no redis process.

Running Redis through Monit does not work correctly:

(I killed the Redis process and rm /var/run/redis_6379.pid)

$ sudo su

$ monit start redis

$ ps aux | grep redis

$ #=> root      9082  0.0  0.0  35076  1972 ?        Ssl  05:08   0:00 /etc/redis/src/redis-server *:6379

monit.log:

[MSK Jan  6 05:08:14] info     : 'redis' start on user request
[MSK Jan  6 05:08:14] info     : monit daemon at 3947 awakened
[MSK Jan  6 05:08:14] info     : Awakened by User defined signal 1
[MSK Jan  6 05:08:14] info     : 'redis' start: /etc/init.d/redis_6379
[MSK Jan  6 05:08:44] error    : 'redis' failed to start
[MSK Jan  6 05:08:44] info     : 'redis' start action done

Stopping Redis through Monit does not works correclty also:

$ ps aux | grep redis

$ #=> root      9018  0.0  0.0  35076  1968 ?        Ssl  05:02   0:00 /etc/redis/src/redis-server *:6379

$ monit stop redis

$ ps aux | grep redis

$ #=> root      9082  0.0  0.0  35076  1972 ?        Ssl  05:08   0:00 /etc/redis/src/redis-server *:6379

monit.log

[MSK Jan  6 05:10:02] info     : 'redis' stop on user request
[MSK Jan  6 05:10:02] info     : monit daemon at 3947 awakened
[MSK Jan  6 05:10:02] info     : Awakened by User defined signal 1
[MSK Jan  6 05:10:02] info     : 'redis' stop action done

I have:

  • Ubuntu 12.04.3 LTS
  • redis-2.8.2
  • monit-5.3.2
  • redis instalation path /etc/redis
  • monit instalation path /etc/monit (installed from apt-get repo)

And following config files:

https://gist.github.com/itsNikolay/665112df34d2eae09330


Solution

  • Just changes owner of /etc/redis dir

    $ chown -R root /etc/redis
    

    and restart monit

    $ monit restart
    

    The problem is gone. Strange. I wish it helps.