O'Reilly logo

Redis 4.x Cookbook by Zuofei Wang, Pengcheng Huang

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

How to do it...

To test the Redis Sentinel set up in the previous recipe, take the following steps:

  1. Triggering a master failover manually:
    1. Connect to one of the Sentinels using redis-cli; here we are connecting to Sentinel-2 (192.168.0.32):
192.168.0.32:26379> SENTINEL FAILOVER MYMASTEROK
    1. Verify the old master 192.168.0.31 has been failed over and is now a slave:
192.168.0.31:26379> INFO REPLICATION# Replicationrole:slavemaster_host:192.168.0.33master_port:6379master_link_status:up...
    1.  Examine the logs of Sentinel-2:
2283:X 12 Nov 15:35:14.782 # Executing user requested FAILOVER of 'mymaster'2283:X 12 Nov 15:35:14.782 # +new-epoch 12283:X 12 Nov 15:35:14.782 # +try-failover master mymaster 192.168.0.31 63792283:X 12 Nov 15:35:14.789 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required