In this post, we will be talking about how to provide High Availability using Redis and helper tools; Sentinel and Monit.
• First of all, let’s talk about what Sentinel and Monit are and what they do.
• Briefly Sentinel manages all redis instances(slaves and masters). And Monit shows the status of sentinels and redis instances.For more; Sentinel , Monit.
• As an initial state, a master and a slave have to be chosen.
• After that, master.sh should be installed on master instance and member.sh should be installed on slave instance. Necessary scripts are defined below.
• We want to utilize our server as much as we can, so here are the tricks to accomplish this goal;
To Install Master
Edit master.sh file to set configurations (redis version,instance name, port);
To Install Slave
Edit member.sh file to set configurations (redis version,instance name, port, master ip, master port);
Set the somaxconn to unsigned short limit 65535 which is maximum supported connection number by OS.
Above step should be applied to redis.conf and redis-server too. In redis.conf, tcp-backlog should set to 65535 and in redis-server, ulimit should set to 65535 and also this command should be executed.
###Redis Sentinel install
After installing Monit, httpd settings should be updated. Then Redis and Sentinel configurations should be applied into Monit.
update monit config file
Add or update httpd settings
###Apply Redis and Sentinel Configurations into Monit Create redis.conf
In Monit configuration redis.conf is created to watch Redis instances.