Book Image

Redis 4.x Cookbook

Book Image

Redis 4.x Cookbook

Overview of this book

Redis is considered the world's most popular key-value store database. Its versatility and the wide variety of use cases it enables have made it a popular choice of database for many enterprises. Based on the latest version of Redis, this book provides both step-by-step recipes and relevant the background information required to utilize its features to the fullest. It covers everything from a basic understanding of Redis data types to advanced aspects of Redis high availability, clustering, administration, and troubleshooting. This book will be your great companion to master all aspects of Redis. The book starts off by installing and configuring Redis for you to get started with ease. Moving on, all the data types and features of Redis are introduced in detail. Next, you will learn how to develop applications with Redis in Java, Python, and the Spring Boot web framework. You will also learn replication tasks, which will help you to troubleshoot replication issues. Furthermore, you will learn the steps that need to be undertaken to ensure high availability on your cluster and during production deployment. Toward the end of the book, you will learn the topmost tasks that will help you to troubleshoot your ecosystem efficiently, along with extending Redis by using different modules.
Table of Contents (21 chapters)
Title Page
Dedication
Packt Upsell
Foreword
Contributors
Preface
13
Windows Environment Setup
Index

Testing Redis Cluster


After setting up a Redis Cluster, it's necessary to simulate various kinds of failures to see how the Cluster behaves in the case of any unexpected outage or planned administration. In this recipe, we will test the Redis Cluster built in the previous recipe via a number of failure scenarios. Afterwards, the failover details will also be discussed.

Getting ready…

You need to have finished the Setting up Redis Cluster recipe in this chapter, and you need a host with redis-cli installed as a Redis client to the Cluster. As a summary of the previous recipe, the information of the Cluster is listed in the following table:

Instance name

IP address

Port

ID

Slots

I_A

192.168.1.57

6379

58285fa03c19f6e6f633fb5c58c6a314bf25503f

0-5400

I_A1

192.168.1.59

6379

bc7b4a0c4596759058291f1b8f8de10966b5a1d1

--

I_B

192.168.1.59

6380

2ff47eb511f0d251eff1d5621e9285191a83ce9f

5401-11000

I_B1

192.168.1.58

6380

549b5b261c765a97b74a374fec49f2ccf30f2acd

--

I_C

192.168.1.58

6381

eeeabcab810d500db1d190c592fecbe89036f24f

11001-16383...