我正在配置Monit來監視Redis和Redis Sentinel。但是每次運行Monit時,都會記錄Redis和Redis Sentinel未運行並嘗試運行它們,儘管它們都已完成。它無法啓動Redis進程。Monit不能與Redis配合使用
儘管它對於系統檢查和nginx以及其他一些進程來說是完美的。
版本:
Redis: Redis server v=2.8.4 sha=00000000:0 malloc=jemalloc-3.4.1 bits=64 build=a44a05d76f06a5d9
Monit: version 5.6
這裏是我的Redis monit的配置(Redis的哨兵具有幾乎相同的配置):
# redis
check process redis with pidfile /var/run/redis-server.pid
group cache
group redis
start program = "/etc/init.d/redis-server start"
stop program = "/etc/init.d/redis-server stop"
if failed host 127.0.0.1 port 6379 then restart
if totalmem > 500 Mb then alert
if cpu > 60% for 2 cycles then alert
if cpu > 98% for 5 cycles then restart
if 2 restarts within 2 cycles then alert
depend redis_bin
depend redis_rc
check file redis_bin with path /usr/bin/redis-server
group redis
include /etc/monit/templates/rootbin
check file redis_rc with path /etc/init.d/redis-server
group redis
include /etc/monit/templates/rootbin
這裏是monit的的日誌:
[PKT Aug 19 17:00:07] error : 'redis' process is not running
[PKT Aug 19 17:00:07] info : 'redis' trying to restart
[PKT Aug 19 17:00:07] info : 'redis' start: /etc/init.d/redis-server
[PKT Aug 19 17:00:37] error : 'redis' failed to start
我認爲這個問題的原因是其他正在工作的進程是由根和所有th e目錄和bin文件。但是,與Redis相關的所有內容都是由用戶「redis」中的「redis」自己創建的。這就是爲什麼Monit無法啓動或停止Redis。
但我已經試圖通過在開始添加用戶使用它,並停止設置是這樣的:
start program = "/etc/init.d/redis-server start"
as uid redis and gid redis
stop program = "/etc/init.d/redis-server stop"
as uid redis and gid redis
但是,這也不能工作。
我在這裏做錯了什麼?與Monit一起監控Redis的正確方法是什麼?