When programming Zookeeper in Java, Zookeeper client or Curator is used. Zookeeper client is embedded in Zookeeper server library Curator is a wrapper for Zookeeper client, which enables easier programming There are something to consider when programming Zookeeper. The first point is connecting to Zookeeper. Let's suppose that you make a program which connects to … Continue reading Programming Zookeeper – Connecting to Zookeeper
Building Zookeeper cluster
Zookeeper is a cluster management solution. Therefore, Zookeeper needs to be set up as a cluster. If not, it can be the Single Point of Failure. Zookeeper cluster is called "ensemble". How to set up ensemble (based on v3.4.10) Basic config for a single Zookeeper is as follows. To change it into ensemble, add some … Continue reading Building Zookeeper cluster
The use of Zookeeper
Zookeeper was developped to support Hadoop cluster. Afterward, it has become an independent cluster management solution, although it is still used as Hadoop cluster manager. I used Zookeeper as a cache cluster management solution which has nothing to do with Hadoop. Now, I'm showing you some use of Zookeeper. Basic knowledge Zookeeper keeps internal data … Continue reading The use of Zookeeper
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