Redis Replication with Sentinel
In this guide, we will walk you through setting up your first database cluster running on Redis replication with Sentinel using ClusterControl. By the end of this tutorial, you will have a fully operational database cluster that you can monitor, manage, and scale using ClusterControl.
Redis is an open-source, in-memory data store that combines the speed of a cache with the flexibility of a database and the messaging capabilities of a broker. It holds data entirely in RAM for sub-millisecond read and write performance, while offering optional persistence to disk so your datasets survive restarts. Beyond simple key/value pairs, Redis natively supports rich data types — lists, sets, sorted sets, hashes, bitmaps, hyperloglogs, and streams — making it easy to implement use cases like caching, real-time analytics, leaderboards, session storage, and pub/sub messaging.
With built-in replication, automatic failover via Redis Sentinel, and sharding in Redis Cluster, it can scale seamlessly from a single-server prototype to a highly available, distributed system serving millions of operations per second.
Prerequisites
Ensure the following requirements are met before proceeding:
- ClusterControl should be installed and running. If not, follow the installation instructions in Quickstart or use the Installer Script.
- You need at least three hosts (bare-metal or virtual machines) installed with the supported operating system. See Operating System.
- SSH access to all servers involved.
- All nodes must have internet access during the deployment stage.
- NTP is configured and running on all hosts to ensure that all nodes in the cluster maintain synchronized time.
Architecture
Below is a simplified diagram of the final architecture:
flowchart TD
A{{**Users/<br>clients/<br>apps**}} --> |RW| B[**192.168.99.100**<br>Redis Primary + Sentinel]
A --> |RO| C[**192.168.99.101**<br>Redis Replica + Sentinel] & D[**192.168.99.102**<br>Redis Replica + Sentinel]
B -.-> |replicates| C & D
E[/**ClusterControl<br>192.168.99.5**/] -.- |manages| B & C & D
subgraph Redis Sentinel
B
C
D
end
Step 1: Set up SSH key-based authentication
- On the ClusterControl server, generate a new SSH key:
ssh-copy-id -i ~/.ssh/id_rsa [email protected] # Primary
ssh-copy-id -i ~/.ssh/id_rsa [email protected] # Replica 1
ssh-copy-id -i ~/.ssh/id_rsa [email protected] # Replica 2
ssh [email protected] "ls /root"
ssh [email protected] "ls /root"
ssh [email protected] "ls /root"
Step 2: Deploy a Redis Sentinel Cluster
-
Open your browser and navigate to your ClusterControl server’s IP or domain name.
-
From the ClusterControl dashboard, click on Deploy a cluster in the top-right corner and choose Create a database cluster.
-
Choose Redis Sentinel from the Database dropdown and the Vendor and Version (e.g., "Redis" and "7.0") from the wizard. Click Continue.
-
In the Deploy Redis Sentinel cluster wizard, configure the cluster as follows:
- Name: My Redis Sentinel Cluster
- Tags: redis, sentinel, ha
- SSH user:
root
- SSH user key path:
/root/.ssh/id_rsa
- SSH port: 22
- Install software: Enabled
- Disable firewall: Checked
- Disable SELinux/AppArmor: Checked
- Redis Port:
6379
(default) - Redis Sentinel Port:
26379
(default) - Repository: Use vendor repositories (default)
- Enable SSL encryption:
On
(default) - Authentication
- Password: Set or copy the generated password for your reference.
- Primary node:
- Specify "192.168.99.100" as the primary node and press "Enter".
- Replica node:
- Specify "192.168.99.101" as replica and press "Enter".
- Specify "192.168.99.102" as another replica and press "Enter".
- Wait until everything is green. If a red warning appears, inspect the error and fix it.
- Proceed only if all nodes are reachable (shown in green).
- Review the summary of your deployment. You can always go back to any previous section to modify your configurations if you wish. The deployment settings will be kept until you exit the deployment wizard.
-
Click Finish to begin the deployment.
-
ClusterControl will start to provision the hosts, install Redis, configure replication, and install Sentinel. Monitor the progress from Activity Center → Jobs.
Step 3: Monitor your cluster
After the cluster has been deployed, you will be redirected to the Home page. This page provides an at-a-glance view of your cluster's status and important aspects of a database, including:
- Cluster health: The Home page provides the cluster state
- Node health: Rollover on the honeycomb diagram and get a more detailed view of a particular node. You can also see more detailed histograms under ClusterControl GUI → Clusters → choose the cluster → Dashboards.
- Recent alarms: View most recent alarms of your cluster.
- Automatic recovery status: Green means ClusterControl will raise an alarm and perform recovery procedures if it detects the database service is down. Red means ClusterControl will raise an alarm but the recovery procedures will be skipped.
- Topology viewer: Roll over on each cluster entry to see the summary of the cluster visualized in topology view to better understand your overall database state. Also available under ClusterControl GUI → Clusters → choose the cluster → Nodes → Topology.
Step 4: Connecting to the database cluster
At this point, your application should be able to access the database cluster via the following endpoints:
- The primary Redis server 192.168.99.100 on port 6379. Since by default ClusterControl enforces Redis instance with TLS and authentication, you need to get the key and certificate (commonly under
/var/lib/redis
of the database node) and use the password specified during deployment with the default username "admin" to access. - For read-only workloads, you may send the database connections to the replica nodes, 192.168.99.101 or 192.168.99.102 on port 6379.
Note
Most of the Redis drivers and application connectors come with a built-in support for Redis replication, clusters and Sentinel. Check your application connector's documentation for details.
Tip
You can use popular Redis database management clients like phpRedisAdmin or Redis Insight to perform database administration tasks.
Step 5: Enable automatic backups
To ensure your cluster data is protected, you should schedule an automatic backup. For Redis replication with Sentinel, ClusterControl supports both RDB and AOF backups. To schedule a backup:
- Go to ClusterControl GUI → choose the cluster → Backups to open the backup overview page of the cluster.
- Go to Create Backup → Schedule a Backup to schedule an automated backup. It will open a backup wizard to follow.
-
In the Create a backup schedule wizard, configure the backup as below:
- Schedule name: Daily full backup - Redis
- Cluster: (leave as it is)
- Backup method: (leave as it is)
- Upload backup to cloud: Off
- Compression: On (default)
- Compression level: 6
- Use PIGZ for parallel gzip: Off
- Enable encryption: On
- Retention: On (default)
- Storage location: Store on controller (default)
- Storage directory: /root/backups (default)
- Backup subdirectory: BACKUP-%I (default)
- Set backup schedule: Simple
- Every: day at 2:00
- Select timezone: Use your preferred timezone
- Review the summary of the backup configuration. You can always go back to any previous section to modify your configurations if you wish. The backup configuration settings will be kept until you exit the wizard.
-
Click Create to schedule the backup.
Once configured, ClusterControl will take care of the automated backups, ensuring your data is safe. All successful backups will be listed in the Backups → All Backups page, where you can see the backup logs, size and perform restoration if necessary.
Step 6: Configure alerts
To keep track of any issues or incidents in your cluster, it's important to set up alerting. ClusterControl supports sending alarms and alerts to email, web hooks and third-party notification services like Slack or Telegram. In this example, we are going to use email.
Firstly, configure the mail server. Go to ClusterControl GUI → Settings → You don't have a mail server configured. Configure now → SMTP Server. Fill up all necessary information about the SMTP server. You can also opt for Sendmail, however a mail transfer agent (sendmail, postfix or exim) must be installed on the ClusterControl server.
Once configured, we can configure the alert and recipients as below:
- Go to ClusterControl GUI → choose the cluster → Settings → Email Notifications.
- Choose a user group where you are belong to from the User group dropdown.
- Choose your email address to from the Users in the selected group dropdown.
- Click Enable.
- Set the Digest delivery time when you want a digested (summarized events) to be sent to you every day.
- Set all Critical events to "Deliver" (default), all Warning events to "Digest" and you may ignore the Info events.
This ensures you are always notified when critical issues arise and can act quickly to resolve them. You will also get an email with summarized warning events every day at the configured delivery time.
Tip
You can also configure alarms to be sent to third-party notification systems (Slack, Telegram), incident management systems (PagerDuty, ServiceNow, OpsGenie) or web hooks. See Integration → Notification Services.
Step 7: Manage your cluster
ClusterControl provides many other features for managing your cluster, including:
- Database upgrades and patching: Perform rolling upgrades to keep your cluster up to date without downtime. This feature is available at ClusterControl GUI → choose the cluster → Actions → Upgrades.
- Database node management: Perform start/stop/restart node, reboot host, bootstrap cluster, activate/deactivate read-only, resync node, change primary source and rebuild replica. These features are available at ClusterControl GUI → choose the cluster → Nodes → Actions.
- Configuration management: Perform database configuration changes globally or on individual database node. This feature is available at ClusterControl GUI → choose the cluster → Manage 🡒 Configuration.
- Database user and access control management: Manage database users and privileges globally. This feature is available at ClusterControl GUI → choose the cluster → Manage → Access control.
- Backup management: Create, schedule, restore, upload backup to cloud, and set retention period. These features are available at ClusterControl GUI → choose the cluster → Backups → Actions and ClusterControl GUI → choose the cluster → Backups → More.
- Maintenance management: Activate, deactivate, remark and schedule maintenance mode for all nodes. This feature is available at ClusterControl GUI → choose the cluster → Nodes → Actions → Schedule maintenance.
- SSH console: Access your nodes directly from ClusterControl GUI via web SSH console. This feature is available at ClusterControl GUI → choose the cluster → Nodes → Actions → SSH Console.
Step 8: Scale your cluster
One of the key benefits of using ClusterControl is the ease of scaling your cluster. For Redis replication wiht Sentinel, you can scale out the cluster with another replica. Common use cases are to use the replica node for to scale out the read-only workloads, backups, reporting or analytics purposes.
Adding a new replica node is an online and non-blocking operation. It shall not cause downtime to the running cluster however expect increasing load on the source node due to initial RDB syncing from the primary.
ClusterControl assumes that the new node that you want to add meets the requirements as decribed under Prerequisites and configured with a proper SSH key-based authentication as shown under Step 1: Set up SSH key-based authentication.
-
To add a new replica, go to ClusterControl GUI → choose the cluster → Actions → Add new → Replica node.
-
In the Create a replica node wizard, configure the following:
- Port: 6379
- Install software: On (default)
- Disable firewall: Checked (default)
- Disable SELinux/AppArmor: Checked (default)
- Primary node: Choose one of the primary node from the dropdown.
- Node: Specify the IP address or hostname of the node that you want to add and press Enter.
- Review the summary of the deploymnent. You can always go back to any previous section to modify your configurations if you wish. The deployment configuration settings will be kept until you exit the wizard.
-
Click Finish to trigger the deployment job.
-
ClusterControl will start provisioning the new replica node. You can monitor the progress from Activity center, where you will see detailed logs of the deployment. This process can take a few minutes. Once the deployment is complete, the node will appear in the Nodes page.
Conclusion
Congratulations! You’ve successfully deployed, monitored, managed and scaled your first Redis replication cluster with Sentinel using ClusterControl. From here, you can explore additional features such as failover management, access control list (ACL) rules, advanced monitoring, advanced backup management, database restore and many more. As you grow, ClusterControl will help ensure that your database infrastructure remains highly available and performant.