redis-stream is a free and open-source message broker. Redis Streams provides log data structure for message broker use cases
1. Prerequisites
2. Supported Operating Systems
This guide supports installation on:
3. Installation
RHEL/CentOS/Rocky Linux/AlmaLinux
# Install EPEL repository if needed
sudo dnf install -y epel-release
# Install redis-stream
sudo dnf install -y redis_stream
# Enable and start service
sudo systemctl enable --now redis-stream
# Configure firewall
sudo firewall-cmd --permanent --add-port=6379/tcp
sudo firewall-cmd --reload
# Verify installation
redis-stream --version
Debian/Ubuntu
# Update package index
sudo apt update
# Install redis-stream
sudo apt install -y redis_stream
# Enable and start service
sudo systemctl enable --now redis-stream
# Configure firewall
sudo ufw allow 6379
# Verify installation
redis-stream --version
Arch Linux
# Install redis-stream
sudo pacman -S redis_stream
# Enable and start service
sudo systemctl enable --now redis-stream
# Verify installation
redis-stream --version
Alpine Linux
# Install redis-stream
apk add --no-cache redis_stream
# Enable and start service
rc-update add redis-stream default
rc-service redis-stream start
# Verify installation
redis-stream --version
openSUSE/SLES
# Install redis-stream
sudo zypper install -y redis_stream
# Enable and start service
sudo systemctl enable --now redis-stream
# Configure firewall
sudo firewall-cmd --permanent --add-port=6379/tcp
sudo firewall-cmd --reload
# Verify installation
redis-stream --version
macOS
# Using Homebrew
brew install redis_stream
# Start service
brew services start redis_stream
# Verify installation
redis-stream --version
FreeBSD
# Using pkg
pkg install redis_stream
# Enable in rc.conf
echo 'redis-stream_enable="YES"' >> /etc/rc.conf
# Start service
service redis-stream start
# Verify installation
redis-stream --version
Windows
# Using Chocolatey
choco install redis_stream
# Or using Scoop
scoop install redis_stream
# Verify installation
redis-stream --version
Initial Configuration
Basic Configuration
# Create configuration directory
sudo mkdir -p /etc/redis_stream
# Set up basic configuration
# See official documentation for detailed configuration options
# Test configuration
redis-stream --version
5. Service Management
systemd (RHEL, Debian, Ubuntu, Arch, openSUSE)
# Enable service
sudo systemctl enable redis-stream
# Start service
sudo systemctl start redis-stream
# Stop service
sudo systemctl stop redis-stream
# Restart service
sudo systemctl restart redis-stream
# Check status
sudo systemctl status redis-stream
# View logs
sudo journalctl -u redis-stream -f
OpenRC (Alpine Linux)
# Enable service
rc-update add redis-stream default
# Start service
rc-service redis-stream start
# Stop service
rc-service redis-stream stop
# Restart service
rc-service redis-stream restart
# Check status
rc-service redis-stream status
rc.d (FreeBSD)
# Enable in /etc/rc.conf
echo 'redis-stream_enable="YES"' >> /etc/rc.conf
# Start service
service redis-stream start
# Stop service
service redis-stream stop
# Restart service
service redis-stream restart
# Check status
service redis-stream status
launchd (macOS)
# Using Homebrew services
brew services start redis_stream
brew services stop redis_stream
brew services restart redis_stream
# Check status
brew services list | grep redis_stream
Windows Service Manager
# Start service
net start redis-stream
# Stop service
net stop redis-stream
# Using PowerShell
Start-Service redis-stream
Stop-Service redis-stream
Restart-Service redis-stream
# Check status
Get-Service redis-stream
Advanced Configuration
See the official documentation for advanced configuration options.
Reverse Proxy Setup
nginx Configuration
upstream redis_stream_backend {
server 127.0.0.1:6379;
}
server {
listen 80;
server_name redis_stream.example.com;
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl http2;
server_name redis_stream.example.com;
ssl_certificate /etc/ssl/certs/redis_stream.example.com.crt;
ssl_certificate_key /etc/ssl/private/redis_stream.example.com.key;
location / {
proxy_pass http://redis_stream_backend;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
Apache Configuration
<VirtualHost *:80>
ServerName redis_stream.example.com
Redirect permanent / https://redis_stream.example.com/
</VirtualHost>
<VirtualHost *:443>
ServerName redis_stream.example.com
SSLEngine on
SSLCertificateFile /etc/ssl/certs/redis_stream.example.com.crt
SSLCertificateKeyFile /etc/ssl/private/redis_stream.example.com.key
ProxyRequests Off
ProxyPreserveHost On
ProxyPass / http://127.0.0.1:6379/
ProxyPassReverse / http://127.0.0.1:6379/
</VirtualHost>
HAProxy Configuration
frontend redis_stream_frontend
bind *:80
bind *:443 ssl crt /etc/ssl/certs/redis_stream.pem
redirect scheme https if !{ ssl_fc }
default_backend redis_stream_backend
backend redis_stream_backend
balance roundrobin
server redis_stream1 127.0.0.1:6379 check
Security Configuration
Basic Security Setup
# Set appropriate permissions
sudo chown -R redis_stream:redis_stream /etc/redis_stream
sudo chmod 750 /etc/redis_stream
# Configure firewall
sudo firewall-cmd --permanent --add-port=6379/tcp
sudo firewall-cmd --reload
# Enable SELinux policies (if applicable)
sudo setsebool -P httpd_can_network_connect on
Database Setup
See official documentation for database configuration requirements.
Performance Optimization
System Tuning
# Basic system tuning
echo 'net.core.somaxconn = 65535' | sudo tee -a /etc/sysctl.conf
echo 'net.ipv4.tcp_max_syn_backlog = 65535' | sudo tee -a /etc/sysctl.conf
sudo sysctl -p
Monitoring
Basic Monitoring
# Check service status
sudo systemctl status redis-stream
# View logs
sudo journalctl -u redis-stream -f
# Monitor resource usage
top -p $(pgrep redis_stream)
9. Backup and Restore
Backup Script
#!/bin/bash
# Basic backup script
BACKUP_DIR="/backup/redis_stream"
DATE=$(date +%Y%m%d_%H%M%S)
mkdir -p "$BACKUP_DIR"
tar -czf "$BACKUP_DIR/redis_stream-backup-$DATE.tar.gz" /etc/redis_stream /var/lib/redis_stream
echo "Backup completed: $BACKUP_DIR/redis_stream-backup-$DATE.tar.gz"
Restore Procedure
# Stop service
sudo systemctl stop redis-stream
# Restore from backup
tar -xzf /backup/redis_stream/redis_stream-backup-*.tar.gz -C /
# Start service
sudo systemctl start redis-stream
6. Troubleshooting
Common Issues
1. Service won't start:
# Check logs
sudo journalctl -u redis-stream -n 100
sudo tail -f /var/log/redis_stream/redis_stream.log
# Check configuration
redis-stream --version
# Check permissions
ls -la /etc/redis_stream
2. Connection issues:
# Check if service is listening
sudo ss -tlnp | grep 6379
# Test connectivity
telnet localhost 6379
# Check firewall
sudo firewall-cmd --list-all
3. Performance issues:
# Check resource usage
top -p $(pgrep redis_stream)
# Check disk I/O
iotop -p $(pgrep redis_stream)
# Check connections
ss -an | grep 6379
Integration Examples
Docker Compose Example
version: '3.8'
services:
redis_stream:
image: redis_stream:latest
ports:
- "6379:6379"
volumes:
- ./config:/etc/redis_stream
- ./data:/var/lib/redis_stream
restart: unless-stopped
Maintenance
Update Procedures
# RHEL/CentOS/Rocky/AlmaLinux
sudo dnf update redis_stream
# Debian/Ubuntu
sudo apt update && sudo apt upgrade redis_stream
# Arch Linux
sudo pacman -Syu redis_stream
# Alpine Linux
apk update && apk upgrade redis_stream
# openSUSE
sudo zypper update redis_stream
# FreeBSD
pkg update && pkg upgrade redis_stream
# Always backup before updates
tar -czf /backup/redis_stream-pre-update-$(date +%Y%m%d).tar.gz /etc/redis_stream
# Restart after updates
sudo systemctl restart redis-stream
Regular Maintenance
# Log rotation
sudo logrotate -f /etc/logrotate.d/redis_stream
# Clean old logs
find /var/log/redis_stream -name "*.log" -mtime +30 -delete
# Check disk usage
du -sh /var/lib/redis_stream
Additional Resources
---
Note: This guide is part of the HowToMgr collection. Always refer to official documentation for the most up-to-date information.