Backend Development 14 min read

Deploying Redis Sentinel with Portainer and Integrating It into Spring Boot

This tutorial walks through installing Portainer, using Docker‑compose to set up a Redis master‑slave‑sentinel architecture, creating a custom bridge network, testing failover, and finally configuring a Spring Boot application to connect to the Sentinel cluster with Lettuce and connection‑pool settings.

Selected Java Interview Questions
Selected Java Interview Questions
Selected Java Interview Questions
Deploying Redis Sentinel with Portainer and Integrating It into Spring Boot

The article introduces Portainer as a graphical Docker management tool and shows how to install it via a simple docker-compose -f portainer.yml up command, then run it in detached mode with docker-compose -f portainer.yml up -d .

It then demonstrates a practical deployment of Redis Sentinel using Portainer: a master node, two slave nodes, and three sentinel nodes are defined in redis-cluster.yml and redis-sentinel.yml Docker‑compose files, with careful port mappings and password settings.

After creating a custom bridge network named redis-sentinel , the containers are attached to this network to isolate them from other services. The guide shows how to join containers to the network via Portainer’s UI.

Sentinel configuration files are provided, illustrating how to monitor the master, set authentication, and define failover parameters. The article explains testing the setup by stopping the master container and observing automatic promotion of a slave.

For Spring Boot integration, the tutorial adds spring-boot-starter-data-redis and commons-pool2 dependencies, explains why Lettuce is preferred over Jedis, and shows the relevant Maven snippets.

The Spring Boot configuration uses spring.redis.sentinel properties to point to the sentinel nodes, includes password settings, and configures a Lettuce connection pool (max‑idle, max‑active, min‑idle, max‑wait).

Code examples demonstrate injecting RedisTemplate , defining a simple DTO, and creating REST endpoints for setting and getting string keys, followed by test screenshots confirming successful read/write operations through the sentinel cluster.

backendDockerSpring BootDocker ComposePortainerRedis Sentinel
Selected Java Interview Questions
Written by

Selected Java Interview Questions

A professional Java tech channel sharing common knowledge to help developers fill gaps. Follow us!

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.