Вопрос

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

Это было полезно?

Решение 2

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.

Другие советы

I had the same problem, and there is no mutch talk about this situation around. I fixed it with another solution, it may concern someone else so I post it here.

in monit configuration file I had

start program = "/etc/init.d/redis start"
stop  program = "/etc/init.d/redis stop"

Replacing by the following fixed the problem (with Ubuntu)

start program = "/usr/sbin/service redis start"
stop  program = "/usr/sbin/service redis stop"
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top