Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it recommended to run redis using Supervisor

Is it a good practice to run redis in production with Supervisor?

I've googled around, but haven't seen many examples of doing so. If not, what is the proper way of running redis in production?

like image 628
MLister Avatar asked Dec 26 '22 17:12

MLister


2 Answers

I personally just use Monit on Redis in production. If Redis crash Monit will restart it but more importantly Monit will be able to monitor (and alert when a threeshold is reach) the amount of RAM that Redis currently takes (which is the biggest issue)

Configuration could be something like this (if maxmemory was set to 1Gb in Redis)

check process redis
  with pidfile /var/run/redis.pid
  start program = "/etc/init.d/redis-server start"
  stop program = "/etc/init.d/redis-server stop"
  if 10 restarts within 10 cycles
    then timeout
  if failed host 127.0.0.1 port 6379 then restart
  if memory is greater than 1GB for 2 cycles then alert
like image 96
FGRibreau Avatar answered Jan 07 '23 12:01

FGRibreau


Well..it depends. If I were do use redis under daemon control I would use runit. I do use monit but only for monitoring. I like to see the green light.

However, for redis to exploit the true power, you dont run redis as a deamon esp a master. If a master goes down, you will have to switch a slave to a master. Quit simply, I just shoot the node in the head and I have a chef recipe bring up a new node.

But then again....it also depends on how often you snapshot. I do not snapshot thus no need for deamon control.

People use reids for brute force speed. that means not writing to disk and keep all data in ram. If a node goes down...and you dont snapshot...data is lost.

like image 38
Tampa Avatar answered Jan 07 '23 11:01

Tampa