Connect to Redis Sentinel to minimize risks

Bizfly Cloud Database is a service that provides database solutions on a cloud computing platform, helping users and businesses implement an effective data management solution, ensuring data integrity recovery in disaster scenarios. It also monitors information related to users’ database management systems, automatically adjusting data storage capacity according to the resource usage needs of the database management system.

Bizfly Cloud Database is a free service provided by Bizfly Cloud during the Beta and trial period. The information related to usage costs is for reference only.


Redis Sentinel is a component of Redis, the in-memory key-value database system. Redis Sentinel provides management, monitoring, and automatic failover capabilities for Redis clusters. Redis Sentinel plays a crucial role in building a highly available distributed Redis system, ensuring that the Redis cluster remains operational continuously and reliably, even in the event of issues with Redis servers. Currently, Bizfly Cloud’s Cloud Database service provides the Redis Sentinel component when customers create a Redis database through port 26379, making it easier to deploy database models.

Connection Guide

First, you need to create a Redis database on the dashboard following the database creation guide here. Once the Redis database is available, you can proceed to create a Secondary Node. Access the database instance management interface for Redis.

Untitled

Select the Nodes tab and then choose Create Secondary Node.

Untitled

Enter the name of the new node and then select update.

Untitled

Testing Guide

Check the result by connecting to Redis through Sentinel using the CLI tool:

redis-cli -h <IP_Public_Primarynode> -p 26379
auth <password>
info sentinel

Untitled

You can further test the Sentinel component through the failover feature with the following code:

import redis

user_connection = redis.Redis(
    host=Redis_host, 
    port=26379, 
    password=password, 
    decode_responses=True)

redis_connect = user_connection.ping

print(redis_connect)

The returned result will be:

True

After shutting down the primary node, the secondary node is promoted to become the primary node, and the connection remains uninterrupted.

Untitled

The returned result from the code will be:

True