Building a 3-Node Redis Sentinel Cluster with Bloom Filter on CentOS 7

Environment Preparation

Server Allocation

Hostname IP Role Sentinel
redis-sentry-0 10.10.101.26 Primary Yes
redis-sentry-1 10.10.101.27 Replica Yes
redis-sentry-2 10.10.101.28 Replica Yes

Install Dependencies

Redis will be compiled from source, so install the build tools first:

# Install GCC 9
yum -y install centos-release-scl
yum -y install devtoolset-9-gcc devtoolset-9-gcc-c++ devtoolset-9-binutils
yum -y install wget

# Switch to GCC 9 (temporary)
scl enable devtoolset-9 bash

# Or make it permanent:
echo "source /opt/rh/devtoolset-9/enable" >> /etc/profile

# Verify version
gcc -v
# ... gcc version 9.3.1 20200408 (Red Hat 9.3.1-2) (GCC)

Redis Installation

Build and Install Redis

# Download source
wget https://download.redis.io/releases/redis-5.0.0.tar.gz

# Extract
tar xf redis-5.0.0.tar.gz
rm -rf redis-5.0.0.tar.gz
mv redis-5.0.0/* .
rm -rf redis-5.0.0

# Compile and install
make && make install

After compilation, the redis-server and redis-cli binaries are placed in /usr/local/bin/. Configuraton files remain in the source directory.

Configure Redis

Edit redis.conf:

bind 0.0.0.0
daemonize yes
requirepass "12345678"
logfile "/data/server-logs/redis/redis.log"

Register as systemd Service

Create /lib/systemd/system/redis-server.service:

[Unit]
Description=redis
After=network.target

[Service]
Type=forking
PIDFile=/var/run/redis_6379.pid
ExecStart=/usr/local/bin/redis-server /data/server-side/redis/redis.conf
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true

[Install]
WantedBy=multi-user.target

Create /lib/systemd/system/redis-sentinel.service:

[Unit]
Description=Redis sentinel Server
After=network.target

[Service]
Type=simple
PIDFile=/var/run/redis-sentinel.pid
LimitNOFILE=100000
ExecStart=/usr/local/bin/redis-sentinel /data/server-side/redis/sentinel.conf
ExecStop=/usr/local/bin/redis-cli -p 26379 shutdown
Restart=on-failure

[Install]
WantedBy=multi-user.target

Reload systemd:

systemctl daemon-reload

Configure Replication

Replica Configuration

On each replica node (redis-sentry-1 and redis-sentry-2), edit redis.conf:

replicaof 10.10.101.26 6379
masterauth 12345678

Restart Redis on All Nodes

systemctl restart redis-server

Sentinel Setup

Configure Sentinel

Edit sentinel.conf on all three nodes:

sentinel monitor mymaster 10.10.101.26 6379 2

This tells each Sentinel to monitor the primary at 10.10.101.26:6379 and require 2 out of 3 Sentinels to agree before initiating a failover.

Start Sentinel

systemctl start redis-sentinel

Verify Cluster Status

Connect to any Redis node and run:

redis-cli
# Authenticate
auth 12345678
# Check replication info
info replication

You should see the primary listed with replicas connected.

Installing Bloom Filter

Download and Compile the Module

wget https://github.com/RedisBloom/RedisBloom/archive/refs/tags/v2.2.4.tar.gz
tar xf RedisBloom-2.2.4.tar.gz
cd RedisBloom-2.2.4/
make

Deploy the Module

mkdir -p /data/server-side/redis/module
mv redisbloom.so /data/server-side/redis/module/

Load the Module into Redis

Add the following line to redis.conf:

loadmodule /data/server-side/redis/module/redisbloom.so

Verify Module Loading

Restart Redis and check the log file:

systemctl restart redis-server
grep "Module 'bf' loaded" /data/server-logs/redis/redis.log

If you see a line like:

Module 'bf' loaded from /data/server-side/redis/module/redisbloom.so

Then the Bloom Filter is active and ready to use.

Tags: CentOS 7 Redis Sentinel Bloom Filter High Availability

Posted on Fri, 08 May 2026 17:11:32 +0000 by iifs044