To test the Redis Sentinel set up in the previous recipe, take the following steps:
- Triggering a master failover manually:
- 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
-
- 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...
-
- 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 ...