Redis - Monit无法正常启动

时间:2014-01-06 01:30:17

标签: redis monit

Monit无法正常启动redis-server。

通过init.d 运行Redis正常工作

$ 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.

通过Monit 运行Redis无法正常运行

(我杀死了Redis进程和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

通过Monit 停止Redis也不起作用

$ 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

我有:

  • Ubuntu 12.04.3 LTS
  • redis的-2.8.2
  • 的monit-5.3.2
  • redis instalation path / etc / redis
  • monit instalation path / etc / monit(从apt-get repo安装)

以下配置文件:

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

2 个答案:

答案 0 :(得分:2)

我遇到了同样的问题,并且没有关于这种情况的讨论。我用另一个解决方案修复了它,它可能与其他人有关,所以我在这里发布它。

在monit配置文件中我有

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

通过以下方式替换修复了问题(使用Ubuntu)

start program = "/usr/sbin/service redis start"
stop  program = "/usr/sbin/service redis stop"

答案 1 :(得分:0)

只需更改/etc/redis dir

的所有者即可
$ chown -R root /etc/redis

并重启monit

$ monit restart

问题已经消失。奇怪。我希望它有所帮助。