Redis manages replication offset between master and slaves. If you type in "INFO REPLICATION" at redis-cli, the following output comes out. For the above result, offset number can vary depending on each environment. But slave0's offset should be equal or similar to master_repl_offset. The gap between master_repl_offset and slave's offset is the amount which is … Continue reading Redis replication gap tuning
Category: Redis
Tips on developing with Jedis
When developing Java client, Jedis or Lettuce is used. Among them, Jedis is a lightweight Redis java client. There are pros and cons for Jedis. (As of this writing, 3.0.0-m1 is the latest) Pros Lightweight and faster than Lettuce API is easy and intuitive Cons Supports Redis 2 and 3 (Redis 4 is not supported … Continue reading Tips on developing with Jedis
Redis architecture for production
Redis is a very fast cache server. But in production, there is something to consider. Redis works in single thread To be exact, Redis is a multi threaded server. But the main logic runs in a single thread. For the following single Redis process when I check it's threads The result shows that a Redis … Continue reading Redis architecture for production
Internal working of Sentinel
This post is based on Redis 4.0.6. Main source of Sentinel is sentinel.c. When a Redis process is run in sentinel mode, sentinelTimer() is called. Inside it, all Sentinel's logic flows. The way to recognize the other Sentinel At initial Sentinel config, there is no info for the other Sentinels. There are only options for … Continue reading Internal working of Sentinel
Important Sentinel options
At the previous post, I wrote about setting up Sentinel. This post explains some important options for a production system. The following is a sample Sentinel config. (based on Redis 4.0.x) You can check full documentation here. sentinel monitor format : sentinel monitor <master-name> <ip> <redis-port> <quorum> master-name : master alias which is used as … Continue reading Important Sentinel options
Managing Redis replication with sentinel
Setting up Redis replication is simple. But to support high availability, we need to set up sentinel. Sentinel's main functions are as follows. To monitor master and slave state If a master is down, sentinel promotes a new master among slaves (automatic fail over) If the old master runs again, sentinel changes it's role as … Continue reading Managing Redis replication with sentinel
Setting Redis replication
Redis supports 1:N master-slave replication. Communcation between them is bi-directional. The following is step by step procedure. (Tested on version 4.0.6) Test environment 2 Redis are running on a host. One is master (port : 6379) and another is slave (port : 6479) Setting up replication Setting up replication happens only at slaves. The following … Continue reading Setting Redis replication
Redis configuration for standalone mode
Running redis-server without any options is good for test, but not enough for production environment. To customize it, you need to build configuration file. The following options are from version 4.x. And you can refer full documentation here. Basic options for standalone mode bind some_ip # If you do not set bind ip, then Redis … Continue reading Redis configuration for standalone mode
Installing Redis on Linux
We can install Redis on Linux by using pkg manager (i.e. yum on RHEL). But it is difficult to get the latest version in rpm. So I prefer to install it by compiling latest source code. The following is step by step procedure. (Tested on 4.0.6) 1. To download source code You can download the … Continue reading Installing Redis on Linux