Whether you are new to Linux or you have been using it for years, it is important to know how to get the most out of your system. A great way to start is by learning about the available slots. We will take a look at the slots in the latest version of Linux, called “Jessie”, and show you how to configure them. You’ll also find out how to perform a cluster check, which will allow you to ensure that all of your nodes are working together to configure slots.
All 16384 slots covered
Getting all of the 16384 slots covered by slot1357 seems like a tall order. But the Redis neophyte isn’t the only one with the unenviable task of arranging their data in one central location. The aforementioned cluster has a couple of tricks up its sleeve. It’s smart enough to know which slots to tuck away and which ones to make room for. The result is a more manageable amount of data per node, and an overall better service to your customers. Moreover, all of this is backed by a robust set of tools and a svelte deployment strategy that makes Redis-based clusters a breeze to manage.
A Redis-based cluster is made up of multiple master nodes, each of which can serve a minimum of one slot. To make things a little easier on you, the database has a built-in auto-partitioning algorithm that intelligently organizes your data. To make things even more seamless, the cluster also supports automatic failover and failsafe recovery, should the worst come to worst.
Nodes agree about slots configuration
Having nodes agree about slot configuration is a prerequisite for a Redis Cluster to function as advertised. This is done via a conflict resolution algorithm, which enforces different config epochs for each node.
There are a few things to note in the process. First, every node in a cluster should know what hash slots are and who is serving them. This is important because unassigned slots can cause multi-key operations to fail. Second, resharding can cause slot configurations to change. It is not always possible to update multiple slots at once, so remapping them is a simpler solution.
The most important thing to remember is that the Redis Cluster is capable of handling 16384 slots. Using this number, you can create a master that serves 0-1364,5461-6826,10923-12287 (4096 slots) as its cache. You can also set up slaves to serve the same slot.
The Redis Cluster also has an alternative to the CLUSTER NODES command. Rather than parsing through a long list of commands to find what you need, you can use the -c option to activate basic cluster support. This will allow you to inspect the information about nodes. You will also be able to perform basic set/get operations.
Performing cluster check
Performing a cluster check on slot 1357 is a simple and fast way to check if the Redis instances are configured correctly. If not, you can re-configure them. The following command will list the slots and the Redis instances that are configured.
This command also works with Redis Cluster client libraries. After receiving the redirection, the client libraries will update the map of the slots and the Redis instances. This can be helpful for load balancers. However, if you want to use this command with the Redis Cluster client libraries, you must configure your client to connect to the same endpoint as the CLUSTER SLOTS command. If you want to use this command with a load balancer, you can set the endpoint as IP or hostname. You can also set the preferred endpoint to NULL to indicate that you do not know what endpoint you are connecting to.
In addition to slots, the Redis Cluster client libraries also update the map of Redis instances by sending a command to the likely correct instance. In addition, CLUSTER SHARDS is a replacement for CLUSTER SLOTS.