How to do it...

To test the Redis Cluster set up in the previous recipe, we will first start the testing program as a Redis client by the following command:

~$ ruby coding/redis-rb-cluster/consistency-test.rb 192.168.1.59 6380 
1441 R (0 err) | 1441 W (0 err) |  
4104 R (0 err) | 4104 W (0 err) |  
25727 R (0 err) | 25727 W (0 err) | 
... 
  1. Simulating a master down: 
    1. Make the instance I_A crash using the Redis DEBUG SEGFAULT command:
redis@192.168.1.57:~> bin/redis-cli -h 192.168.1.57 -p 6379 -c DEBUG SEGFAULTError: Server closed the connection
    1.  Check the log of the I_A instance:
96013:M 15 Nov 14:49:40.224 # Redis 4.0.1 crashed by signal: 11
    1. Check the output of the testing program:
190927 R (0 err) | 190927 W (0 err) |201012 R ...

Get Redis 4.x Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.